Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smart_fetch-0.6.4.tar.gz (85.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smart_fetch-0.6.4-py3-none-any.whl (64.1 kB view details)

Uploaded Python 3

File details

Details for the file smart_fetch-0.6.4.tar.gz.

File metadata

  • Download URL: smart_fetch-0.6.4.tar.gz
  • Upload date:
  • Size: 85.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for smart_fetch-0.6.4.tar.gz
Algorithm Hash digest
SHA256 184854d04418e6e3c9afa0085b40889f86f09520e4d9ecd8b0a5ad560f7a70e0
MD5 6badeafa41808425e671a2458690f8f5
BLAKE2b-256 b743952431558ef1e7e62eac91940a95787375c867b4abcb606e931fc2891f75

See more details on using hashes here.

Provenance

The following attestation bundles were made for smart_fetch-0.6.4.tar.gz:

Publisher: pypi.yaml on smart-on-fhir/smart-fetch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smart_fetch-0.6.4-py3-none-any.whl.

File metadata

  • Download URL: smart_fetch-0.6.4-py3-none-any.whl
  • Upload date:
  • Size: 64.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for smart_fetch-0.6.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1315768d33f104541f0fea3eb487334d5ff4d6197a5fd781922ecdf94f56c1c3
MD5 bc64552a2f4ce93e865b6959b0809cad
BLAKE2b-256 0e95bc6a15e1f9068f60a7a3eac5e376469cee8b2aa90d7e8f0579df91485321

See more details on using hashes here.

Provenance

The following attestation bundles were made for smart_fetch-0.6.4-py3-none-any.whl:

Publisher: pypi.yaml on smart-on-fhir/smart-fetch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page