Closed indiciumx closed 1 year ago
History #1Updated by Bo Lu 8 months ago Comment Edit Is there a way to support collections in GeoCore?
This record from DFO seems to be very boring in geo.ca :L
https://gcgeo.gc.ca/geonetwork/metadata/eng/4c7880ac-cb01-4e12-8305-2ae8eb675390
https://app-stage.geo.ca/result?id=4c7880ac-cb01-4e12-8305-2ae8eb675390&lang=en From #27495, here is a test case with uuid: 4c7880ac-cb01-4e12-8305-2ae8eb675390
#2Updated by Bo Lu 8 months ago Target version set to 1.0.5 #3Updated by Bo Lu 5 months ago Status changed from New to In Progress Comment Edit Steps to add this features: 1) Add code to the HNAP to GeoCore translation lambda to create a new field which contains the parent uuid. Currently, we are guaranteed that one child will only have one parent. 2) Generate the parquet file as normal, a new column will be created when the geocore format is normalized. Not work needed for this step. 3) Write a lambda function that contains a AWS Athena SQL function that queries a given uuid and returns child record(s) and a parent record if they exist as JSON via an API. 4) Front end programming is needed to read the JSON API and display the parent/child record(s).
#4Updated by Bo Lu 4 months ago File parentID.PNG added Comment Edit 1) adding parent identifier is complete
2) this is automatically generated 3) It is likely better to use a NoSQL database for storing this information. I.e., One lambda will read the parquet file and store the parent->child relationship in the NoSQL database. Another lambda will: 1) reveal what records are parents and their respective children (e.g., collections?summary=true) and 2) what are the children for a particular parent (e.g., collections?id=UUID)
#5Updated by Bo Lu 4 months ago Comment Edit After some final thoughts, I determined that it is easier and more dynamic to have a lambda read the parquet file and filter out the parents and siblings. Performance is good, <1 seconds.
Example usage: collections?uuid=9cad712a-5ac5-4248-b7d7-2db1a3892509
{ "statusCode": 200, "children_count": 3, "parent": { "id": "08b810c2-7c81-40f1-adb1-c32c8a2c9f50", "description_en": "Floods in Canada - Cartographic Product Collection", "description_fr": "Inondations au Canada - collections de produits cartographiques" }, "children": [ { "id": "74144824-206e-4cea-9fb9-72925a128189", "description_en": "Floods in Canada - Archive", "description_fr": "Inondations au Canada – Archive" }, { "id": "9cad712a-5ac5-4248-b7d7-2db1a3892509", "description_en": "Active Floods in Canada", "description_fr": "Inondations en cours au Canada" }, { "id": "b1afd8d2-6e14-4ec4-9a09-652221a6cb71", "description_en": "Floods in Canada - Current Year", "description_fr": "Inondations au Canada – Année courante" } ] } #6Updated by Bo Lu 3 months ago Comment Edit Changed 'uuid' to 'id' in the parameters for consistency between the search api. Displays 'self', which echoes the query parameter Example case 1, no parameters provided: collections?
{ "statusCode": 200, "body": "No id parameter was passed. Usage: ?id=XYZ" } Example case 2, searching for a non-existing record: collections?id=ASDF
{ "statusCode": 200, "sibling_count": 0, "self": null, "parent": null, "sibling": null } Example case 3, searching for a child record: collections?id=9cad712a-5ac5-4248-b7d7-2db1a3892509
{ "statusCode": 200, "sibling_count": 2, "self": { "id": "9cad712a-5ac5-4248-b7d7-2db1a3892509", "description_en": "Active Floods in Canada", "description_fr": "Inondations en cours au Canada" }, "parent": { "id": "08b810c2-7c81-40f1-adb1-c32c8a2c9f50", "description_en": "Floods in Canada - Cartographic Product Collection", "description_fr": "Inondations au Canada - collections de produits cartographiques" }, "sibling": [ { "id": "74144824-206e-4cea-9fb9-72925a128189", "description_en": "Floods in Canada - Archive", "description_fr": "Inondations au Canada – Archive" }, { "id": "b1afd8d2-6e14-4ec4-9a09-652221a6cb71", "description_en": "Floods in Canada - Current Year", "description_fr": "Inondations au Canada – Année courante" } ] } Example case 4, searching for a parent record: collections?id=08b810c2-7c81-40f1-adb1-c32c8a2c9f50
{ "statusCode": 200, "sibling_count": 3, "self": { "id": "08b810c2-7c81-40f1-adb1-c32c8a2c9f50", "description_en": "Floods in Canada - Cartographic Product Collection", "description_fr": "Inondations au Canada - collections de produits cartographiques" }, "parent": null, "sibling": [ { "id": "74144824-206e-4cea-9fb9-72925a128189", "description_en": "Floods in Canada - Archive", "description_fr": "Inondations au Canada – Archive" }, { "id": "9cad712a-5ac5-4248-b7d7-2db1a3892509", "description_en": "Active Floods in Canada", "description_fr": "Inondations en cours au Canada" }, { "id": "b1afd8d2-6e14-4ec4-9a09-652221a6cb71", "description_en": "Floods in Canada - Current Year", "description_fr": "Inondations au Canada – Année courante" } ] } Example case 5, searching for a record without sibling or parent: collections?id=2bcf34b5-4e9a-431b-9e43-1eace6c873bd
{ "statusCode": 200, "sibling_count": 0, "self": { "id": "2bcf34b5-4e9a-431b-9e43-1eace6c873bd", "description_en": "Inuit Communities Location", "description_fr": "Localisation des communautés inuites" }, "parent": null, "sibling": null } #7Updated by Bo Lu 3 months ago Status changed from In Progress to Resolved Comment Edit Marking as resolved.
Documentation available on: https://redmine.gcgeo.gc.ca/redmine/projects/geo-ca/wiki/Collections_API
#8Updated by Bo Lu 3 months ago % Done changed from 0 to 100
Pushed to PROD and functioning. Great work everyone! 🎉
There's no collection (parent/child relationship) feature in Geo.ca. In FGP, a child record is related to its parent with the following tag: