guillotina_fhirfield package

Submodules

guillotina_fhirfield.cli module

Console script for guillotina_fhirfield.

guillotina_fhirfield.exc module

exception guillotina_fhirfield.exc.SearchQueryError[source]

Bases: zope.interface.exceptions.Invalid

exception guillotina_fhirfield.exc.SearchQueryValidationError[source]

Bases: guillotina_fhirfield.exc.SearchQueryError

guillotina_fhirfield.field module

class guillotina_fhirfield.field.DefaultFhirFieldSchemaSerializer(field, schema, request)[source]

Bases: guillotina.json.serialize_schema_field.DefaultSchemaFieldSerializer

field_type
class guillotina_fhirfield.field.FhirField(resource_class=None, resource_interface=None, resource_type=None, **kw)[source]

Bases: guillotina.schema._field.Object

FhirResource also known as FHIR field is the schema field derrived from z3c.form’s field.

It takes all initilial arguments those are derrived from standard schema field, with additionally model, resource_type and resource_interface

Note

field name must be start with lowercase name of FHIR Resource.

from_dict(dict_value)[source]
from_unicode(str_val)[source]
class guillotina_fhirfield.field.FhirFieldValue(obj: NewType.<locals>.new_type = None)[source]

Bases: object

FhirResourceValue is a proxy class for holding any object derrived from fhir.resources.resource.Resource

foreground_origin()[source]

Return the original object of FHIR model that is proxied!

patch(patch_data)[source]
stringify(prettify=False)[source]
guillotina_fhirfield.field.fhir_field_deserializer(fhirfield, value, context=None)[source]
guillotina_fhirfield.field.fhir_field_from_resource_type(resource_type: str, cache: bool = True) → Optional[dict][source]
guillotina_fhirfield.field.fhir_field_from_schema(schema: <InterfaceClass zope.interface.Interface>, resource_type: str = None) → Optional[guillotina_fhirfield.field.FhirField][source]
guillotina_fhirfield.field.fhir_field_value_serializer(value)[source]

guillotina_fhirfield.helpers module

guillotina_fhirfield.helpers.fhir_resource_mapping(resource_type: str, cache: bool = True) → dict[source]
guillotina_fhirfield.helpers.fhir_search_path_meta_info(path: str) → Optional[tuple][source]
guillotina_fhirfield.helpers.filter_logic_in_path(raw_path: str) → str[source]

Separates if any logic_in_path is provided

guillotina_fhirfield.helpers.import_string(dotted_path: str) → type[source]

Shameless hack from django utils, please don’t mind!

guillotina_fhirfield.helpers.parse_json_str(str_val: str, encoding: str = 'utf-8') → Optional[dict][source]
guillotina_fhirfield.helpers.parse_query_string(request, allow_none=False)[source]

We are not using self.request.form (parsed by Zope Publisher)!! There is special meaning for colon(:) in key field. For example field_name:list treats data as List and it doesn’t recognize FHIR search modifier like :not, :missing as a result, from colon(:) all chars are ommited.

Another important reason, FHIR search supports duplicate keys (defferent values) in query string.

Build Duplicate Key Query String ::
>>> import requests
>>> params = {'patient': 'P001', 'lastUpdated': ['2018-01-01', 'lt2018-09-10']}
>>> requests.get(url, params=params)
>>> REQUEST['QUERY_STRING']
'patient=P001&lastUpdated=2018-01-01&lastUpdated=lt2018-09-10'
>>> from six.moves.urllib.parse import urlencode
>>> params = [('patient', 'P001'), ('lastUpdated', '2018-01-01'), ('lastUpdated', 'lt2018-09-10')]
>>> urlencode(params)
'patient=P001&lastUpdated=2018-01-01&lastUpdated=lt2018-09-10'

param:request param:allow_none

guillotina_fhirfield.helpers.resource_type_to_resource_cls(resource_type: str, fhir_release: str = None) → Union[zope.interface.exceptions.Invalid, type][source]
guillotina_fhirfield.helpers.search_fhir_resource_cls(resource_type: str, cache: bool = True, fhir_release: str = None) → Optional[str][source]

This function finds FHIR resource model class (from fhir.resources) and return dotted path string.

Parameters:
  • resource_type – the resource type name (required). i.e Organization
  • cache – (default True) the flag which indicates should query fresh or serve from cache if available.
  • fhir_release – FHIR Release (version) name. i.e STU3, R4

:return dotted full string path. i.e fhir.resources.organization.Organization

Example:

>>> from guillotina_fhirfield.helpers import search_fhir_resource_cls
>>> from zope.interface import Invalid
>>> dotted_path = search_fhir_resource_cls('Patient')
>>> 'fhir.resources.patient.Patient' == dotted_path
True
>>> dotted_path = search_fhir_resource_cls('FakeResource')
>>> dotted_path is None
True
guillotina_fhirfield.helpers.translate_param_name_to_real_path(param_name, resource_type=None)[source]
guillotina_fhirfield.helpers.validate_resource_type(resource_type: str) → None[source]

FHIR resource type validation

guillotina_fhirfield.interfaces module

Module where all interfaces, events and exceptions live.

guillotina_fhirfield.patch module

guillotina_fhirfield.patch.patch_fhir_base_model()[source]

guillotina_fhirfield.variables module

Module contents

guillotina_fhirfield.includeme(root)[source]