Contribution identifiers - #2116
Draft
bfoley12 wants to merge 10 commits into
Draft
Conversation
…in the case that {project, material_id, chemical_system_id, formula} is not enough. Also added condition_key - logic implemented in another branch
…a < material_id - ie. a formula must be specified if a material_id is).
…e an update to the identity fields collides with a preexisting identity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Modified how Contributions are identified.
Previously:
{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'sProjecthadProject.unique_identifiers == TrueProject.unique_identifiers == False, the only way to get a uniqueContributionwas by querying theContribution._id, which is an ObjectId - very cumbersomeThis branch:
Contribution.identifier{project, material_id, chemical_system_id, formula, unique_value?, condition_key?}:Contribution.project: unchanged, the project the contribution belongs toContribution.material_id: themp-idof the material being studiedContribution.chemical_system_id: the chemical system stringContribution.formula: unchanged, the formula of the systemContribution.unique_value: optional, but required in Contributions that are not uniquely identified by the previous fields. This is specified by the user as aContribution.datafield, then extracted by the server into unique_value, so we can define a MongoDB index on itContribution.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.material_id: must start with "mp-" and be followed by numbers, with leading zeros being trimmedchemical_system_id: hyphen-delimited list of valid Elementsformula: NFKC normalized string of valid elements and numbers (trimming leading 0s)Project.unique_identifierswithProject.unique_columnto signal whichContribution.data fieldis theContribution.unique_value.