Skip to content

Commit

Permalink
removed doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
frehburg committed Oct 14, 2024
1 parent 53118f3 commit 7f65e2f
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 22 deletions.
80 changes: 66 additions & 14 deletions notebooks/hierarchical_data_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2024-10-14T20:57:38.214684Z",
"start_time": "2024-10-14T20:57:38.210273Z"
"end_time": "2024-10-14T21:21:45.314262Z",
"start_time": "2024-10-14T21:21:45.309299Z"
}
},
"source": [
"from phenopacket_mapper.data_standards import DataField\n",
"from phenopacket_mapper.data_standards import DataModel, ValueSet, DataSection, OrGroup"
],
"outputs": [],
"execution_count": 6
"execution_count": 4
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-10-14T20:57:38.231064Z",
"start_time": "2024-10-14T20:57:38.224448Z"
"end_time": "2024-10-14T21:21:45.340239Z",
"start_time": "2024-10-14T21:21:45.334880Z"
}
},
"cell_type": "code",
Expand Down Expand Up @@ -81,43 +81,95 @@
],
"id": "2e979683ae450d9b",
"outputs": [],
"execution_count": 7
"execution_count": 5
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-10-14T20:57:38.295528Z",
"start_time": "2024-10-14T20:57:38.291141Z"
"end_time": "2024-10-14T21:21:45.352293Z",
"start_time": "2024-10-14T21:21:45.347715Z"
}
},
"cell_type": "code",
"source": "print(genomic_interpretation)",
"source": [
"s = str(genomic_interpretation)\n",
"\n",
"print(s)"
],
"id": "35a697d8b9b8236d",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"DataModel(name=Phenopacket schema Genomic Interpretation\n",
"DataModel(\n",
"\tname: Phenopacket schema Genomic Interpretation\n",
"\tDataField(\n",
"\t\tid: subject_or_biosample_id,\n",
"\t\tname: subject_or_biosample_id,\n",
"\t\tvalue_set: ValueSet(elements=[<class 'str'>], name='', description=''), required: True,\n",
"\t\trequired: True\n",
"\t\tspecification: ValueSet(elements=[<class 'str'>], name='', description='')\n",
"\t\tcardinality: 1..n\n",
"\t)\n",
"\tDataField(\n",
"\t\tid: interpretation_status,\n",
"\t\tname: interpretation_status,\n",
"\t\tvalue_set: ValueSet(elements=['UNKNOWN_STATUS', 'REJECTED', 'CANDIDATE', 'CONTRIBUTORY', 'CAUSATIVE'], name='Interpretation Status Value Set', description=''), required: True,\n",
"\t\trequired: True\n",
"\t\tspecification: ValueSet(elements=['UNKNOWN_STATUS', 'REJECTED', 'CANDIDATE', 'CONTRIBUTORY', 'CAUSATIVE'], name='Interpretation Status Value Set', description='')\n",
"\t\tcardinality: 1..n\n",
"\t)\n",
"\tOrGroup(\n",
"\t\tid: call,\n",
"\t\tname: call,\n",
"\t\trequired: False\n",
"\t\tcardinality: 0..n\n",
"\tDataSection(\n",
"\t\tid: genedescriptor,\n",
"\t\tname: GeneDescriptor,\n",
"\t\trequired: False\n",
"\t\tcardinality: 0..n\n",
"\tDataField(\n",
"\t\tid: value_id,\n",
"\t\tname: value_id,\n",
"\t\trequired: True\n",
"\t\tspecification: ValueSet(elements=[<class 'str'>], name='', description='')\n",
"\t\tcardinality: 1..n\n",
"\t)\n",
"\tDataField(\n",
"\t\tid: symbol,\n",
"\t\tname: symbol,\n",
"\t\trequired: True\n",
"\t\tspecification: ValueSet(elements=[<class 'str'>], name='', description='')\n",
"\t\tcardinality: 1..n\n",
"\t)\n",
"\tDataField(\n",
"\t\tid: description,\n",
"\t\tname: description,\n",
"\t\trequired: False\n",
"\t\tspecification: ValueSet(elements=[<class 'str'>], name='', description='')\n",
"\t\tcardinality: 0..n\n",
"\t)\n",
"\t)\n",
"\t)\n",
"\tDataSection(name='call', id='call', fields=(OrGroup(fields=(DataSection(name='GeneDescriptor', id='genedescriptor', fields=(DataField(name='value_id', specification=ValueSet(elements=[<class 'str'>], name='', description=''), id='value_id', required=True, description='Official identifier of the gene. REQUIRED.', cardinality=Cardinality(min=0, max='n')), DataField(name='symbol', specification=ValueSet(elements=[<class 'str'>], name='', description=''), id='symbol', required=True, description='Official gene symbol. REQUIRED.', cardinality=Cardinality(min=0, max='n')), DataField(name='description', specification=ValueSet(elements=[<class 'str'>], name='', description=''), id='description', required=False, description='A free-text description of the gene', cardinality=Cardinality(min=0, max='n'))), required=False, cardinality=Cardinality(min=0, max='n')),), name='Or Group', id='or_group', description='', required=False, cardinality=Cardinality(min=0, max='n')),), required=False, cardinality=Cardinality(min=0, max='n'))\n",
"---\n",
")\n"
]
}
],
"execution_count": 8
"execution_count": 6
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2024-10-14T21:21:45.378046Z",
"start_time": "2024-10-14T21:21:45.375530Z"
}
},
"cell_type": "code",
"source": "",
"id": "4c78eb05ea58ff6c",
"outputs": [],
"execution_count": null
}
],
"metadata": {
Expand Down
8 changes: 0 additions & 8 deletions src/phenopacket_mapper/data_standards/data_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ class DataField(DataNode):
If the `value_set` is a single type, it can be passed directly as the `value_set` parameter.
e.g.:
>>> DataField(name="Field 1", specification=int)
DataField(name='Field 1', specification=ValueSet(elements=[<class 'int'>], name='', description=''), id='field_1', description='', section='', required=True, ordinal='')
:ivar name: Name of the field
:ivar specification: Value set of the field, if the value set is only one type, can also pass that type directly
:ivar id: The identifier of the field, adhering to the naming rules stated above
Expand Down Expand Up @@ -186,10 +182,6 @@ class DataModel:
be accessed using the `id` as an attribute of the `DataModel` object. E.g.: `data_model.date_of_birth`. This is
useful in the data reading and mapping processes.
>>> data_model = DataModel("Test data model", (DataField(name="Field 1", specification=ValueSet()),))
>>> data_model.field_1
DataField(name='Field 1', specification=ValueSet(elements=[], name='', description=''), id='field_1', description='', section='', required=True, ordinal='')
:ivar data_model_name: Name of the data model
:ivar fields: List of `DataField` objects
:ivar resources: List of `CodeSystem` objects
Expand Down

0 comments on commit 7f65e2f

Please sign in to comment.