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

Create generic container for relationships #220

Open
3 of 7 tasks
ml-evs opened this issue Jan 22, 2023 · 1 comment
Open
3 of 7 tasks

Create generic container for relationships #220

ml-evs opened this issue Jan 22, 2023 · 1 comment
Assignees
Milestone

Comments

@ml-evs
Copy link
Member

ml-evs commented Jan 22, 2023

Currently our "relationships" are hardcoded by storing lists like "file_objectIds" within each document that is the intended place to link items in the database.

Instead, we should encapsulate this in generic relationships objects that can have descriptions and types.

Initially these can be stored at the document level (and a choice can be made on a type-basis whether it is worth storing bidirectional links).

In the future, as suggested by @jdbocarsly, it is probably worth adding a new relationships collection that simply stores the IDs and link types for automatic bidirectional search (3NF style). At that point, we would need to decide whether the values of the relationships should be inlined into the document when returned from the API (i.e., an aggregation pipeline), to keep the current behaviour.

I will use this issue to track progress generally on the work started in #218:

  • Add generic typed relationships container
  • Make utility functions to create, remove, and manage relationships and keep them in sync with the rest of an item's data.
  • Migrate all previous relationships to said container
    • Items <-> Items (i.e., Samples <-> Starting Materials)
    • Items -> Files
    • Items -> Blocks
  • Consider storing relationships in separate database
@ml-evs ml-evs self-assigned this Jan 24, 2023
@ml-evs ml-evs added this to the v0.2 milestone Jan 25, 2023
@ml-evs
Copy link
Member Author

ml-evs commented Sep 24, 2024

#862 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant