Config Reference
omop-config.js is the main pipeline contract for the source-table-driven pipeline used by SOURCE_TYPE=csv and SOURCE_TYPE=mysql.
Top-level structure
{
"before_update": {
"change_column_types": [],
"add_indexes": [],
"add_lookup_tables": {}
},
"after_update": {
"add_indexes": [],
"create_columns": [],
"translate_concepts": []
}
}
before_update
These operations run before calculated-table creation/translations.
change_column_types
Used to normalize imported source table column types before later processing.
Common fields:
destination_schemadestination_tabledestination_columndestination_column_type
Example:
{
"destination_schema": "omop",
"destination_table": "DIAGNOSIS_BRCAOVCA_HOSP_VW",
"destination_column": "CONDITION_START_DATE",
"destination_column_type": "DATE"
}
add_indexes
Adds pre-update indexes to imported source tables to speed downstream operations.
Common fields:
destination_schemadestination_tableordestination_tablesdestination_columnkey_length
Notes:
- In SQLite, prefix lengths from MySQL-style configs may be ignored or adapted.
- Some entries use
destination_tableswith a comma-separated list.
add_lookup_tables
Describes lookup tables loaded from lookup_tables/.
Common fields:
lookup_schemalookup_tables_dirsubdirectories
Each subdirectory entry describes one lookup table family, including column metadata.
The current lookup family is ICD_CODES.
after_update
These operations run after source ingestion and lookup setup.
add_indexes
Adds indexes to downstream calculated tables such as:
CALCULATED_PT_ICD_CODESCALCULATED_DX_DATA
create_columns
This is a mixed section that drives:
- explicit column creation for calculated tables
- insert/update logic from source tables into calculated tables
- specialized operations like ICD code extraction
There are two broad entry shapes.
1. Declarative column definitions
Example:
{
"destination_schema": "lookup",
"destination_table": "CALCULATED_DX_DATA",
"destination_column": "AGE_AT_DX",
"destination_column_type": "INT",
"destination_column_default": "NULL",
"destination_column_nullable": "YES"
}
2. Operation blocks
Example ICD operation:
{
"operation": {
"destination_schema": "lookup",
"source_schema": "omop",
"type": "ICD",
"tables": "DIAGNOSIS_BRCAOVCA_HOSP_VW,DIAGNOSIS_BRCAOVCA_OUTPT_VW,...",
"code_column": "CONDITION_SOURCE_VALUE",
"person_id_column": "PERSON_ID",
"date_column": "CONDITION_START_DATE",
"destination_table": "CALCULATED_PT_ICD_CODES"
}
}
This is where much of the project-specific behavior lives.
Insert/update mappings
Some entries also describe how to move data from source tables into calculated tables.
Example:
{
"destination_schema": "lookup",
"destination_table": "CALCULATED_PATIENT_DATA",
"destination_column": "PERSON_ID",
"source_schema": "omop",
"source_tables": "DEMOGRAPHIC_BRCAOVCA_VW,DEMOGRAPHIC_MELANOMA_VW",
"source_columns": "PERSON_ID,PERSON_ID",
"join_on": "PERSON_ID",
"verb": "INSERT"
}
translate_concepts
This section maps source concept IDs to human-usable demographic values in CALCULATED_PATIENT_DATA.
Current concepts include:
GENDERRACEETHNICITY
Common fields:
source_schemasource_tablessource_columndestination_schemadestination_tabledestination_columnconcept
Example:
{
"source_schema": "omop",
"source_tables": "DEMOGRAPHIC_BRCAOVCA_VW,DEMOGRAPHIC_MELANOMA_VW",
"destination_schema": "lookup",
"destination_table": "CALCULATED_PATIENT_DATA",
"destination_column": "GENDER",
"source_column": "GENDER_CONCEPT_ID",
"concept": "GENDER"
}
Important caveats
omop-config.jsprimarily describes thecsv/mysqlpath, not JSON mode.- Schema names like
omopandlookupare logical grouping labels retained from earlier implementations;omopis not the public name of the database. - Some fields are MySQL-shaped even though the current destination is SQLite.
- If you are debugging pipeline behavior, trace
run.py->source/config_processor.py->db/omop/*helpers.
How to work with this file safely
When revisiting the project:
- Start with a single section, not the whole file.
- Map each section to the function that consumes it.
- Prefer additive edits with tests over broad refactors.
- Re-run
uv run python -m unittest discover -s testsafter any config-driven code change.