FHIR
Translator Registry
pluginlake.fhir.translator_registry
FHIR-to-OMOP translator registry.
Maps FHIR R4 resource types to their plugin-rosetta translators and the corresponding OMOP CDM target tables.
get_translator(resource_type)
Return a translator instance for the given FHIR resource type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resource_type
|
str
|
Lowercase FHIR resource type (e.g. |
required |
Returns:
| Type | Description |
|---|---|
FhirToOmopTranslator
|
An instantiated translator. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the resource type is not supported. |
Source code in src/pluginlake/fhir/translator_registry.py
Loader
pluginlake.fhir.loader
FHIR NDJSON loading functions.
load_fhir_ndjson(file_path)
Load a FHIR NDJSON file into a single-column DataFrame.
Each line is stored as a JSON string in the json_data column.
Empty lines and lines that fail to parse are skipped.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
Path
|
Path to the NDJSON file. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
Polars DataFrame with a single |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the file does not exist. |
Source code in src/pluginlake/fhir/loader.py
load_fhir_dataset(data_dir=None, resource_types=None)
Load multiple FHIR NDJSON files from a directory.
Each file is expected to be named {resource_type}.ndjson.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_dir
|
Path | None
|
Directory containing NDJSON files. Uses config default if None. |
None
|
resource_types
|
list[str] | None
|
List of resource types to load. Loads all NDJSON files if None. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, DataFrame]
|
Dictionary mapping resource type names to DataFrames. |
Source code in src/pluginlake/fhir/loader.py
Configuration
pluginlake.fhir.config
FHIR module configuration.
FHIRSettings
Bases: Settings
FHIR-specific configuration.
Configuration for FHIR NDJSON ingestion and FHIR-to-OMOP translation. All paths are relative to the project root unless absolute.