Fetch FHIR data from your EHR easily and completely
Project description
SMART Fetch
A tool for extracting FHIR data from your EHR.
Quick Start
If you want to skip any description and dive right in:
pipx install smart-fetch
smart-fetch export \
--fhir-url https://bulk-data.smarthealthit.org/fhir \
/tmp/export
After running the above, you'll have a bunch of NDJSON resource files sitting in /tmp/export.
Run smart-fetch --help to learn more about the various options.
Initial Export
SMART Fetch can do an initial pull from your EHR, with either a "bulk export" or by manually searching through resources based on a list of patient MRNs, when bulk exporting is either not available or too slow.
Post-Processing Your Export
Very often, the initial export from the EHR will be missing some useful data. There will be referenced Medications, Observations, and clinical notes that you need to manually download to have a complete set of data.
SMART Fetch can help fill in those gaps by post-processing (or hydrating) your FHIR data.
Mostly these hydration tasks focus on grabbing data now so that you'll always have it, no matter what happens with your EHR later.
Example Hydration Tasks
- Inlining clinical notes from DiagnosticReport or DocumentReference (it's more reliable to get the note once upfront, and then you have it forever)
- Adding missing Observations (several EHRs don't provide DiagnosticReport.result or Observation.hasMember linked Observations by default in a search/export)
- Downloading MedicationRequest.medicationReference linked Medications (which can't normally be bulk exported but are necessary for clinically interpreting a MedicationRequest)
Managing Exports Over Time
Fetching data for a group is rarely as simple as a single export. You may want to export some resources separately, for performance reasons (e.g. Observations can take a long time). Or you may want to grab updates to the group's data over time.
SMART Fetch can help with that, by keeping each export in its own subfolder for individual processing, but also pooling all the results together with symlinks for convenience.
Example
pipx install smart-fetch
# Initial export
smart-fetch export \
--fhir-url https://bulk-data.smarthealthit.org/fhir \
--type Encounter,Patient \
/tmp/export
ls -l /tmp/export
# 001.2025-06-26/
# Encounter.001.ndjson.gz -> 001.2025-06-26/Encounter.001.ndjson.gz
# Patient.001.ndjson.gz -> 001.2025-06-26/Patient.001.ndjson.gz
# Second export with a --since date, a new resource, and a nickname for the export
smart-fetch export \
--fhir-url https://bulk-data.smarthealthit.org/fhir \
--type Encounter,Patient,Condition \
--since 2020-01-01 \
--nickname second-run \
/tmp/export
ls -l /tmp/export
# 001.2025-06-26/
# 002.second-run/
# Condition.001.ndjson.gz -> 002.second-run/Condition.001.ndjson.gz
# Encounter.001.ndjson.gz -> 001.2025-06-26/Encounter.001.ndjson.gz
# Encounter.002.ndjson.gz -> 002.second-run/Encounter.001.ndjson.gz
# Patient.001.ndjson.gz -> 001.2025-06-26/Patient.001.ndjson.gz
# Patient.002.ndjson.gz -> 002.second-run/Patient.001.ndjson.gz
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smart_fetch-0.3.1.tar.gz.
File metadata
- Download URL: smart_fetch-0.3.1.tar.gz
- Upload date:
- Size: 62.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e1e1737c8669b3c8896781b7049fad5111c4ba6b0258718335b75062639f08a
|
|
| MD5 |
3c60b5ec50b5a9a15f3001fc7886695f
|
|
| BLAKE2b-256 |
5e4b7e49ce35ea3ab20ffed53803b0b0737ca11a898fc26190f3be107bec8902
|
Provenance
The following attestation bundles were made for smart_fetch-0.3.1.tar.gz:
Publisher:
pypi.yaml on smart-on-fhir/smart-fetch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
smart_fetch-0.3.1.tar.gz -
Subject digest:
0e1e1737c8669b3c8896781b7049fad5111c4ba6b0258718335b75062639f08a - Sigstore transparency entry: 273525115
- Sigstore integration time:
-
Permalink:
smart-on-fhir/smart-fetch@4fc4cac9c09da87e7fe433489af7ac1417d79975 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/smart-on-fhir
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yaml@4fc4cac9c09da87e7fe433489af7ac1417d79975 -
Trigger Event:
release
-
Statement type:
File details
Details for the file smart_fetch-0.3.1-py3-none-any.whl.
File metadata
- Download URL: smart_fetch-0.3.1-py3-none-any.whl
- Upload date:
- Size: 46.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa3b03464667ed62c01ba4a354a8f0089eee77059fac08d8dd9f100a5794a2c4
|
|
| MD5 |
b9559caee28ad7fb46d9ccafe9fbbee7
|
|
| BLAKE2b-256 |
8c6ac47c52df67ca944da44416045e83e420053dc3d2bbfebe55a3eb2b80147e
|
Provenance
The following attestation bundles were made for smart_fetch-0.3.1-py3-none-any.whl:
Publisher:
pypi.yaml on smart-on-fhir/smart-fetch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
smart_fetch-0.3.1-py3-none-any.whl -
Subject digest:
aa3b03464667ed62c01ba4a354a8f0089eee77059fac08d8dd9f100a5794a2c4 - Sigstore transparency entry: 273525117
- Sigstore integration time:
-
Permalink:
smart-on-fhir/smart-fetch@4fc4cac9c09da87e7fe433489af7ac1417d79975 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/smart-on-fhir
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yaml@4fc4cac9c09da87e7fe433489af7ac1417d79975 -
Trigger Event:
release
-
Statement type: