Skip to content

Commit

Permalink
add doc strings for step configs
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-B98 committed Jan 29, 2025
1 parent f2ddf37 commit 6323bd4
Show file tree
Hide file tree
Showing 7 changed files with 190 additions and 0 deletions.
44 changes: 44 additions & 0 deletions open_icu/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"""
OpenICU: A Python package for analysing time series data in the ICU.
This package provides a set of tools for analysing time series data in the ICU.
It is designed to be modular and extensible, allowing users to easily add new data
sources, filters, and analyses.
Modules:
-
Usage:
```python
```
Author:
- Paul Brauckmann
- Christian Porschen
License:
```
MIT License
Copyright (c) 2023 AIDH MS
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
"""
17 changes: 17 additions & 0 deletions open_icu/types/conf/cohort.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@


class CohortFilterConfig(BaseModel):
"""
A class representing the cohort filter step configuration.
Attributes
----------
name : str
The name of the cohort filter step.
description : str
The description of the cohort filter step.
concepts : list[str]
A list of concepts used in the filter.
filter : str
A python dotter path to the filter class.
params : dict[str, Any]
A dictionary of parameters that will passed to the filter class.
"""

name: str
description: str
concepts: list[str]
Expand Down
54 changes: 54 additions & 0 deletions open_icu/types/conf/concept.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,63 @@


class ConceptLimits(BaseModel):
"""
A class representing the limits of a concept.
Attributes
----------
upper : str
The upper limit of the concept.
lower : str
The lower limit of the concept
"""

upper: str
lower: str


class ConceptSource(BaseModel):
"""
A class representing the source of a concept.
Attributes
----------
source : str
The source of the concept.
extractor : str
A python dotter path to the extractor class.
unit : dict[str, str]
A dictionary mapping between values and units used in the source.
params : dict[str, Any]
A dictionary of parameters that will passed to the extractor class.
"""

source: str
extractor: str
unit: dict[str, str]
params: dict[str, Any]


class ConceptConfig(BaseModel):
"""
A class representing the concept configuration.
Attributes
----------
name : str
The name of the concept.
description : str
The description of the concept.
identifiers : dict[str, str]
A dictionary of identifiers used in the concept.
unit : dict[str, str]
A dictionary mapping between values and units used in the concept.
limits : ConceptLimits
The limits of the concept.
sources : list[ConceptSource]
A list of sources used in the concept.
"""

name: str
description: str
identifiers: dict[str, str]
Expand All @@ -24,6 +69,15 @@ class ConceptConfig(BaseModel):
sources: list[ConceptSource]

def model_post_init(self, __context: Any) -> None:
"""
The post init method is used to set the open_icu identifier to the name of the concept.
Parameters
----------
__context : Any
The context of the model.
"""

super().model_post_init(__context)

self.identifiers["open_icu"] = self.name
17 changes: 17 additions & 0 deletions open_icu/types/conf/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@


class PreprocessorConfig(BaseModel):
"""
A class representing the preprocessor step configuration.
Attributes
----------
name : str
The name of the preprocessor step.
description : str
The description of the preprocessor step.
concepts : list[str]
A list of concepts used in the preprocessor.
preprocessor : str
A python dotter path to the preprocessor class.
params : dict[str, Any]
A dictionary of parameters that will passed to the preprocessor class.
"""

name: str
description: str
concepts: list[str]
Expand Down
15 changes: 15 additions & 0 deletions open_icu/types/conf/sink.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@


class SinkConfig(BaseModel):
"""
A class representing the sink configuration.
Attributes
----------
name : str
The name of the sink.
description : str
The description of the sink.
sink : str
A python dotter path to the sink class.
params : dict[str, Any]
A dictionary of parameters that will passed to the sink class
"""

name: str
description: str
sink: str
Expand Down
26 changes: 26 additions & 0 deletions open_icu/types/conf/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,38 @@


class SampleConfig(BaseModel):
"""
A class representing the sample configuration.
Attributes
----------
samples : list[str]
A list of samples.
sampler : str
A python dotter path to the sampler class.
params : dict[str, str]
A dictionary of parameters that will passed to the sampler class.
"""

samples: list[str] = []
sampler: str
params: dict[str, str]


class SourceConfig(BaseModel):
"""
A class representing the source configuration.
Attributes
----------
name : str
The name of the source.
connection_uri : str
The connection uri of the source.
sample : SampleConfig
The sample configuration.
"""

name: str
connection_uri: str
sample: SampleConfig
17 changes: 17 additions & 0 deletions open_icu/types/conf/unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@


class UnitConverterConfig(BaseModel):
"""
A class representing the unit converter configuration.
Attributes
----------
name : str
The name of the unit converter.
description : str
The description of the unit converter.
unitconverter : str
A python dotter path to the unit converter class.
base_unit : str
The base unit of the unit converter.
params : dict[str, Any]
A dictionary of parameters that will passed to the unit converter class.
"""

name: str
description: str
unitconverter: str
Expand Down

0 comments on commit 6323bd4

Please sign in to comment.