Documentation / Pipelines

OMOP CDM

Load one or more data sources into an OMOP CDM 5.4 with standardized codes.

The suite can write the data of one or more data sources into an OMOP CDM 5.4. It converts the FHIR® resources of the raw vaults with set-based SQL in the database, standardizes every code to an OMOP concept, and keeps the CDM up to date with an internal pipeline per source.

Set up

  1. Administration > Settings > OMOP CDM > Create OMOP CDM… Choose the data source whose database stores the CDM, and the data sources that feed it. In this version they must all be in the same database. The CDM is a new schema omop_<name>.
  2. Load the vocabulary. Download the vocabularies you need from athena.ohdsi.org (free account; some vocabularies have their own licence terms that you accept there), unzip them into a folder on the server, and enter the folder. It needs CONCEPT, VOCABULARY and CONCEPT_RELATIONSHIP; DOMAIN, CONCEPT_CLASS and RELATIONSHIP are loaded when present. Only the Maps to relationships are loaded by default, which is all the standardization needs. The vocabulary is stored once per database (schema omop_vocab).
  3. Pipelines > Internal: switch the Load OMOP CDM pipeline of each source on. The first run loads everything; after that only new and changed records.

How codes are standardized

StepRule
VocabularyThe FHIR code system URI is mapped to an OMOP vocabulary (SNOMED, LOINC®, RxNorm, CVX, ICD10, ICD10CM, NDC, UCUM, ATC, CPT4, HCPCS and more; the list can be extended through the API, PUT /admin/api/omop/<id>/systems).
Standard conceptThe code is looked up in that vocabulary. A standard concept is used as it is; a non-standard concept goes through its Maps to relationship.
Several codingsA CodeableConcept may carry several codings: the first one that maps to a standard concept is used, otherwise the first one.
TableThe domain of the standard concept decides the table: a Condition resource with a Procedure concept becomes a procedure_occurrence. Without a concept the resource type decides (Condition: condition, Procedure: procedure, MedicationRequest and Immunization: drug, Observation with a number: measurement, otherwise observation). Device, Specimen, Visit and Episode concepts go to device_exposure, specimen, visit_occurrence and episode. A change of mapping moves the row.
Units and valuesUnits are mapped through UCUM; value concepts of coded values the same way.
Not mappedThe row is written with concept 0, the code as source value and the source concept. It appears in the unmapped codes worklist, most used first. Map it by hand with a concept search; the rows that carry it are written again at the next run. A manual mapping stays when the vocabulary is replaced.

What is converted

FHIROMOP
Organizationcare_site (+ location)
Practitionerprovider
Patientperson (gender, birth date, US Core race and ethnicity, location, general practitioner, managing organization) and death
Encountervisit_occurrence (class: IMP, ACUTE, NONAC inpatient; AMB, SS, FLD outpatient; EMER emergency; HH home; VR telehealth)
Condition, Procedure, Immunization, MedicationRequest, MedicationStatement, AllergyIntolerance, Observation (and each Observation.component)condition_occurrence, procedure_occurrence, drug_exposure, measurement, observation by the domain of the concept. An allergy is written to observation with the substance as concept.
Device, DeviceUseStatement (R5: DeviceUsage)device_exposure: the device type is the concept, the UDI and serial number are kept; a Device needs a patient and a manufactureDate
Specimenspecimen: type, body site (anatomic site concept), quantity and unit, accession number
DocumentReferencenote: the type is the note class, a text attachment is decoded into the note text (other attachments keep the title or description), language and encounter
Coveragepayer_plan_period: payer (type, for example a SOPT code), plan, policy holder, period (open end becomes 2099-12-31)
ExplanationOfBenefit (or Claim when there is no EOB)cost: total charge, amount paid by the payer, currency, linked to the visit of its first item
Route of a medication, body site of a specimenroute_concept_id and anatomic_site_concept_id
(derived)observation_period (first to last event of each person) and cdm_source

Keeping it correct

Records are compared by their hashdiff: new and changed records are written, records that were deleted or disappeared from the raw vault are removed, and deleting a patient removes the patient's rows. The OMOP id of a record never changes (table omop_key_map). Records without a patient in the CDM, without a date or without a code cannot be written; they are counted and tried again at every run.

Careful

Not in this version: visit_detail, condition_era, drug_era, dose_era, fact_relationship, note_nlp and episode_event (the episode table is filled only from concepts of the Episode domain); a claim is only used when its resource type is the only cost source (with an ExplanationOfBenefit present the Claim is skipped, otherwise the money would be counted twice); a cost needs a visit; the MDM golden vault as a source (the raw vaults are used, so the same person in two sources is two persons); a CDM in another database than its sources. A person without any event gets no observation_period. Check the result with the OHDSI tools (Data Quality Dashboard, Achilles) before you use it for studies.

In the background

Everything runs in the database in batches of 20,000 records per resource type (OMOP_BATCH). Each batch is one transaction. The ETL reads resource_json with paths that work for R4, R4B and R5 (for example Encounter.class and actualPeriod, MedicationRequest.medication.concept).