Skip to content

OMOP Teva - Config

All plots generated by generate_omop_teva are based on the configuration file eds_scikit.plot.default_omop_teva_config.

Table configuration

A table configuration is defined by 3 parameters :

  • category columns list
  • date column
  • category columns mapping

Here is two possible configurations for OMOP condition table :

"condition_occurrence": {
    "category_columns": [
        "visit_occurrence_id",
        "care_site_short_name",
        "condition_source_value",
        "stay_source_value",
        "visit_source_value",
        "admission_reason_source_value",
        "visit_type_source_value",
        "destination_source_value",
        "cdm_source",
    ],
    "date_column": "condition_start_datetime",
    "mapper": {
        "visit_occurrence_id": {"not NaN": ".*"},
        "condition_source_value": {"not NaN": ".*"},
    },
},
"condition_occurrence": {
    # (1) Some columns were removed .
    "category_columns": [
        "visit_occurrence_id",
        "care_site_short_name",
        "condition_source_value",
        "visit_source_value",
        "visit_type_source_value",
        "cdm_source",
    ],
    # (2) Date column remain the same .
    "date_column": "condition_start_datetime",
    "mapper": {
        "visit_occurrence_id": {"not NaN": ".*"},
        # (3) Mapping to diabetic conditions .
        "condition_source_value": {"has_diabete": r"^E10|^E11|^E12|^E13|^E14|O24"},
    },
},

Specifying table configuration

To specify configuration, simply update default_omop_teva_config and pass it to generate_omop_teva.

from eds_scikit.plot import generate_omop_teva
from eds_scikit.io.omop_teva_default_config import default_omop_teva_config

omop_teva_config = default_omop_teva_config

condition_mapper = {
    "condition_source_value": {"has_diabete": r"^E10|^E11|^E12|^E13|^E14|O24"}
}

omop_teva_config["condition_occurrence"]["mapper"].update(condition_mapper)

start_date, end_date = "2021-01-01", "2021-12-01"
generate_omop_teva(data=data,
                   start_date=start_date,
                   end_date=end_date,
                   teva_config=omop_teva_config)

Adding a new table in default_omop_teva_config

Feel free to add any new table in the configuration. Just make sure it has a visit_occurrence_id column.

Back to top