Provenance¶
See Export to d3rlpy for writing a sidecar during export.
- class ehr2rl.provenance.DatasetProvenance(bigquery_job_ids, query_hash, itemid_map_version, feature_preset, extraction_timestamp, mimic_version)¶
Metadata needed to reproduce a BigQuery-backed dataset extraction.
- Parameters:
bigquery_job_ids (
tuple[str,...]) – IDs of the BigQuery jobs that ran. Cached queries have none.query_hash (
str) – Cache keys of every query in the load, joined with":".itemid_map_version (
str) – Version of the itemid map used.feature_preset (
str) – Name of the feature preset used.extraction_timestamp (
str) – UTC time of the extraction, in ISO 8601 format.mimic_version (
str) – MIMIC-IV version, such as"3.1".
- ehr2rl.provenance.write_provenance(path, provenance)¶
Write provenance metadata to a JSON file.
- Parameters:
path (
str|Path) – File to write. An existing file is replaced.provenance (
DatasetProvenance) – Metadata to write.
- Return type:
- ehr2rl.provenance.read_provenance(path)¶
Read provenance metadata from a JSON file.
- Parameters:
path (
str|Path) – File written bywrite_provenance.- Returns:
The metadata.
- Return type:
- Raises:
ValueError – If a required field is missing.