Skip to content

Commit

Permalink
Merge pull request #151 from BIH-CEI/150-bug-tuple-list-fields
Browse files Browse the repository at this point in the history
150 bug tuple list fields
  • Loading branch information
frehburg authored Oct 7, 2024
2 parents 3cfe2a1 + 677ce8b commit 2c9c2bf
Show file tree
Hide file tree
Showing 21 changed files with 768 additions and 398 deletions.
971 changes: 714 additions & 257 deletions notebooks/erdri_cds_definition_in_code.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions res/test_data/erdri/output/patient0.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
{
"diagnosis": {
"disease": {
"id": "ORPHA:206638"
"id": "ORPHA:206638 ()"
}
}
}
],
"diseases": [
{
"term": {
"id": "ORPHA:206638"
"id": "ORPHA:206638 ()"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions res/test_data/erdri/output/patient1.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
{
"diagnosis": {
"disease": {
"id": "ICD9:781"
"id": "ICD9:781 ()"
}
}
}
],
"diseases": [
{
"term": {
"id": "ICD9:781"
"id": "ICD9:781 ()"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions res/test_data/erdri/output/patient2.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
{
"diagnosis": {
"disease": {
"id": "ORPHA:206638"
"id": "ORPHA:206638 ()"
}
}
}
],
"diseases": [
{
"term": {
"id": "ORPHA:206638"
"id": "ORPHA:206638 ()"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions res/test_data/erdri/output/patient3.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
{
"diagnosis": {
"disease": {
"id": "ORPHA:206638"
"id": "ORPHA:206638 ()"
}
}
}
],
"diseases": [
{
"term": {
"id": "ORPHA:206638"
"id": "ORPHA:206638 ()"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions res/test_data/erdri/output/patient4.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
{
"diagnosis": {
"disease": {
"id": "ORPHA:206638"
"id": "ORPHA:206638 ()"
}
}
}
],
"diseases": [
{
"term": {
"id": "ORPHA:206638"
"id": "ORPHA:206638 ()"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions res/test_data/erdri/output/patient5.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
{
"diagnosis": {
"disease": {
"id": "ORPHA:206638"
"id": "ORPHA:206638 ()"
}
}
}
],
"diseases": [
{
"term": {
"id": "ORPHA:206638"
"id": "ORPHA:206638 ()"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions res/test_data/erdri/output/patient6.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
{
"diagnosis": {
"disease": {
"id": "ORPHA:206638"
"id": "ORPHA:206638 ()"
}
}
}
],
"diseases": [
{
"term": {
"id": "ORPHA:206638"
"id": "ORPHA:206638 ()"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions res/test_data/erdri/output/patient7.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
{
"diagnosis": {
"disease": {
"id": "ORPHA:206638"
"id": "ORPHA:206638 ()"
}
}
}
],
"diseases": [
{
"term": {
"id": "ORPHA:206638"
"id": "ORPHA:206638 ()"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions res/test_data/erdri/output/patient8.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
{
"diagnosis": {
"disease": {
"id": "ORPHA:206638"
"id": "ORPHA:206638 ()"
}
}
}
],
"diseases": [
{
"term": {
"id": "ORPHA:206638"
"id": "ORPHA:206638 ()"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion src/phenopacket_mapper/data_standards/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

__all__ = [
"Coding", "CodeableConcept",
"DataModel", "DataField", "DataModelInstance", "DataFieldValue",
"DataModel", "DataField", "DataModelInstance", "DataFieldValue", "DataSet",
"data_models",
"CodeSystem",
"SNOMED_CT", "HPO", "MONDO", "OMIM", "ORDO", "LOINC",
Expand Down
16 changes: 8 additions & 8 deletions src/phenopacket_mapper/data_standards/code_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ def __contains__(self, item):
GENO = CodeSystem(
name='GENO: The Genotype Ontology',
namespace_prefix='GENO',
url='http://www.genoontology.org/'
url='https://www.genoontology.org/'
)

SO = CodeSystem(
name='Sequence types and features ontology',
namespace_prefix='SO',
url='http://www.sequenceontology.org/'
url='https://www.sequenceontology.org/'
)

ICD9 = CodeSystem(
Expand Down Expand Up @@ -128,12 +128,12 @@ def __contains__(self, item):
MONDO = CodeSystem(
name="Monarch Disease Ontology",
namespace_prefix="MONDO",
url="http://purl.obolibrary.org/obo/mondo.owl"
url="https://purl.obolibrary.org/obo/mondo.owl"
)
ORDO = CodeSystem(
name="Orphanet Rare Disease Ontology",
namespace_prefix="ORPHA",
url="http://www.orpha.net/",
url="https://www.orpha.net/",
synonyms=['ORDO']
)
OMIM = CodeSystem(
Expand All @@ -149,7 +149,7 @@ def __contains__(self, item):
HGVS = CodeSystem(
name="Human Genome Variation Society",
namespace_prefix="HGVS",
url="http://varnomen.hgvs.org/"
url="https://varnomen.hgvs.org/"
)
HGNC = CodeSystem(
name="HUGO Gene Nomenclature Committee",
Expand All @@ -159,14 +159,14 @@ def __contains__(self, item):
HPO = CodeSystem(
name="Human Phenotype Ontology",
namespace_prefix="HP",
url="http://www.human-phenotype-ontology.org",
iri_prefix="http://purl.obolibrary.org/obo/HP_",
url="https://www.human-phenotype-ontology.org",
iri_prefix="https://purl.obolibrary.org/obo/HP_",
synonyms=["HPO"]
)
UO = CodeSystem(
name="Units of Measurement Ontology",
namespace_prefix="UO",
url="http://www.ontobee.org/ontology/UO"
url="https://www.ontobee.org/ontology/UO"
)
NCIT = CodeSystem(
name = "NCI Thesaurus OBO Edition",
Expand Down
9 changes: 5 additions & 4 deletions src/phenopacket_mapper/data_standards/data_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class DataModel:
:ivar resources: List of `CodeSystem` objects
"""
data_model_name: str = field()
fields: Tuple[DataField] = field()
fields: Tuple[DataField, ...] = field()
resources: List[CodeSystem] = field(default_factory=list)

def __post_init__(self):
Expand All @@ -166,8 +166,8 @@ def __getattr__(self, var_name: str) -> DataField:

def __str__(self):
ret = f"DataModel(name={self.data_model_name}\n"
for field in self.fields:
ret += f"\t{str(field)}\n"
for _field in self.fields:
ret += f"\t{str(_field)}\n"
ret += "---\n"
for res in self.resources:
ret += f"\t{str(res)}\n"
Expand Down Expand Up @@ -399,11 +399,12 @@ def data_frame(self) -> pd.DataFrame:
for instance in self.data:
for f in self.data_model.fields:
field_id = f.id
value: Any = None
try:
dfv: DataFieldValue = getattr(instance, field_id)
value = dfv.value
except AttributeError:
value = None
pass
finally:
data_dict[field_id].append(value)
return pd.DataFrame(data_dict, columns=column_names)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Selection of rare disease specific data models"""
from .rarelink_datamodel import RARELINK_DATA_MODEL
from .erdri_cds import ERDRI_CDS
from phenopacket_mapper.utils.parsing.parse_data_type import parse_data_type

__all__ = ["RARELINK_DATA_MODEL", "ERDRI_CDS", "parse_data_type"]
__all__ = ["ERDRI_CDS", "parse_data_type"]
16 changes: 8 additions & 8 deletions src/phenopacket_mapper/data_standards/data_models/erdri_cds.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from phenopacket_mapper.data_standards.data_model import DataModel, DataField

ERDRI_CDS = DataModel(
data_model_name="ERDRI_CDS",
resources=[],
fields=[
# TODO: Implement fields
]
)
ERDRI_CDS = None
# ERDRI_CDS = DataModel(
# data_model_name="ERDRI_CDS",
# resources=[],
# fields=[
# # TODO: Implement fields
# ]
# )

This file was deleted.

Loading

0 comments on commit 2c9c2bf

Please sign in to comment.