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 hashes)
Built Distribution
xfhir-0.0.2-py3-none-any.whl
(4.1 kB
view hashes)