Skip to content

Commit

Permalink
Merge pull request #153 from BIH-CEI/152-phenopacketmapper-does-not-n…
Browse files Browse the repository at this point in the history
…eed-param-resources-can-take-from-data-model

remove resources from PhenopacketMapper init
  • Loading branch information
frehburg authored Oct 7, 2024
2 parents 2c9c2bf + e1c3d09 commit ab5ff23
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 0 additions & 1 deletion notebooks/erdri_cds_definition_in_code.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,6 @@
"\n",
"mapper = PhenopacketMapper(\n",
" data_model=erdri_cds_data_model,\n",
" resources=resources,\n",
" id=erdri_cds_data_model.pseudonym,\n",
" subject=PhenopacketElement(\n",
" phenopacket_element=phenopackets.Individual,\n",
Expand Down
5 changes: 2 additions & 3 deletions src/phenopacket_mapper/mapping/mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

from phenopackets import Phenopacket

from phenopacket_mapper.data_standards import CodeSystem
from phenopacket_mapper.data_standards.data_model import DataModel, DataSet, DataField
from phenopacket_mapper.mapping import PhenopacketElement, map_single


class PhenopacketMapper:

def __init__(self, data_model: DataModel, resources: List[CodeSystem], **kwargs):
def __init__(self, data_model: DataModel, **kwargs):
"""Create a PhenopacketMapper, this method is equivalent to the constructor of the `Phenopacket` for the mapping
List fields of the `Phenopacket` constructor in the kwargs to map the data to Phenopackets.
Expand All @@ -19,7 +18,7 @@ def __init__(self, data_model: DataModel, resources: List[CodeSystem], **kwargs)
"""
self.data_model = data_model
self.elements: Dict[str, Union[PhenopacketElement, DataField]] = {}
self.resources = resources
self.resources = data_model.resources
for k, v in kwargs.items():
setattr(self, k, v)
self.elements[k] = v
Expand Down

0 comments on commit ab5ff23

Please sign in to comment.