Skip to main content

XFHIR Python SDK

import xfhir
xfhir.init(client_id='xxx', client_secret='xxxx')
xfhir.create({})
xfhir.get(id='', resource_type='Patient')
xfhir.filter(resource_type='Patient', q='')
xfhir.search(q='')

Connect to the XFHIR Service

from xfhir import XFHIR
x = XFHIR(client_id='xxx', client_secret='xxxx')

Create a Policy for a FHIR Resource

patient_redact_policy = x.policy.create(effect='Redact', actions=[
   'account-id:client-id:method:resource:path',
   'account-id:*:Read:Patient:$',
])

Create the FHIR Resource on XFHIR along with its resource policies

x.create({
   'fhir_resource': {},
   'policies': [
      patient_redact_policy
   ]
})

Full example

from xfhir import XFHIR
x = XFHIR(client_id='xxx', client_secret='xxxx')

patient_redact_policy = x.policy.create(effect='Redact', actions=[
   'account-id:client-id:method:resource:path',
   'account-id:*:Read:Patient:$',
])

x.create({
   'fhir_resource': {},
   'policies': [
      patient_redact_policy
   ]
})

patient = x.get('Patient', 'identifier')

The output of the patient object should be

{
   "id": "*** REDACTED **",
   "name": "*** REDACTED **"
}

To redact only a few fields in the patient object you can create a policy that only redacts your custom fields

patient_redact_policy = x.policy.create(effect='Redact', actions=[
   'account-id:*:Read:Patient:$.id',
   'account-id:*:Read:Patient:$.name',
   'account-id:*:Read:Patient:$.contact'   
])

Metadata

Release files for xfhir 0.0.2

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

Source distribution (sdist)

Source distribution for xfhir 0.0.2
File Size Uploaded Provenance Actions
xfhir-0.0.2.tar.gz 4.9 kB Without provenance Details for xfhir-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for xfhir 0.0.2
File Interpreter ABI Platform Actions
xfhir-0.0.2-py3-none-any.whl Python 3 none any Details for xfhir-0.0.2-py3-none-any.whl

Total release size: 9.1 kB

Release files / xfhir-0.0.2.tar.gz

Download URL xfhir-0.0.2.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1b94c0515998f36ce599c34a3e54dd902c3b71032a787fdc71dbcbef81739299
BLAKE2b-256 checksum
How to use checksums
bedb371ce4dd2bfdb83fcf6b4c208700f4f2b1f17870ed9c4f91ab41833b7a52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / xfhir-0.0.2-py3-none-any.whl

Download URL xfhir-0.0.2-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3e1bf25b7614517244767246124ab8a4d89b210c5653b0a7d4690bf1ce360cfd
BLAKE2b-256 checksum
How to use checksums
df51d7d34e46bc85f406085a0b41de47a6ab6fc91b7f7e719d3e784d0a21eb03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Security for xfhir 0.0.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

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