metakb.repository.neo4j_models#
Define data structures for loading objects into DB.
A few basic motifs are important here –
Node classes MUST define a from_gks classmethod, which accepts the corresponding GKS class, and creates an instance of Self, as well as a to_gks instance method, which returns the same GKS class
In general, class property names for properties consisting of other nodes should reflect the relationship name used on the graph. This gets tricky in the context of array-like relationships, since the property name should be plural but the graph relationship name is usually singular. Not sure what the best solution is there.
The cypher queries employ ON CREATE SET to assign properties, which doesn’t allow for null values. That’s why a lot of values default to empty arrays or strings. These should be returned as None in the to_gks() method.
In general, nodes should have some deterministic ID based on their values, if an ID isn’t already given. This is to ensure that repeat nodes aren’t inadvertently added. Note that some nodes, like assertions and evidence lines, might need to be updated in-place as evidence is aggregated together – DO NOT generate IDs based on those values which are subject to change
- class metakb.repository.neo4j_models.BaseNode(**data)[source]#
Abstract base node.
- class metakb.repository.neo4j_models.CategoricalVariantNode(**data)[source]#
Node model for Categorical Variant.
- class metakb.repository.neo4j_models.ClassificationNode(**data)[source]#
Node model for a classification.
- class metakb.repository.neo4j_models.DefiningAlleleConstraintNode(**data)[source]#
Node model for Cat-VRS DefiningAlleleConstraint
- classmethod from_gks(constraint, constraint_id)[source]#
Create new node instance from a Cat-VRS DefiningAlleleConstraint.
- Parameters:
constraint (
DefiningAlleleConstraint) – original constraint objectconstraint_id (
str) – database identifier. Our working convention is to incorporate the container categorical variant’s ID as part of this, which means we need to get this arg separately
- Return type:
Self- Returns:
node instance
- class metakb.repository.neo4j_models.DiagnosticStatementNode(**data)[source]#
Node model for an evidence statement about a diagnostic proposition
- class metakb.repository.neo4j_models.DiseaseNode(**data)[source]#
Node model for an individual Disease.
- class metakb.repository.neo4j_models.DocumentNode(**data)[source]#
Node model for Document.
- classmethod from_gks(document)[source]#
Create Node instance from GKS class. :rtype:
SelfHere, we define a policy about how to make document IDs in cases where the CDM doesn’t provide them (i.e. documents supporting source methods).
- Raises:
ValueError – if unable to employ existing ID construction scheme to fill in ID
- class metakb.repository.neo4j_models.EvidenceLineNode(**data)[source]#
Node model for an Evidence Line object.
- classmethod from_gks(evidence_line)[source]#
Construct node representation of Evidence Line object
- Return type:
Self
- class metakb.repository.neo4j_models.FeatureContextConstraintNode(**data)[source]#
Node model for Cat-VRS FeatureContextConstraint
- classmethod from_gks(constraint, constraint_id)[source]#
Create new node instance from a Cat-VRS FeatureContextConstraint
- Parameters:
constraint (
FeatureContextConstraint) – original constraint objectconstraint_id (
str) – database identifier. Our working convention is to incorporate the container categorical variant’s ID as part of this, which means we need to get this arg separately
- Return type:
Self- Returns:
node instance
- class metakb.repository.neo4j_models.LiteralSequenceExpressionNode(**data)[source]#
Node model for LiteralSequenceExpression
- class metakb.repository.neo4j_models.PrognosticStatementNode(**data)[source]#
Node model for an evidence statement about a prognostic proposition
- class metakb.repository.neo4j_models.ReferenceLengthExpressionNode(**data)[source]#
Node model for ReferenceLengthExpression
- class metakb.repository.neo4j_models.SequenceLocationNode(**data)[source]#
Node model for SequenceLocation
- class metakb.repository.neo4j_models.SequenceReferenceNode(**data)[source]#
Node model for a sequence reference
- class metakb.repository.neo4j_models.StatementNodeBase(**data)[source]#
Base properties for a Statement node.
Use as a mixin for a flattened statement/proposition node.
Should be able to support both meta-level assertions about other statements, or individual statements themselves
- class metakb.repository.neo4j_models.TherapeuticResponseStatementNode(**data)[source]#
Node model for an evidence statement about a therapeutic response proposition