cdm_data_loaders.pipelines.xsv.pipeline ¶
XSV (CSV/TSV) ingestion pipeline for the KBase CTS.
Cleans and validates each XSV file against settings.schema_file using qsv (see
readers.jsonschema_xsv.xsv_validator), then loads each valid row, cast to the types declared
in the schema, into table_name. Files that fail cleaning/validation are routed to
_rejected, one row per recorded error; qsv's own per-row validation diagnostics are
left in its scratch output directory and are not currently surfaced as rows.
XsvWorkPaths
dataclass
¶
Scratch resources shared across all files processed in one pipeline run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qsv_cmd
|
str
|
path to the qsv binary |
required |
header_file_path
|
Path
|
header file used when an input file is missing a header row |
required |
tmp_dir
|
Path
|
scratch directory for intermediate cleaning/validation files |
required |
qsv_output_dir
|
Path
|
directory qsv writes failure diagnostics to |
required |
validated_dir
|
Path
|
directory the final cleaned, validated file is written to |
required |
download_dir
|
Path
|
directory non-local input files are downloaded to before validation (qsv needs local files) |
required |
Source code in src/cdm_data_loaders/pipelines/xsv/pipeline.py
run_xsv_pipeline ¶
Run the XSV ingestion pipeline on matching files in settings.input_dir.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings
|
XsvIngestSettings
|
pipeline configuration |
required |
Returns:
| Type | Description |
|---|---|
LoadInfo | None
|
load information for the pipeline |