A package to help FHIR searching with needed search parameters are not available
Project description
FHIR Search Helper
A Python package to support FHIR Searching in contexts where needed search parameters are not supported
Quick Start
NOTE: Currently, the only option for capability_statement_file is 'epic_r4_metadata_edited.json'
from fhirsearchhelper import run_fhir_query
# This is using objects to store search params
output: Bundle | None = run_fhir_query(base_url='https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4/', query_headers={'Authorization': 'Bearer 1234567'}, resource_type='Patient', search_params={'resourceType': 'Patient', 'search_params': {'name': 'Smith', 'deceased': 'true'}}, capability_statement_file='epic_r4_metadata_edited.json')
# This is using a raw query
output: Bundle | None = run_fhir_query(query_headers={'Authorization': 'Bearer 1234567'}, query='https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4/Patient?name=Smith&deceased=true', capability_statement_file='epic_r4_metadata_edited.json')
A Note on CapabilityStatements
In their current form, CapabilityStatement
s do not have a way to express when a search parameter for a resource is conditionally accepted. For example, in the Epic R4 CapabilityStatement
, for the Condition
resource, there exists a listed search parameter of code
. In the description, there is a note that this search parameter is only accepted when the category
is equal to infection
. The only way that this conditional information would be known is by manual reading of the description. To alleviate this issue, and to avoid extreme custom handling in this package, currently you must edit the CapabilityStatement
of any server with which you would like to use this package and add custom extensions to the search parameter. Keeping with the above example of the search parameter code
for the Condition
resource, here is what the CapabilityStatement.rest[0].resource.where(type = 'Condition').searchParam.where(name = 'code')
element looks like:
{
"name": "code",
"type": "token",
"documentation": "Search for Conditions with a specified code. This is only used when searching for infections.",
"extension": [
{
"url": "true-when",
"valueString": "category==infection"
}
]
}
Here we have added an extension with a url of true-when
that is a machine readable statement denoting when a search parameter is accepted by the server. It currently only supports == to show equality and in to show membership of a list (e.g. "category in [infection, health-problem]"). This also works for when a search parameter is limited in the values it will successfully search for. For example, here is what the CapabilityStatement.rest[0].resource.where(type = 'Condition').searchParam.where(name = 'category')
element looks like:
{
"name": "category",
"type": "token",
"documentation": "Search for Condition resources by category.",
"extension": [
{
"url": "true-when",
"valueString": "category in [dental-finding, encounter-diagnosis, genomics, health-concern, infection, medical-history, problem-list-item, reason-for-visit]"
}
]
}
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
Built Distribution
File details
Details for the file fhirsearchhelper-0.0.16.tar.gz
.
File metadata
- Download URL: fhirsearchhelper-0.0.16.tar.gz
- Upload date:
- Size: 51.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94147c18d2564ddc64666f1f1ef8d97254723a32e37cee67b2e38b042a7f07dc |
|
MD5 | 57efc5205aca5df88f22f18dbdf4fb54 |
|
BLAKE2b-256 | 19e2a40ee6a70beb6d73b63cad41799a59e13963f78f4079df7698716d1f8e16 |
File details
Details for the file fhirsearchhelper-0.0.16-py3-none-any.whl
.
File metadata
- Download URL: fhirsearchhelper-0.0.16-py3-none-any.whl
- Upload date:
- Size: 52.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f73148e0bc781c5ab6e421afcd7b8481552bde1ba970b40bd5c0953ad4a5ab8 |
|
MD5 | 251669b3f155b8c5a4e373f2c780d45a |
|
BLAKE2b-256 | cff85f0f0ce28f77541e9e36e0b6177eea98595396ae49f9d3c0d5447eee423f |