guillotina_fhirfield package¶
Subpackages¶
- guillotina_fhirfield.tests package
- Submodules
- guillotina_fhirfield.tests.conftest module
- guillotina_fhirfield.tests.fhir_contents module
- guillotina_fhirfield.tests.fixtures module
- guillotina_fhirfield.tests.helpers module
- guillotina_fhirfield.tests.test_field module
- guillotina_fhirfield.tests.test_guillotina_fhirfield module
- Module contents
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
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.ObjectFhirResource 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_typeandresource_interfaceNote
field name must be start with lowercase name of FHIR Resource.
-
class
guillotina_fhirfield.field.FhirFieldValue(obj: NewType.<locals>.new_type = None)[source]¶ Bases:
objectFhirResourceValue is a proxy class for holding any object derrived from fhir.resources.resource.Resource
-
guillotina_fhirfield.field.fhir_field_from_resource_type(resource_type: str, cache: bool = True) → Optional[dict][source]¶
guillotina_fhirfield.helpers module¶
-
guillotina_fhirfield.helpers.fhir_resource_mapping(resource_type: str, cache: bool = True) → dict[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.interfaces module¶
Module where all interfaces, events and exceptions live.