Skip to main content

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

  • Supports modifiers, prefixes, and chains

Usage

from fhir_parse_qs import Search

# supported endpoints
Search.supported --> [...]

# simple use
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
search['name'] --> FHIRSearch(...) #list if non-unique parameter

# 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'

# return control parameters (eg, _sort, _count, etc)
search.control --> [...]

Project details


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.5.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

fhir_parse_qs-0.5.0-py2.py3-none-any.whl (3.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file fhir_parse_qs-0.5.0.tar.gz.

File metadata

  • Download URL: fhir_parse_qs-0.5.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for fhir_parse_qs-0.5.0.tar.gz
Algorithm Hash digest
SHA256 ab3f2e69a0d7dc23ffe8b753522d6fc1d453e1bbd66d0b3c8c349f3e7bfd62b4
MD5 37f69f6940b0efe582164725a22056d4
BLAKE2b-256 968accaea28bce44cd2e3eaa729b5ec64f4e426dc60d81ccb2bb424d9576c464

See more details on using hashes here.

Provenance

File details

Details for the file fhir_parse_qs-0.5.0-py2.py3-none-any.whl.

File metadata

  • Download URL: fhir_parse_qs-0.5.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for fhir_parse_qs-0.5.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2fc4e4b5659b973a6f4f537371f677d7c83c8e42e8e65aa9cf1cfab0210bd785
MD5 a0d63c3f36c0f3d56f6c2e8e5de9684b
BLAKE2b-256 60f67c1e456a265620f7635981203a176eb45dfe08220b9361d8818684f32516

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page