Skip to main content

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 DocumentReference \
  /tmp/export

ls -l /tmp/export
# 001.2025-06-26/
# DocumentReference.001.ndjson.gz -> 001.2025-06-26/DocumentReference.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 DocumentReference,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
# DocumentReference.001.ndjson.gz -> 001.2025-06-26/DocumentReference.001.ndjson.gz
# DocumentReference.002.ndjson.gz -> 002.second-run/DocumentReference.001.ndjson.gz

Metadata

Release files for smart-fetch 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smart-fetch 1.0.5
File Size Uploaded Provenance Actions
smart_fetch-1.0.5.tar.gz 95.5 kB With provenance Details for smart_fetch-1.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for smart-fetch 1.0.5
File Interpreter ABI Platform Actions
smart_fetch-1.0.5-py3-none-any.whl Python 3 none any Details for smart_fetch-1.0.5-py3-none-any.whl

Total release size: 162.4 kB

Release files / smart_fetch-1.0.5.tar.gz

Download URL smart_fetch-1.0.5.tar.gz
Size 95.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0176ed1bcd1bb15d64e91c7a3f089a362d715e6a5d648bfdfbc362c27bcaaba8
BLAKE2b-256 checksum
How to use checksums
d0b9f5e79151ae76b2b6e0ad1132fb8565d5262300760a558880c0b22648ad64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Release files / smart_fetch-1.0.5-py3-none-any.whl

Download URL smart_fetch-1.0.5-py3-none-any.whl
Size 66.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d63bc42040b88a0c9669068bdeee4b38e20fe25746e23c057e28d70295f06e7c
BLAKE2b-256 checksum
How to use checksums
fc3a9dd229156c596cc4616cde8d36b838b8604ba65a18b43eab12acc76b04cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Security for smart-fetch 1.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for smart_fetch-1.0.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page