Package: plone.app.fhirfield
Background (plone.app.fhirfield)FHIR(Fast Healthcare Interoperability Resources) is the industry standard for Healthcare system. Our intend to implementFHIRbased system usingPlone!plone.app.fhirfieldwill make life easier to create, manage content forFHIR resourcesas well search facilities for any FHIR Resources.How It WorksThis field is working as like otherzope.schemafield, just add and use it. You will feed the field value as either json string or python dict ofFHIRresources through web form or any restapi client. This field has built-inFHIRresource validator and parser.Example:from plone.app.fhirfield import FhirResource
from plone.supermodel import model

class IMyContent(model.Schema):

    <resource_type>_resource = FhirResource(
        title=u'your title',
        desciption=u'your desciption',
        fhir_release='any of FHIR release name'
        resource_type='any fhir resource type[optional]'
    )The field’s value is the instance of a specilized classFhirResourceValueinside the context, which is kind of proxy class offhir modelwith additional methods and attributes.FeaturesPlone restapi supportWidget: z3cform supportplone.supermodel supportplone.rfc822 marshaler field supportAvailable Field’s OptionsThis field has got all standard options (i.etitle,required,desciptionand so on) with additionally options for the purpose of either validation or constraint those are related toFHIR.fhir_releaseRequired: YesDefault: NoneType: StringThe release version ofFHIRExample:R4,STU3resource_typeRequired: NoDefault: NoneType: StringThe name ofFHIRresource can be used as constraint, meaning that we can restricted only accept certain resource. If FHIR json is provided that contains other resource type, would raise validation error.
Example:FhirResource(….,resource_type=’Patient’)modelRequired: NoDefault: NoneType: String + full python path (dotted) of the model class.Likeresource_typeoption, it can be used as constraint, however additionally this option enable us to use custom model class other than fhirclient’s model.
Example:FhirResource(….,model=’fhirclient.models.patient.Patient’)index_mappingRequired: NoDefault: NoneType: JSONThe custom index mapping, best case is elasticsearch mapping. Default mapping would be replaced by custom.Field’s Value APIField’s value is a specilized classplone.app.fhirfield.value.FhirResourceValuewhich has reponsibilty to act as proxy offhirclient model’s class. This class provides some powerful methods.FhirResourceValue::jsonOriginally this method is derived from fhir base model, you will always have to use this method during negotiation (although our serializer doing that for you automatically). This method not takes any argument, it returns FHIR json representation of resource.FhirResourceValue::patchIf you are familar withFHIRPath Patch, this method one of the strongest weapon of this class. Patch applying on anyFHIRresources is noting but so easy.
This method takes one mandatory argumentpatch_dataand that value should be list of patch items (jsonpatch).Example:from plone.app.fhirfield import FhirResource
from plone.supermodel import model

class ITask(model.Schema):

    resource = FhirResource(
        title=u'your title',
        desciption=u'your desciption',
        resource_type='Task'
    )

patch_data = [
  {'op': 'replace', 'path': '/source/display', 'value': 'Patched display'},
  {'op': 'replace', 'path': '/status', 'value': 'Reopen'}
]
task_content.resource.patch(patch_data)FhirResourceValue::stringifyThis method returns string representation of fhir resource json value. Normallyas_jsonreturns python’s dict type data. This method takes optionalprettifyargument, by setting this argument True, method will return human/print friendly representation.FhirResourceValue::foreground_originThere may some situation come, where you will need just pure instance of fhir model, this method serves that purpose. This method returns current fhir resource model’s instance.Example:from fhirclient.models.task import Task
from plone.app.fhirfield import FhirResource
from plone.supermodel import model

class ITask(model.Schema):

    resource = FhirResource(
        title=u'your title',
        desciption=u'your desciption',
        resource_type='Task'
    )

task = task_content.resource.foreground_origin()
assert isinstance(task, Task)InstallationInstall plone.app.fhirfield by adding it to your buildout:[buildout]

...

eggs =
    plone.app.fhirfieldand then runningbin/buildout. Go to plone control and installplone.app.fhirfieldor If you are creating an addon that depends on this product, you may add<dependency>profile-plone.app.fhirfield:default</dependency>inmetadata.xmlat profiles.LinksCode repository:https://github.com/nazrulworld/plone.app.fhirfieldContinuous Integration:https://travis-ci.org/nazrulworld/plone.app.fhirfieldIssue Tracker:https://github.com/nazrulworld/plone.app.fhirfield/issuesLicenseThe project is licensed under the GPLv2.Migration1.0.0 to 2.0.0Simply old indexes are not usable any more! as new ES server (6.x.x) is used.Do backup of your existing Data.fs (important!).From plone controlpanel, Go to elasticsearch settings page/@@elastic-controlpanel.Convert Catalog again, make sure in theIndexes for which all searches are done through ElasticSearchsection
