XFHIR Python SDK
Project description
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'
])
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
xfhir-0.0.2.tar.gz
(4.9 kB
view details)
Built Distribution
xfhir-0.0.2-py3-none-any.whl
(4.1 kB
view details)
File details
Details for the file xfhir-0.0.2.tar.gz
.
File metadata
- Download URL: xfhir-0.0.2.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b94c0515998f36ce599c34a3e54dd902c3b71032a787fdc71dbcbef81739299 |
|
MD5 | ce181874c6ef9d4bbf34c30d36b29b52 |
|
BLAKE2b-256 | bedb371ce4dd2bfdb83fcf6b4c208700f4f2b1f17870ed9c4f91ab41833b7a52 |
File details
Details for the file xfhir-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: xfhir-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e1bf25b7614517244767246124ab8a4d89b210c5653b0a7d4690bf1ce360cfd |
|
MD5 | 1b9b5008ebe4a2f144fcd1003efb2aad |
|
BLAKE2b-256 | df51d7d34e46bc85f406085a0b41de47a6ab6fc91b7f7e719d3e784d0a21eb03 |