Parse FHIR query string
Project description
A library to parse FHIR query strings.
Validates type and returns correct object
Built-in search parameters from FHIR standard
Parses modifiers and prefixes
Generally only have included relevant Resources with maturity greater than 2. Some exceptions.
Usage
from fhir_parse_qs import Search search = Search('Patient', 'name=bob') # Search(<endpoint>, <query_string>) # endpoint search.endpoint --> 'Patient' # all the namedtuples search.parsed --> [FHIRSearch(...)] # index as key; each parameter/value pair gets parsed into a namedtuple search[0] --> FHIRSearch(...) search[0].modifier --> None search[0].prefix --> None search[0].value --> 'bob' search[0].parameter --> 'name' search[0].type_ --> 'string' search[0].chain --> None # act like dict with parameter as key (list if non-unique parameter) search['name'] --> FHIRSearch(...) # can iterate over the parameter/value pairs for x in search: print(x) --> FHIRSearch(...) # unrecognized parameter, ignore and log it search = Search('Patient', 'random=test') search.error --> [...] # chains - namedtuple with endpoint, target_parameter, target_type search = Search('Observation', 'patient.name=peter') search[0].parameter --> 'name' # last parameter in chain search[0].value --> 'peter' search[0].chain --> [FHIRChain(...), FHIRChain(...)] search[0].chain[0].endpoint = 'Observation' search[0].chain[0].target = 'patient' search[0].chain[0].ttype = 'reference' search[0].chain[1].endpoint = 'Patient' search[0].chain[1].target = 'name' search[0].chain[1].ttype = 'string'
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
fhir_parse_qs-0.3.0.tar.gz
(2.7 kB
view hashes)
Built Distribution
Close
Hashes for fhir_parse_qs-0.3.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af76defd68aa5526be8d8b09ae89fb7c56fc71cef4073535c2cad1cefc33c4b9 |
|
MD5 | c61783d72fb3c54268cb37d434674588 |
|
BLAKE2b-256 | 34078a7cd74a4f9f843d289890b5d28b6fe588c5c96da9fa759795950dbf56d8 |