Skip to main content

smart-on-fhir-client 🔥

Package allowing to request a fhir server with the smart-on-fhir protocol.

ℹ Warning

It is not a webserver providing a webserver with a callback url usually involved in the smart-on-fhir procedure

Tutorial

First, we will need to create a partner. We can do this easily subclassing the Partner class.

import os
from smart_on_fhir_client.partner import Partner
from smart_on_fhir_client.strategy import Strategy

class OauthFHIRProvider(Partner):
    name = 'PROVIDER'
    supported_strategies: set[Strategy] = {Strategy.M2M}
    client_id: str = os.getenv("PROVIDER_CLIENT_ID")
    client_secret: str = os.getenv("PROVIDER_CLIENT_SECRET")
    token_url: str = ... # set the token url
    fhir_url: str = ... # set the fhir url

    # additional information
    audience: str = ... # audience
    database_reference: str = ... # optional 
    grant_type: str = "client_credentials" # set the credentials

FHIR_PROVIDER = OauthFHIRProvider()
from smart_on_fhir_client.client import smart_client_factory
from smart_on_fhir_client.requester.fhir_requester import fhir_client_manager
from smart_on_fhir_client.strategy import Strategy

# set up your own fhir server url
fhir_client_manager.set_own_fhir_url("http://localhost:8080/fhir")


async def register():
    async with smart_client_factory:
        await fhir_client_manager.register_fhir_client_async(
            smart_client_factory.builder()
            .for_partner(FHIR_PROVIDER)
            .for_strategy(Strategy.M2M)
            # you can register special classes for specific fhir resources
            .register_cls_for('Patient', CustomPatientResource)
        )
        first_patient = await fhir_client_manager.patient.search().limit(10).first()
        await first_patient.pipe_to_target_fhir_server()

Features

Allow to send some fetched fhir resources to another fhir server via the pipe_to_target_fhir_server, making data transfer between two fhir servers easier.

Notes

Work based heavily on fhir-py and fhir-resources python packages

Release files for smart-on-fhir-client 1.0.4

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-on-fhir-client 1.0.4
File Size Uploaded
smart_on_fhir_client-1.0.4.tar.gz 12.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for smart-on-fhir-client 1.0.4
File Interpreter ABI Platform
smart_on_fhir_client-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 26.8 kB

Release files / smart_on_fhir_client-1.0.4.tar.gz

Download URL smart_on_fhir_client-1.0.4.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7422a89278d73503e64b2992a3f864c9651a52981bb8c4732a1d5dacf5bfae43
BLAKE2b-256 checksum
How to use checksums
a72e4c0371c0e639b758a4eecc3753d5b97954d94a21b175668c01245cd1c29a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / smart_on_fhir_client-1.0.4-py3-none-any.whl

Download URL smart_on_fhir_client-1.0.4-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ab677e20fa2d76cc6ffd160cc6cf1e922f8073261bb2acf2deeb12095b0ccd5
BLAKE2b-256 checksum
How to use checksums
15ade9839f9f56caea424741d1ff39564c57b5b7deb08dad205a3ee6d1cf99c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.2

2 release files

0.0.1

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