Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model architecture: "Alias IDs" or shareKeys #4774

Closed
soyarsauce opened this issue Sep 24, 2020 · 6 comments
Closed

Model architecture: "Alias IDs" or shareKeys #4774

soyarsauce opened this issue Sep 24, 2020 · 6 comments
Assignees

Comments

@soyarsauce
Copy link
Contributor

soyarsauce commented Sep 24, 2020

Expanding on #3654 (comment),

@nf-s : >It should be easy to add some sort of id map if needed though

@soyarsauce:

yeah id map is easy but we should do it at terriajs level as a trait.

for magda - when i put a v7 catalog into https://github.com/TerriaJS/init-to-magda it will generate UUIDs to avoid name clashes. so in the DEA prod v7 catalog right now, there exists a layer with ID dea_coastlines but it gets created into something that looks like https://dev.saas.terria.io/api/v0/registry-auth/records/b7dc3bcc-0a96-4d76-a190-dec7c42e132f?optionalAspect=terria

maybe just simplifying it down, all we need is a way to store that b7dc3bcc-0a96-4d76-a190-dec7c42e132f used to have IDs (or ID generated from name) that included dea_coastlines, so that share/story links have a way to reference back and it'll "just work"

and via @nf-s

I think that might sort out my user added data nested group id problem also - as I would just need to convert id for the top level group - and it could have some reference to its old id, so all nested items can still refer to it

Let's get a minimal implementation of this, while being careful that it doesn't break actual normal ID usage, ie getModelById should always return a model that actually has a uniqueId foo1 over a model that has uniqueId bar2 but with aliasIds: ["foo1"]

@nf-s
Copy link
Contributor

nf-s commented Sep 24, 2020

I think shareKeys from master may be relevant -

/**
* An array of all possible keys that can be used to match to this catalog member when specified in a share link -
* used for maintaining backwards compatibility when adding or changing {@link CatalogMember#id}.
*
* @type {String[]}
*/
this.shareKeys = undefined;

@soyarsauce
Copy link
Contributor Author

On @steve9164 Sprint64Top10, to reach out to team if run into things

@soyarsauce
Copy link
Contributor Author

Crispy to start implementation and we take it from there

(brief discussion)
//nfs: problem: going from catalog based maps, to magda based maps.

  • magda will add "random IDs" to everything
  • IDs do not match the automatically generated ID (from a json based catalog)
  • share keys added in catalog-converter - perhaps generate IDs in catalog converter
  • init-to-magda to carry the rest of the load of (v8 json catalog -> magda)

@tephenavies tephenavies mentioned this issue Nov 8, 2020
2 tasks
@tephenavies
Copy link
Member

tephenavies commented Nov 8, 2020

  • Implement shareKeys for JSON catalogs (see Share keys #4975)
    • Add shareKeys when a JSON catalog is loaded
    • Try to match ids in share data by registered share keys (if an id doesn't resolve to a model) for:
      • Share data model strata
      • Share data such as workbench & timeline
  • Generalise shareKeys to work with Magda catalogs:
    • Decide whether shareKeys should be registered for a MagdaReference or for it's target
      • Check some things for a catalog made of MagdaReferences:
        • Are ids shared between Reference and target?
        • If not check which id is serialised for models & workbench
        • Is every node in the tree represented with a MagdaReference pointing at an item. And is this guaranteed somehow?
      • Try implementing for targets
      • Add some simple unit tests for this method
      • Test against a real magda
    • Add tests for Magda catalogs that share keys are registered

UPDATE 11/11/2020:


UPDATE 17/11/2020:

  • Working on shareKeys in Magda catalog + tests

@tephenavies tephenavies changed the title Model architecture: "Alias IDs" Model architecture: "Alias IDs" or shareKeys Nov 12, 2020
@nf-s nf-s self-assigned this Dec 1, 2020
@nf-s
Copy link
Contributor

nf-s commented Dec 2, 2020

Finalising sharekeys effort:

@nf-s
Copy link
Contributor

nf-s commented Dec 18, 2020

Closing!

@nf-s nf-s closed this as completed Dec 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants