Comments (9)
Could you clarify this issue? As far as I can tell, each of the three returned areas exists in the production database:
* https://openbeta.io/crag/1db1e8ba-a40e-587c-88a4-64f5ea814b8e * https://openbeta.io/crag/60bc2823-f54f-59fa-9443-f61a87765009 * https://openbeta.io/crag/8293b197-46ad-5f05-8f6d-b72387f2f191
If you look at the exported data, here is an example:
https://github.com/OpenBeta/openbeta-export/tree/production/usa/alabama/bucks_pocket
Searching on any of those ancestor ids brings up the following:
You can see there are not actual hits, besides in the ancestor field. These do not point to the _id field of an area like the children do. With this data there is no way for me to link an ancestor to a sub area
from openbeta-graphql.
There was a discussion here:
https://discord.com/channels/815145484003967026/815490505143484427/1144641711209971756
from openbeta-graphql.
yeah that could be the case, but the _id and child fields in the export data match, whereas the ancestor does not. So either ancestor is wrong or both _id and children are wrong
from openbeta-graphql.
As mentioned in the Discord chat, they are two different fields in the DB, therefore we can't simply convert _id to areaId
which is used in the ancestors
field and openbeta.io URL slug.
query GetUSA {
area(uuid: "1db1e8ba-a40e-587c-88a4-64f5ea814b8e") {
areaName
children {
id
areaName
metadata {
areaId
}
}
}
}
result (truncated to save space)
{
"data": {
"area": {
"areaName": "USA",
"children": [
{
"id": "63689d10e80bff5a994f159a", // We only store this id field in the db. The rest is populated during the query.
"areaName": "Alabama",
"metadata": {
"areaId": "60bc2823-f54f-59fa-9443-f61a87765009"
}
},
{
"id": "63689d10e80bff5a994f1667",
"areaName": "Arkansas",
"metadata": {
"areaId": "b33d5a8f-4494-55c0-a863-049dce4065d9"
}
}
]}}
}
When inserting new areas, the parent's children[]
only contains foreign keys of child area IDs (autogenerated by Mongo). During a query, we populate children[] with the actual area object.
- The database export script simply converts the area document to JSON.
metadata.areaId
was added to the DB sometime later. It's used in the ancestor field and page slug on openbeta.io
The proper fix is described in #109.
@ClimbFlyCamp can you insert area data as is and do a join in your db queries?
@musoke It is a bit odd that the three are in a single comma separated string.
It allows us to use regular expressions to test relationships such as is this area under Colorado? or does this area share the ancestor as crag Y? (Model tree structures with materialized paths)
from openbeta-graphql.
Could you clarify this issue? As far as I can tell, each of the three returned ids corresponds to an area that exists in the production database:
- https://openbeta.io/crag/1db1e8ba-a40e-587c-88a4-64f5ea814b8e
- https://openbeta.io/crag/60bc2823-f54f-59fa-9443-f61a87765009
- https://openbeta.io/crag/8293b197-46ad-5f05-8f6d-b72387f2f191
It is a bit odd that the three are in a single comma separated string.
from openbeta-graphql.
Ah, I see! It's just a bug in exported data.
I suspect that the ancestor property already has the ID one would actually want and it's the other IDs that have a bug.
The export script is here: https://github.com/OpenBeta/openbeta-graphql/blob/develop/src/db/export/json/index.ts and can be invoked with something like yarn export-prod
.
from openbeta-graphql.
Is there a workaround for converting the id seen in ancestor (1db1e8ba-a40e-587c-88a4-64f5ea814b8e
) to the model in _id (63689d10e80bff5a994f15ad
)?
from openbeta-graphql.
@musoke do you happen to know of a workaround to convert UUID to ObjectId? Not super familiar with uuid-mongodb
, but wondering if I can convert acestors to an ObejctId when I import the data into my db for the time being
from openbeta-graphql.
@vnugent: Thanks for the helpful info, but still had one question. When looking at the area_id
in the metadata field in the generated JSON files, I am not seeing the data stored in the format described above. Here is an example:
"area_id":"l9gdD2NyXWSmLfkwhEsZNg=="
I was going to join on the area_id
found in the metadata
object, but this also does not seem to match the expected values. I thought this must of been an encoded string, but couldn't find the proper decoding mechanism.
Any insight here?
from openbeta-graphql.
Related Issues (20)
- Set isBoulder flag to crags with mostly boulder problems
- Update Typesense index whenever a new climb is updated/created
- Add install Mongo db tools to the Readme HOT 1
- Improve API documentation
- Adding MP ids to climbs
- updateUserProfile() should accept a blank website
- add Brasil grade context
- Server won't start
- PR Build Pipeline broken HOT 3
- Can't set area left-right index
- Create an export job to generate crag-only geojson HOT 1
- Add area should also take lat/long
- Update stats job should set area bbox to null if there are no children
- Crag exporter job incorrectly converts parent crag object
- feat: assign photo license API
- feat: topo data API HOT 6
- Improve our existing Grafana dashboard HOT 2
- Relax boulder problems only restriction
- Refactor maptiles data type
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openbeta-graphql.