Skip to content
This repository has been archived by the owner on Jan 26, 2025. It is now read-only.

Commit

Permalink
add data concept
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-B98 committed Dec 16, 2023
1 parent cdeaaca commit 4f88e3a
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
39 changes: 39 additions & 0 deletions icu_pipeline/concept/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from abc import ABC

from icu_pipeline.mapper.source import AbstractSourceMapper, DataSource
from icu_pipeline.mapper.schema.fhir import AbstractFHIRSinkSchema
from icu_pipeline.mapper.schema.ohdsi import AbstractOHDSISinkSchema
from icu_pipeline.mapper.sink import AbstractSinkMapper, MappingFormat
from icu_pipeline.mapper.source import SourceMapperConfiguration, DataSource


class AbstractSnomedConcept(ABC):
SNOMED_ID: str
FHIR_SCHEMA: AbstractFHIRSinkSchema
OHDSI_SCHEMA: AbstractOHDSISinkSchema
MAPPER: dict[DataSource, AbstractSourceMapper]

def __init__(
self,
sink_mapper: AbstractSinkMapper,
mapping_format: MappingFormat,
source_mapper_configs: dict[DataSource, SourceMapperConfiguration],
) -> None:
super().__init__()

self._sink_mapper = sink_mapper
self._mapping_format = mapping_format
self._source_mapper_configs = source_mapper_configs

def map(self):
for source, source_mapper in self.MAPPER.items():
mapper = source_mapper(
self.SNOMED_ID,
self.FHIR_SCHEMA,
self.OHDSI_SCHEMA,
self._source_mapper_configs[source],
self._sink_mapper,
self._mapping_format,
)

mapper.map()
12 changes: 12 additions & 0 deletions icu_pipeline/concept/snomed.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from icu_pipeline.concept import AbstractSnomedConcept
from icu_pipeline.mapper.schema.fhir import FHIRObservation
from icu_pipeline.mapper.schema.ohdsi import AbstractOHDSISinkSchema
from icu_pipeline.mapper.source import DataSource
from icu_pipeline.mapper.source.mimic.labevents import MimicSerumCreatinineMapper


class SerumCreatinine(AbstractSnomedConcept):
SNOMED_ID = "113075003"
FHIR_SCHEMA = FHIRObservation
OHDSI_SCHEMA = AbstractOHDSISinkSchema
MAPPER = {DataSource.MIMIC: MimicSerumCreatinineMapper}

0 comments on commit 4f88e3a

Please sign in to comment.