your desired indexes are select.If your site is behind the proxy, we suggest makessh tuneling to connectyour site.
Because next takes much times, (depends on your data size)Rebuild Catalog && wait for success, if you face any problem try again.1.0.0rc3 to 1.0.0rc4Keep backup of existing Data.fs (nice to have)Go to plone control panel’s Addon settingsUninstall and Install againplone.app.fhirfield1.0.0b6 to 1.0.0rc3Keep backup of existing Data.fs (important)JustClear and Rebuildexisting catalogs. Go to site management -> portal_catalog -> Advanced Tab and click theClear and Rebuildbutton. Caution: this activity could take longer time.1.0.0bx to 1.0.0b6You will need to remove all the indexes who are based onFhir*******Index. Go to ZMI to portal catalog tool.{site url}/portal_catalog/manage_catalogIndexes.Update theplone.app.fhirfieldversion and run the buildout.List out any products those defined (profile/catalog.xml) indexes based onFhir*******Indexas meta type. Reninstall them all.From ZMI, portal_catalog tool,{site url}/portal_catalog/manage_catalogAdvancedClear and RebuildContributorsMd Nazrul Islam (Author),email2nazrul@gmail.comChangelog4.2.1 (2022-10-18)BugfixesIssue-37:Can not add a default value for fhirfield.4.2.0 (2020-12-07)ImprovementsField deserializer is now acceptingfhir.resources’s model object, FhirResourceValue, alongside with string and dict type value.FhirResource::from_resource_modelmethod has been added.4.1.0 (2020-09-08)ImprovementsNot any visibly improvement, but a lot of cleanup unused, unnecessary codes, in that impact made more slimmer version.Breakingsapimodule has been removed, use any import fromplone.app.fhirfieldinstead.IFhirResourceModelinterface is no longer available.4.0.0 (2020-08-17)Improvementssupportspydanticpowered latestfhir.resourcesviafhirpath.suports Python 3.6.BreakingsAny FHIR search, FhirFieldIndex, EsFhirFieldIndex are removed. Please seecollective.fhirpathfor those implementation.model_interfaceparameter has been removed fromFhirResourcefield.Removed threefhirfield.es.index.mappingregistry.extra optionelasticsearchhas been removed from setup.py3.1.1 (2020-05-15)Nothing changed but some documents updated.3.1.0 (2020-05-14)BreakingsDrop support python version until 3.6.xFhirResource.get_fhir_versionbeen changed toFhirResource.get_fhir_releaseand no longer returns Enum member instead just string value.One of requiredFhirResourceinit parameterfhir_versionhas been changed tofhir_release.Removed Helper Functionsplone.app.fhirfield.helpers.resource_type_str_to_fhir_modelusefhirpath.utils.lookup_fhir_class.plone.app.fhirfield.helpers.search_fhir_modelusefhirpath.utils.lookup_fhir_class_pathplone.app.fhirfield.helpers.import_stringusefhirpath.utils.import_string3.0.0 (2020-03-18)ImprovementsElasticsearch mappings are updated with correct value.3.0.0b2 (2019-11-12)NewfeaturesFully compatiable withcollective.fhirpath.It is possible to provide custom index mapping throughFhirResourcefield.Breakingsfhir_versionvalue is manadatory, so you have provide fhir version number.DeprecationsUsing PluginIndexes (EsFhirFieldIndex) has been deprecated.FHIR Search throughportal_cataloghas been deprecated.Using elasticsearch mapping from this project has been deprecated.3.0.0b1 (2019-10-01)NewfeaturesFHIRPathsupport added throughcollective.fhirpath.Now supports Elasticsearch server version6.8.3.BreakingsDrop support python 2.x.x.2.0.0 (2019-05-18)NewfeaturesIssue#14Now reference query is powerful yet!
It is possible now search by resourceType only or mixing up.Issue#21One of the powerful feature added, IN/OR support in search query.
Now possible to provide multiple values separated by comma.BreakingsDrop support Elastic server version 2.3.x.BugfixesImportant fix forQuantitysearch type, now value prefix not impact on other (unit, system). Additionally
also now possible to search by unit or system and code (without value)1.0.0 (2019-01-18)BreakingDropfhirclientdependency, instead makefhir.resourcesdependency.collective.elasticsearchversion minimum version2.0.5has been pinned.1.0.0rc4 (2018-10-25)BreakingDrop support for Plone 4.xx (sorry).ImprovementsIssue#10 JSON Viewer added in display mode.Issue#18apimodule to make available for all publicly usable methods, functions, classes.Issue#17 Add suports for duplicate param names into query string. It is now possible to provide multiple condition for same param type. For example?_lastUpdated=gt2015-10-15T06:31:18+00:00&_lastUpdated=lt2018-01-15T06:31:18+00:00Issue#10 Add support forCompositetype FHIR search param.Issue#13 Add support forAddressandContactPointmapping. It opens up many search params.Mappings are more enriched, so many missing mappings are added, likevalueString,valueQuantityand so on.[nazrulworld]Issue#12 Full support forcodesearch param type has been added, it also opens up for other search parameters (y).Issue#15 support forHumananemapping in search.1.0.0rc3 (2018-09-22)ImprovementsIssue: 6A major improvement has been done, now very slim version (id,resourceType,meta) of FHIR json resource has been indexed in ZCatalog (zope index) version, however previously whole fhir resource was stored as a result now huge storage savings, perhaps improves indexing performance. [nazrulworld]1.0.0rc2 (2018-08-29)BugfixesIssue 5:FHIR search’s modifier ‘missing’ is not working for nested mapping1.0.0rc1 (2018-08-27)NewfeaturesIdentifier search parameteris active now (both array of identifier and single object identifier).Array of Reference query support (for examplebasedOn(list of reference) ) is active now. Although normal object reference has already been supported.All available mappings for searchable resources are generated.FHIR search sort featureis available!fhirfield.es.index.mapping.nested_fields.limit,fhirfield.es.index.mapping.depth.limitandfhirfield.es.index.mapping.total_fields.limitregistry recordsareavailable to setup ES mappingURIandNumbertype parameter based search are fully available.`resourceType` filter is automatically injected into every generated query.Query Builder knows about which resourceType should be.Breaking Changesplone.app.fhirfieldhave to install, as some registry records (settings) for elasticsearch mapping have been introduced.Any deprecated FHIR Field Indexes other thanFhirFieldIndex(FhirOrganizationIndexand so on) are removed1.0.0b7 (2018-08-10)Media search available.plone.app.fhirfield.SearchQueryErrorexception class available, it would be used to catch any fhir query buiding errors. [nazrulworld]1.0.0b6 (2018-08-04)Fix: minor type mistake on non existing method called.Migration guide has been added. [nazrulworld]1.0.0b5 (2018-08-03)NewfeaturesFhirFieldIndexCatalog Index has been refactored. Now this class is capable to handle all the FHIR resources. That’s why other PluginIndexes related to FhirField have been deprecated.New ZCatalog (plone index) index naming convention has been introduced. Any index name for FhirFieldIndex must have fhir resource type name as prefix. for example:task_index1.0.0b4 (2018-08-01)Must Update (fix): Important updates made on mapping, reference field mapping was not working if value contains with/, now made it tokenize by indecating index isnot_analyzed_profilesearch parameter is now available. [nazrulworld]1.0.0b3 (2018-07-30)Mapping improvment forFhirQuestionnaireResponseIndex,FhirObservationIndex,FhirProcedureRequestIndex,FhirTaskIndex,FhirDeviceRequestIndex1.0.0b2 (2018-07-29)New Features:supports for elasticsearch has been added. Now many basicfhir searchare possible to be queried.upto 22 FHIR fields indexes (FhirActivityDefinitionIndex,FhirAppointmentIndex,FhirCarePlanIndex,FhirDeviceIndex,FhirDeviceRequestIndex,FhirHealthcareServiceIndex,FhirMedicationAdministrationIndex,FhirMedicationDispenseIndex,FhirMedicationRequestIndex,FhirMedicationStatementIndex,FhirObservationIndex,FhirOrganizationIndex,FhirPatientIndex,FhirPlanDefinitionIndex,FhirPractitionerIndex,FhirProcedureRequestIndex,FhirQuestionnaireIndex,FhirQuestionnaireResponseIndex,FhirRelatedPersonIndex,FhirTaskIndex,FhirValueSetIndex)Mappings for all available fhir indexes are created.elasticsearchoption is now available for setup.py1.0.0b1 (2018-03-17)first beta version has been released.1.0.0a10 (2018-03-12)fix(bug) Issue-3:resource_typeconstraint don’t raise exception from validator.1.0.0a9 (2018-03-08)There is no restriction/limit over fhir resources, all available models are supported.1.0.0a8 (2018-01-22)fix(bug) Issue-: Empty string value raise json validation error #2:https://github.com/nazrulworld/plone.app.fhirfield/issues/21.0.0a7 (2018-01-21)fix(bug) Issue-1: _RuntimeError: maximum recursion depth exceeded while calling a Python object at form view. #1:https://github.com/nazrulworld/plone.app.fhirfield/issues/11.0.0a6 (2018-01-14)missingHealthcareServicefhir model is added as supported model.1.0.0a5 (2018-01-14)Personfhir model added in whitelist.1.0.0a4 (2018-01-14)IFhirResource.model_interface field type changed toDottedNamefromInterfaceField.1.0.0a3 (2017-12-22)FHIR Patchsupport added. Now patching fhir resource is more easy to manage.plone.supermodel support is confirmed.[nazrulworld]plone.rfc822 marshaler field support.[nazrulworld]1.0.0a2 (2017-12-10)FhirResourceWidgetis made working state. From now it is possible to adapt FhirResourceWidget` with z3c.form [nazrulworld]1.0.0a1 (2017-12-05)Initial release.
[nazrulworld]