Ingestion Services
Generic Ingestion
pluginlake.api.services.ingestion
Ingestion service — validates, stores, and triggers processing of uploaded files.
Orchestrates the flow from file upload to raw storage layer and Dagster job triggering, with proper validation and error handling.
IngestionError
IngestionResult
dataclass
Outcome of a file ingestion operation.
Attributes:
| Name | Type | Description |
|---|---|---|
file_id |
str
|
Unique identifier assigned to the uploaded file. |
filename |
str
|
Original filename of the upload. |
dataset |
str
|
Target dataset name. |
file_path |
str
|
Absolute path where the file was stored. |
size_bytes |
int
|
Size of the stored file in bytes. |
dagster_run_id |
str | None
|
Dagster run ID if a job was triggered, else None. |
status |
str
|
Overall status of the ingestion. |
message |
str
|
Human-readable status message. |
Source code in src/pluginlake/api/services/ingestion.py
IngestionService
Handles file upload validation, storage, and Dagster triggering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
storage_manager
|
StorageLayerManager | None
|
Manages the medallion storage layers. |
None
|
dagster_client
|
DagsterClient | None
|
Client for triggering Dagster jobs. |
None
|
settings
|
IngestionSettings | None
|
Ingestion-specific configuration. |
None
|
Source code in src/pluginlake/api/services/ingestion.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
__init__(storage_manager=None, dagster_client=None, settings=None, ingestion_log_dir=None)
Initialise the service with storage, Dagster, and settings.
Source code in src/pluginlake/api/services/ingestion.py
ingest_file(file, dataset)
async
Validate, store, and trigger processing for an uploaded file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file
|
UploadFile
|
The uploaded file from the HTTP request. |
required |
dataset
|
str
|
Target dataset name for organising the file. |
required |
Returns:
| Type | Description |
|---|---|
IngestionResult
|
An IngestionResult describing the outcome. |
Raises:
| Type | Description |
|---|---|
IngestionError
|
If validation fails (extension, size). |
Source code in src/pluginlake/api/services/ingestion.py
OMOP CSV Ingestion
pluginlake.api.services.omop_ingestion
OMOP ingestion service — CSV upload path.
OmopCsvIngestionService
Bases: IngestionService
Ingestion service for OMOP CSV uploads.
Stores the uploaded CSV to OMOP_RAW_DATA_DIR/{dataset}.csv and
triggers omop_ingest_job for the selected asset via Dagster.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dagster_client
|
DagsterClient
|
Client for triggering Dagster jobs. |
required |
omop_settings
|
OMOPSettings
|
OMOP-specific configuration (provides raw_data_dir). |
required |
settings
|
IngestionSettings | None
|
Ingestion-specific configuration (file size limits, etc.). |
None
|
Source code in src/pluginlake/api/services/omop_ingestion.py
__init__(dagster_client, omop_settings, settings=None, ingestion_log_dir=None)
Initialise with a Dagster client, OMOP settings, and optional ingestion settings.
Source code in src/pluginlake/api/services/omop_ingestion.py
FHIR NDJSON Ingestion
pluginlake.api.services.fhir_ingestion
FHIR ingestion service — NDJSON upload path.
FhirNdjsonIngestionService
Bases: IngestionService
Ingestion service for FHIR NDJSON uploads.
Appends the uploaded NDJSON to FHIR_RAW_DATA_DIR/{dataset}.ndjson and
triggers fhir_ingest_job for the selected asset via Dagster.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dagster_client
|
DagsterClient
|
Client for triggering Dagster jobs. |
required |
fhir_settings
|
FHIRSettings
|
FHIR-specific configuration (provides raw_data_dir). |
required |
settings
|
IngestionSettings | None
|
Ingestion-specific configuration (file size limits, etc.). |
None
|
Source code in src/pluginlake/api/services/fhir_ingestion.py
__init__(dagster_client, fhir_settings, settings=None, ingestion_log_dir=None)
Initialise with a Dagster client, FHIR settings, and optional ingestion settings.