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.3

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.3
File Size Uploaded
smart_fetch-1.0.3.tar.gz 93.7 kB Details

Built distribution (wheel)

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

Total release size: 159.9 kB

Release files / smart_fetch-1.0.3.tar.gz

Download URL smart_fetch-1.0.3.tar.gz
Size 93.7 kB
Tags Source
SHA-256 checksum
How to use checksums
686cc73fabcd44eff0e65d6a1c4da5d99d56b1b243f57e33a6b003bce839b42f
BLAKE2b-256 checksum
How to use checksums
1ed84fe2ff0445bc746f9c89c0165d8625417e3817ad40d1ad690bd6b9ba3e23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 11, 2026.

Transparency log

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

Download URL smart_fetch-1.0.3-py3-none-any.whl
Size 66.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
67059ef82c7b638ede3e9114cce97491268e222c469443b69c9fd6bded7adbcc
BLAKE2b-256 checksum
How to use checksums
ae098efdea0c8fad0f78bdb076609fd67f545338d0e0c07e30ffbfd41708f2d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.7.0

2 release files

0.6.6

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

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