Skip to content

Contribution identifiers - #2116

Draft
bfoley12 wants to merge 10 commits into
devfrom
contribution-identifiers
Draft

Contribution identifiers#2116
bfoley12 wants to merge 10 commits into
devfrom
contribution-identifiers

Conversation

@bfoley12

Copy link
Copy Markdown
Collaborator

Summary

Modified how Contributions are identified.

Previously:

  • Uniqueness was only sometimes guaranteed by {Contribution.project, Contribution.identifier} (identifier is a user-defined field - it can be random, but was often set to an mp-id) - only true when it's Project had Project.unique_identifiers == True
  • If Project.unique_identifiers == False, the only way to get a unique Contribution was by querying the Contribution._id, which is an ObjectId - very cumbersome

This branch:

  • Removed Contribution.identifier
  • Contributions are guaranteed to be identified uniquely by {project, material_id, chemical_system_id, formula, unique_value?, condition_key?}:
    • Contribution.project: unchanged, the project the contribution belongs to
    • Contribution.material_id: the mp-id of the material being studied
    • Contribution.chemical_system_id: the chemical system string
    • Contribution.formula: unchanged, the formula of the system
    • Contribution.unique_value: optional, but required in Contributions that are not uniquely identified by the previous fields. This is specified by the user as a Contribution.data field, then extracted by the server into unique_value, so we can define a MongoDB index on it
    • Contribution.condition_key: Added in anticipation of another branch that 'pivots' contributions when conditions are present. Not fully developed, but set as a harness to use later.
  • Added validation to identifier fields
    • material_id: must start with "mp-" and be followed by numbers, with leading zeros being trimmed
    • chemical_system_id: hyphen-delimited list of valid Elements
    • formula: NFKC normalized string of valid elements and numbers (trimming leading 0s)
  • Replaced Project.unique_identifiers with Project.unique_column to signal which Contribution.data field is the Contribution.unique_value.

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

Successfully merging this pull request may close these issues.

1 participant