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

Pull Schema, Topology, and Hierarchy Utilities into Separate Library #173

Open
U8NWXD opened this issue Mar 23, 2022 · 0 comments
Open

Pull Schema, Topology, and Hierarchy Utilities into Separate Library #173

U8NWXD opened this issue Mar 23, 2022 · 0 comments

Comments

@U8NWXD
Copy link
Member

U8NWXD commented Mar 23, 2022

Scattered throughout Vivarium, we have functions to perform operations on schemas, topologies, and hierarchies, e.g. inverse_topology. I think the codebase would be easier to understand if we pulled these functions into a new library under vivarium/library so that we can document and test them thoroughly.

In this library, we would have 3 kinds of entities:

  • Hierarchies are trees of data.
  • Schemas assign metadata to each node in the tree.
  • Topologies are like MongoDB projections. They describe how to retrieve data from a hierarchy and re-shape it into a desired structure.

The library would provide functions to do the following:

  • Reach into a hierarchy and retrieve values in the form specified by a topology.
  • Invert a topology (this function takes in one topology and returns a new topology).
  • Given a set of schemas and a set of topologies, create a hierarchy. This function should take parameters to describe how to initialize the hierarchy values from the schema rather than hard-coding a special key like _default. This also shouldn't be dependent on the Store class.
  • Take a hierarchy and figure out what schemas need to change to effect a change in that hierarchy. This function will also need to take the schemas as an argument.
  • Perform operations (e.g. updates) over a hierarchy based on a set of schemas.

Possibly related: #100

@U8NWXD U8NWXD changed the title [WIP] Pull Schema, Topology, and Hierarchy Utilities into Separate Library Pull Schema, Topology, and Hierarchy Utilities into Separate Library Mar 23, 2022
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