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

Commit

Permalink
add pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-B98 committed Dec 16, 2023
1 parent 4f88e3a commit 0f59f5d
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
27 changes: 27 additions & 0 deletions icu_pipeline/pipeline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from icu_pipeline.concept import AbstractSnomedConcept
from icu_pipeline.mapper.sink import AbstractSinkMapper, MappingFormat
from icu_pipeline.mapper.source import SourceMapperConfiguration, DataSource


class Pipeline:
def __init__(
self,
concepts: list[AbstractSnomedConcept],
sink_mapper: AbstractSinkMapper,
mapping_format: MappingFormat,
source_mapper_configs: dict[DataSource, SourceMapperConfiguration],
) -> None:
self._concepts = concepts
self._sink_mapper = sink_mapper
self._mapping_format = mapping_format
self._source_mapper_configs = source_mapper_configs

def transfrom(self):
for concept in self._concepts:
_concept = concept(
self._sink_mapper,
self._mapping_format,
self._source_mapper_configs,
)

_concept.map()
23 changes: 23 additions & 0 deletions icu_pipeline/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from icu_pipeline.pipeline import (
Pipeline,
DataSource,
MappingFormat,
SourceMapperConfiguration,
)
from icu_pipeline.mapper.sink.file import CSVFileSinkMapper
from icu_pipeline.concept.snomed import SerumCreatinine

configs = {
DataSource.MIMIC: SourceMapperConfiguration(
"postgresql+psycopg://paul@localhost/mimiciv"
),
}

pipeline = Pipeline(
[SerumCreatinine],
CSVFileSinkMapper(),
MappingFormat.FHIR,
configs,
)

pipeline.transfrom()

0 comments on commit 0f59f5d

Please sign in to comment.