-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature/mx-1435 computed provenance fields (#205)
# PR Context - this removes the validator that automatically set identifier and stableTargetId based on the identifierInPrimarySource and hadPrimarySource attributes of an extracted item - instead, this logic is moved to computed fields, which allows correct type signatures for the constructors of extracted items (read: identifier and stableTargetId are not required anymore when constructing an extracted item) - one model validator is still needed though, to allow parsing models from jsons/dicts where an identifier is already present, but this does not interfere with the typing # Migration Guide - mypy ignores for call-arg and arg-type can be removed for extracted model instantiation - calls to `model_construct()` should be avoided, because computed fields still compute even when validation is skipped: this may result in issues when provenance fields are missing from the call to construct - field assignment on extracted models is not supported anymore, try to collect all values before instanciation or create a copy with the updated value # Added - add validator to verify computed fields can be set but not altered to base model - new class hierarchy for identifiers: ExtractedIdentifier and MergedIdentifier # Changes - use json instead of pickle to calculate checksum of models - swapped `set_identifiers` validator for computed fields on each extracted model # Removed - removed custom stringify method on base entities that included the `identifier` field --------- Signed-off-by: Nicolas Drebenstedt <[email protected]> Co-authored-by: rababerladuseladim <[email protected]>
- Loading branch information
1 parent
6fae42c
commit fb5947b
Showing
31 changed files
with
376 additions
and
307 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
from mex.common.models import BaseModel | ||
from mex.common.types import Identifier | ||
from mex.common.types import AnyExtractedIdentifier | ||
|
||
|
||
class BulkInsertResponse(BaseModel): | ||
"""Response body for the bulk ingestion endpoint.""" | ||
|
||
identifiers: list[Identifier] | ||
identifiers: list[AnyExtractedIdentifier] |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.