From c60e9a531319a525cb31c6fdc8d4570d5fa91467 Mon Sep 17 00:00:00 2001 From: Thomas Papke Date: Sun, 3 Dec 2023 18:10:57 +0100 Subject: [PATCH] #1 Add initial Folder support --- .../registry/common/MappingSupport.java | 1 + .../registry/common/fhir/MhdFolder.java | 37 + .../common/mapper/XdsToFhirFolderMapper.java | 38 + .../registry/query/StoredQueryProcessor.java | 29 +- .../registry/query/StoredQueryVistorImpl.java | 24 +- .../register/RegisterDocumentsProcessor.java | 6 + ...finition-IHE.MHD.Comprehensive.Folder.json | 1662 +++++++++++++++++ .../common/mapper/FolderMappingImplTest.java | 46 + 8 files changed, 1839 insertions(+), 4 deletions(-) create mode 100644 src/main/java/org/openehealth/app/xdstofhir/registry/common/fhir/MhdFolder.java create mode 100644 src/main/java/org/openehealth/app/xdstofhir/registry/common/mapper/XdsToFhirFolderMapper.java create mode 100644 src/main/resources/profiles/StructureDefinition-IHE.MHD.Comprehensive.Folder.json create mode 100644 src/test/java/org/openehealth/app/xdstofhir/registry/common/mapper/FolderMappingImplTest.java diff --git a/src/main/java/org/openehealth/app/xdstofhir/registry/common/MappingSupport.java b/src/main/java/org/openehealth/app/xdstofhir/registry/common/MappingSupport.java index 2dcc030..9d74eb6 100644 --- a/src/main/java/org/openehealth/app/xdstofhir/registry/common/MappingSupport.java +++ b/src/main/java/org/openehealth/app/xdstofhir/registry/common/MappingSupport.java @@ -24,6 +24,7 @@ public class MappingSupport { public static String URI_URN = "urn:ietf:rfc:3986"; public static final String MHD_COMPREHENSIVE_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.Comprehensive.DocumentReference"; public static final String MHD_COMPREHENSIVE_SUBMISSIONSET_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.Comprehensive.SubmissionSet"; + public static final String MHD_COMPREHENSIVE_FOLDER_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.Comprehensive.Folder"; public static final Map PRECISION_MAP_FROM_XDS = new EnumMap<>( Map.of(Precision.DAY, TemporalPrecisionEnum.DAY, diff --git a/src/main/java/org/openehealth/app/xdstofhir/registry/common/fhir/MhdFolder.java b/src/main/java/org/openehealth/app/xdstofhir/registry/common/fhir/MhdFolder.java new file mode 100644 index 0000000..eb16d14 --- /dev/null +++ b/src/main/java/org/openehealth/app/xdstofhir/registry/common/fhir/MhdFolder.java @@ -0,0 +1,37 @@ +package org.openehealth.app.xdstofhir.registry.common.fhir; + +import java.util.List; + +import ca.uhn.fhir.model.api.annotation.Child; +import ca.uhn.fhir.model.api.annotation.Description; +import ca.uhn.fhir.model.api.annotation.Extension; +import ca.uhn.fhir.model.api.annotation.ResourceDef; +import lombok.Getter; +import lombok.Setter; +import org.hl7.fhir.r4.model.CodeableConcept; +import org.hl7.fhir.r4.model.Coding; +import org.hl7.fhir.r4.model.ListResource; +import org.openehealth.app.xdstofhir.registry.common.MappingSupport; + +@ResourceDef(name = "List", profile = MappingSupport.MHD_COMPREHENSIVE_FOLDER_PROFILE) +public class MhdFolder extends ListResource { + private static final long serialVersionUID = 6730967324453182475L; + + public static final CodeableConcept FOLDER_CODEING = new CodeableConcept( + new Coding("https://profiles.ihe.net/ITI/MHD/CodeSystem/MHDlistTypes", "folder", + "Folder as a FHIR List")); + + public MhdFolder() { + super(); + setCode(FOLDER_CODEING); + setStatus(ListStatus.CURRENT); + setMode(ListMode.WORKING); + } + + @Child(name = "designationType", type = {CodeableConcept.class}, order=1, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false) + @Extension(url = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/ihe-designationType", definedLocally = false, isModifier = false) + @Description(shortDefinition = "Clinical code of the List") + @Getter @Setter + private List designationType; + +} diff --git a/src/main/java/org/openehealth/app/xdstofhir/registry/common/mapper/XdsToFhirFolderMapper.java b/src/main/java/org/openehealth/app/xdstofhir/registry/common/mapper/XdsToFhirFolderMapper.java new file mode 100644 index 0000000..9ebc733 --- /dev/null +++ b/src/main/java/org/openehealth/app/xdstofhir/registry/common/mapper/XdsToFhirFolderMapper.java @@ -0,0 +1,38 @@ +package org.openehealth.app.xdstofhir.registry.common.mapper; + +import java.util.Collections; +import java.util.function.Function; +import java.util.stream.Collectors; + +import lombok.RequiredArgsConstructor; +import org.hl7.fhir.r4.model.Annotation; +import org.hl7.fhir.r4.model.Identifier; +import org.openehealth.app.xdstofhir.registry.common.MappingSupport; +import org.openehealth.app.xdstofhir.registry.common.fhir.MhdFolder; +import org.openehealth.ipf.commons.ihe.xds.core.metadata.Folder; +import org.springframework.stereotype.Component; + +@Component +@RequiredArgsConstructor +public class XdsToFhirFolderMapper extends AbstractXdsToFhirMapper + implements Function { + @Override + public MhdFolder apply(Folder xdFolder) { + var mhdList = new MhdFolder(); + mhdList.addIdentifier(fromIdentifier(xdFolder.getEntryUuid(), Identifier.IdentifierUse.OFFICIAL)); + mhdList.addIdentifier( + fromIdentifier(MappingSupport.OID_URN + xdFolder.getUniqueId(), Identifier.IdentifierUse.USUAL)); + mhdList.setSubject(patientReferenceFrom(xdFolder)); + mhdList.setDateElement(fromTimestamp(xdFolder.getLastUpdateTime())); + mhdList.setDesignationType(xdFolder.getCodeList().stream().map(this::fromCode).collect(Collectors.toList())); + if (xdFolder.getTitle() != null) + mhdList.setTitle(xdFolder.getTitle().getValue()); + if (xdFolder.getComments() != null) { + Annotation annotation = new Annotation(); + annotation.setText(xdFolder.getComments().getValue()); + mhdList.setNote(Collections.singletonList(annotation)); + } + return mhdList; + } + +} diff --git a/src/main/java/org/openehealth/app/xdstofhir/registry/query/StoredQueryProcessor.java b/src/main/java/org/openehealth/app/xdstofhir/registry/query/StoredQueryProcessor.java index 1920db0..090607c 100644 --- a/src/main/java/org/openehealth/app/xdstofhir/registry/query/StoredQueryProcessor.java +++ b/src/main/java/org/openehealth/app/xdstofhir/registry/query/StoredQueryProcessor.java @@ -10,8 +10,10 @@ import ca.uhn.fhir.rest.client.api.IGenericClient; import lombok.RequiredArgsConstructor; import org.hl7.fhir.r4.model.DocumentReference; +import org.openehealth.app.xdstofhir.registry.common.fhir.MhdFolder; import org.openehealth.app.xdstofhir.registry.common.fhir.MhdSubmissionSet; import org.openehealth.ipf.commons.ihe.xds.core.metadata.DocumentEntry; +import org.openehealth.ipf.commons.ihe.xds.core.metadata.Folder; import org.openehealth.ipf.commons.ihe.xds.core.metadata.ObjectReference; import org.openehealth.ipf.commons.ihe.xds.core.metadata.SubmissionSet; import org.openehealth.ipf.commons.ihe.xds.core.metadata.Version; @@ -34,6 +36,7 @@ public class StoredQueryProcessor implements Iti18Service { private final IGenericClient client; private final Function documentMapper; private final Function submissionMapper; + private final Function folderMapper; private static final Version DEFAULT_VERSION = new Version("1"); @Override @@ -45,11 +48,15 @@ public QueryResponse processQuery(QueryRegistry query) { var fhirDocuments = visitor.getDocumentsFromResult(); var fhirSubmissions = visitor.getSubmissionSetsFrom(); + var fhirFolder = visitor.getFoldersFrom(); var xdsDocuments = new ArrayList(); var xdsSubmissionSets = new ArrayList(); + var xdsFolders = new ArrayList(); + + int currentResourceCount = 0; for (DocumentReference document : fhirDocuments) { - if (xdsDocuments.size() > maxResultCount) { + if (currentResourceCount > maxResultCount) { response.setStatus(Status.PARTIAL_SUCCESS); response.setErrors(Collections.singletonList(new ErrorInfo(ErrorCode.TOO_MANY_RESULTS, "Result exceed maximum of " + maxResultCount, Severity.WARNING, null, null))); @@ -59,12 +66,12 @@ public QueryResponse processQuery(QueryRegistry query) { if (xdsDoc != null) { assignDefaultVersioning().accept(xdsDoc); xdsDocuments.add(xdsDoc); + currentResourceCount++; } - } for (MhdSubmissionSet submissionset : fhirSubmissions) { - if (xdsDocuments.size() + xdsSubmissionSets.size() > maxResultCount) { + if (currentResourceCount > maxResultCount) { response.setStatus(Status.PARTIAL_SUCCESS); response.setErrors(Collections.singletonList(new ErrorInfo(ErrorCode.TOO_MANY_RESULTS, "Result exceed maximum of " + maxResultCount, Severity.WARNING, null, null))); @@ -74,6 +81,22 @@ public QueryResponse processQuery(QueryRegistry query) { if (xdsSubmission != null) { assignDefaultVersioning().accept(xdsSubmission); xdsSubmissionSets.add(xdsSubmission); + currentResourceCount++; + } + } + + for (MhdFolder folder : fhirFolder) { + if (currentResourceCount > maxResultCount) { + response.setStatus(Status.PARTIAL_SUCCESS); + response.setErrors(Collections.singletonList(new ErrorInfo(ErrorCode.TOO_MANY_RESULTS, + "Result exceed maximum of " + maxResultCount, Severity.WARNING, null, null))); + break; + } + var xdsFolder = folderMapper.apply(folder); + if (xdsFolder != null) { + assignDefaultVersioning().accept(xdsFolder); + xdsFolders.add(xdsFolder); + currentResourceCount++; } } diff --git a/src/main/java/org/openehealth/app/xdstofhir/registry/query/StoredQueryVistorImpl.java b/src/main/java/org/openehealth/app/xdstofhir/registry/query/StoredQueryVistorImpl.java index 2c55555..e4ff863 100644 --- a/src/main/java/org/openehealth/app/xdstofhir/registry/query/StoredQueryVistorImpl.java +++ b/src/main/java/org/openehealth/app/xdstofhir/registry/query/StoredQueryVistorImpl.java @@ -27,6 +27,7 @@ import org.hl7.fhir.r4.model.Patient; import org.hl7.fhir.r4.model.codesystems.DocumentReferenceStatus; import org.openehealth.app.xdstofhir.registry.common.MappingSupport; +import org.openehealth.app.xdstofhir.registry.common.fhir.MhdFolder; import org.openehealth.app.xdstofhir.registry.common.fhir.MhdSubmissionSet; import org.openehealth.ipf.commons.ihe.xds.core.metadata.AvailabilityStatus; import org.openehealth.ipf.commons.ihe.xds.core.metadata.Code; @@ -65,6 +66,7 @@ public class StoredQueryVistorImpl implements Visitor { private IQuery documentFhirQuery; private IQuery submissionSetfhirQuery; + private IQuery folderFhirQuery; private final IGenericClient client; @@ -156,7 +158,13 @@ public void visit(FindDocumentsForMultiplePatientsQuery query) { @Override public void visit(FindFoldersQuery query) { - throw new UnsupportedOperationException("Not yet implemented"); + this.folderFhirQuery = client.search().forResource(MhdFolder.class) + .withProfile(MappingSupport.MHD_COMPREHENSIVE_FOLDER_PROFILE) + .where(MhdFolder.CODE.exactly() + .codings(MhdFolder.FOLDER_CODEING.getCodingFirstRep())) + .include(MhdFolder.INCLUDE_SUBJECT) + .returnBundle(Bundle.class); + mapPatientIdToQuery(query, folderFhirQuery); } @Override @@ -218,9 +226,16 @@ public void visit(GetAllQuery query) { .codings(MhdSubmissionSet.SUBMISSIONSET_CODEING.getCodingFirstRep())) .include(MhdSubmissionSet.INCLUDE_SUBJECT) .returnBundle(Bundle.class); + this.folderFhirQuery = client.search().forResource(MhdFolder.class) + .withProfile(MappingSupport.MHD_COMPREHENSIVE_FOLDER_PROFILE) + .where(MhdFolder.CODE.exactly() + .codings(MhdFolder.FOLDER_CODEING.getCodingFirstRep())) + .include(MhdFolder.INCLUDE_SUBJECT) + .returnBundle(Bundle.class); mapPatientIdToQuery(query, documentFhirQuery); mapPatientIdToQuery(query, submissionSetfhirQuery); + mapPatientIdToQuery(query, folderFhirQuery); } @Override @@ -315,6 +330,13 @@ public Iterable getSubmissionSetsFrom() { return () -> new PagingFhirResultIterator(submissionSetfhirQuery.execute(), MhdSubmissionSet.class); } + public Iterable getFoldersFrom() { + if (folderFhirQuery == null) { + return () -> Collections.emptyIterator(); + } + return () -> new PagingFhirResultIterator(folderFhirQuery.execute(), MhdFolder.class); + } + public class PagingFhirResultIterator implements Iterator { private Bundle resultBundle; diff --git a/src/main/java/org/openehealth/app/xdstofhir/registry/register/RegisterDocumentsProcessor.java b/src/main/java/org/openehealth/app/xdstofhir/registry/register/RegisterDocumentsProcessor.java index 31a8b81..80c78f9 100644 --- a/src/main/java/org/openehealth/app/xdstofhir/registry/register/RegisterDocumentsProcessor.java +++ b/src/main/java/org/openehealth/app/xdstofhir/registry/register/RegisterDocumentsProcessor.java @@ -16,10 +16,12 @@ import org.hl7.fhir.r4.model.Patient; import org.openehealth.app.xdstofhir.registry.common.MappingSupport; import org.openehealth.app.xdstofhir.registry.common.RegistryConfiguration; +import org.openehealth.app.xdstofhir.registry.common.fhir.MhdFolder; import org.openehealth.app.xdstofhir.registry.common.fhir.MhdSubmissionSet; import org.openehealth.ipf.commons.ihe.xds.core.metadata.AssociationType; import org.openehealth.ipf.commons.ihe.xds.core.metadata.AvailabilityStatus; import org.openehealth.ipf.commons.ihe.xds.core.metadata.DocumentEntry; +import org.openehealth.ipf.commons.ihe.xds.core.metadata.Folder; import org.openehealth.ipf.commons.ihe.xds.core.metadata.SubmissionSet; import org.openehealth.ipf.commons.ihe.xds.core.metadata.XDSMetaClass; import org.openehealth.ipf.commons.ihe.xds.core.requests.RegisterDocumentSet; @@ -36,6 +38,7 @@ public class RegisterDocumentsProcessor implements Iti42Service { private final IGenericClient client; private final Function documentMapper; private final Function submissionSetMapper; + private final Function folderMapper; private final RegistryConfiguration registryConfig; @Override @@ -45,6 +48,8 @@ public Response processRegister(RegisterDocumentSet register) { validateKnownRepository(register); register.getDocumentEntries().forEach(this::assignRegistryValues); register.getDocumentEntries().forEach(this::assignPatientId); + register.getFolders().forEach(this::assignRegistryValues); + register.getFolders().forEach(this::assignPatientId); assignPatientId(register.getSubmissionSet()); assignRegistryValues(register.getSubmissionSet()); register.getAssociations().stream().filter(assoc -> assoc.getAssociationType() == AssociationType.REPLACE) @@ -54,6 +59,7 @@ public Response processRegister(RegisterDocumentSet register) { .orElseThrow(() -> new XDSMetaDataException(ValidationMessage.UNRESOLVED_REFERENCE, assoc.getSourceUuid()))))); register.getDocumentEntries().forEach(doc -> builder.addTransactionCreateEntry(documentMapper.apply(doc))); + register.getFolders().forEach(folder -> builder.addTransactionCreateEntry(folderMapper.apply(folder))); builder.addTransactionCreateEntry(submissionSetMapper.apply(register.getSubmissionSet())); // Execute the transaction diff --git a/src/main/resources/profiles/StructureDefinition-IHE.MHD.Comprehensive.Folder.json b/src/main/resources/profiles/StructureDefinition-IHE.MHD.Comprehensive.Folder.json new file mode 100644 index 0000000..5dc149e --- /dev/null +++ b/src/main/resources/profiles/StructureDefinition-IHE.MHD.Comprehensive.Folder.json @@ -0,0 +1,1662 @@ +{ + "resourceType" : "StructureDefinition", + "id" : "IHE.MHD.Comprehensive.Folder", + "text" : { + "status" : "extensions", + "div" : "
\r\n\r\n\r\n\r\n\r\n
NameFlagsCard.TypeDescription & Constraints\"doco\"
\".\"\".\" List 0..*FolderA list is a curated collection of resources
\".\"\".\"\".\" extension 1..*ExtensionExtension
\".\"\".\"\".\" extension:designationType 1..*DesignationTypeClinical code of the List
\".\"\".\"\".\" title 1..1stringDescriptive name for the list
\".\"\".\"\".\" subject 1..1Reference(Patient)If all resources have the same subject

\"doco\" Documentation for this format
" + }, + "url" : "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.Comprehensive.Folder", + "version" : "4.2.2-current", + "name" : "FolderComprehensive", + "title" : "MHD Folder Comprehensive", + "status" : "active", + "date" : "2023-11-22T17:43:57+00:00", + "publisher" : "IHE IT Infrastructure Technical Committee", + "contact" : [{ + "telecom" : [{ + "system" : "url", + "value" : "https://www.ihe.net/ihe_domains/it_infrastructure/" + }] + }, + { + "telecom" : [{ + "system" : "email", + "value" : "iti@ihe.net" + }] + }, + { + "name" : "IHE IT Infrastructure Technical Committee", + "telecom" : [{ + "system" : "email", + "value" : "iti@ihe.net" + }] + }], + "description" : "A profile on the List resource for MHD Comprehensive Metadata Folder. Note UnContained has no impact on Folder.\n- MHD is based on the [IHE Document Sharing](https://profiles.ihe.net/ITI/HIE-Whitepaper/index.html) model, \n- the [3:4.1 Abstract Metadata Model](https://profiles.ihe.net/ITI/TF/Volume3/ch-4.1.html#4.1), and \n- the use defined here is FHIR List for use as a Folder implementation of the \n- ebRIM implementation at [3:4.2.3.4 Folder Attributes](https://profiles.ihe.net/ITI/TF/Volume3/ch-4.2.html#4.2.3.4).\n- with use-cases and constraints found in [3:4.3 Additional Document Sharing Requirements](https://profiles.ihe.net/ITI/TF/Volume3/ch-4.3.html#4.3)", + "jurisdiction" : [{ + "coding" : [{ + "system" : "http://unstats.un.org/unsd/methods/m49/m49.htm", + "code" : "001" + }] + }], + "fhirVersion" : "4.0.1", + "mapping" : [{ + "identity" : "rim", + "uri" : "http://hl7.org/v3", + "name" : "RIM Mapping" + }, + { + "identity" : "w5", + "uri" : "http://hl7.org/fhir/fivews", + "name" : "FiveWs Pattern Mapping" + }, + { + "identity" : "Folder-Mapping", + "uri" : "XDS", + "name" : "XDS and MHD Mapping" + }], + "kind" : "resource", + "abstract" : false, + "type" : "List", + "baseDefinition" : "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.Minimal.Folder", + "derivation" : "constraint", + "snapshot" : { + "element" : [{ + "id" : "List", + "path" : "List", + "short" : "A list is a curated collection of resources", + "definition" : "A list is a curated collection of resources.", + "alias" : ["Collection", + "WorkingList", + "Organizer"], + "min" : 0, + "max" : "*", + "base" : { + "path" : "List", + "min" : 0, + "max" : "*" + }, + "constraint" : [{ + "key" : "dom-2", + "severity" : "error", + "human" : "If the resource is contained in another resource, it SHALL NOT contain nested Resources", + "expression" : "contained.contained.empty()", + "xpath" : "not(parent::f:contained and f:contained)", + "source" : "http://hl7.org/fhir/StructureDefinition/DomainResource" + }, + { + "key" : "dom-3", + "severity" : "error", + "human" : "If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource or SHALL refer to the containing resource", + "expression" : "contained.where((('#'+id in (%resource.descendants().reference | %resource.descendants().as(canonical) | %resource.descendants().as(uri) | %resource.descendants().as(url))) or descendants().where(reference = '#').exists() or descendants().where(as(canonical) = '#').exists() or descendants().where(as(canonical) = '#').exists()).not()).trace('unmatched', id).empty()", + "xpath" : "not(exists(for $id in f:contained/*/f:id/@value return $contained[not(parent::*/descendant::f:reference/@value=concat('#', $contained/*/id/@value) or descendant::f:reference[@value='#'])]))", + "source" : "http://hl7.org/fhir/StructureDefinition/DomainResource" + }, + { + "key" : "dom-4", + "severity" : "error", + "human" : "If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated", + "expression" : "contained.meta.versionId.empty() and contained.meta.lastUpdated.empty()", + "xpath" : "not(exists(f:contained/*/f:meta/f:versionId)) and not(exists(f:contained/*/f:meta/f:lastUpdated))", + "source" : "http://hl7.org/fhir/StructureDefinition/DomainResource" + }, + { + "key" : "dom-5", + "severity" : "error", + "human" : "If a resource is contained in another resource, it SHALL NOT have a security label", + "expression" : "contained.meta.security.empty()", + "xpath" : "not(exists(f:contained/*/f:meta/f:security))", + "source" : "http://hl7.org/fhir/StructureDefinition/DomainResource" + }, + { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bestpractice", + "valueBoolean" : true + }, + { + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bestpractice-explanation", + "valueMarkdown" : "When a resource has no narrative, only systems that fully understand the data can display the resource to a human safely. Including a human readable representation in the resource makes for a much more robust eco-system and cheaper handling of resources by intermediary systems. Some ecosystems restrict distribution of resources to only those systems that do fully understand the resources, and as a consequence implementers may believe that the narrative is superfluous. However experience shows that such eco-systems often open up to new participants over time." + }], + "key" : "dom-6", + "severity" : "warning", + "human" : "A resource should have narrative for robust management", + "expression" : "text.`div`.exists()", + "xpath" : "exists(f:text/h:div)", + "source" : "http://hl7.org/fhir/StructureDefinition/DomainResource" + }, + { + "key" : "lst-1", + "severity" : "error", + "human" : "A list can only have an emptyReason if it is empty", + "expression" : "emptyReason.empty() or entry.empty()", + "xpath" : "not(exists(f:emptyReason) and exists(f:entry))", + "source" : "http://hl7.org/fhir/StructureDefinition/List" + }, + { + "key" : "lst-2", + "severity" : "error", + "human" : "The deleted flag can only be used if the mode of the list is \"changes\"", + "expression" : "mode = 'changes' or entry.deleted.empty()", + "xpath" : "(f:mode/@value = 'changes') or not(exists(f:entry/f:deleted))", + "source" : "http://hl7.org/fhir/StructureDefinition/List" + }, + { + "key" : "lst-3", + "severity" : "error", + "human" : "An entry date can only be used if the mode of the list is \"working\"", + "expression" : "mode = 'working' or entry.date.empty()", + "xpath" : "(f:mode/@value = 'working') or not(exists(f:entry/f:date))", + "source" : "http://hl7.org/fhir/StructureDefinition/List" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : "Entity. Role, or Act" + }, + { + "identity" : "rim", + "map" : "Act[classCode id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true + }, + { + "id" : "List.meta.id", + "path" : "List.meta.id", + "representation" : ["xmlAttr"], + "short" : "Unique id for inter-element referencing", + "definition" : "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "Element.id", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type", + "valueUrl" : "string" + }], + "code" : "http://hl7.org/fhirpath/System.String" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : "n/a" + }] + }, + { + "id" : "List.meta.extension", + "path" : "List.meta.extension", + "slicing" : { + "discriminator" : [{ + "type" : "value", + "path" : "url" + }], + "description" : "Extensions are always sliced by (at least) url", + "rules" : "open" + }, + "short" : "Additional content defined by implementations", + "definition" : "May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", + "comment" : "There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone.", + "alias" : ["extensions", + "user content"], + "min" : 0, + "max" : "*", + "base" : { + "path" : "Element.extension", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Extension" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key" : "ext-1", + "severity" : "error", + "human" : "Must have either extensions or value[x], not both", + "expression" : "extension.exists() != value.exists()", + "xpath" : "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source" : "http://hl7.org/fhir/StructureDefinition/Extension" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : "n/a" + }] + }, + { + "id" : "List.meta.versionId", + "path" : "List.meta.versionId", + "short" : "Version specific identifier", + "definition" : "The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.", + "comment" : "The server assigns this value, and ignores what the client specifies, except in the case that the server is imposing version integrity on updates/deletes.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "Meta.versionId", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "id" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true + }, + { + "id" : "List.meta.lastUpdated", + "path" : "List.meta.lastUpdated", + "short" : "When the resource version last changed", + "definition" : "When the resource last changed - e.g. when the version changed.", + "comment" : "This value is always populated except when the resource is first being created. The server / resource manager sets this value; what a client provides is irrelevant. This is equivalent to the HTTP Last-Modified and SHOULD have the same value on a [read](http://hl7.org/fhir/R4/http.html#read) interaction.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "Meta.lastUpdated", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "instant" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true + }, + { + "id" : "List.meta.source", + "path" : "List.meta.source", + "short" : "Identifies where the resource comes from", + "definition" : "A uri that identifies the source system of the resource. This provides a minimal amount of [Provenance](provenance.html#) information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.", + "comment" : "In the provenance resource, this corresponds to Provenance.entity.what[x]. The exact use of the source (and the implied Provenance.entity.role) is left to implementer discretion. Only one nominated source is allowed; for additional provenance details, a full Provenance resource should be used. \n\nThis element can be used to indicate where the current master source of a resource that has a canonical URL if the resource is no longer hosted at the canonical URL.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "Meta.source", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "uri" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true + }, + { + "id" : "List.meta.profile", + "path" : "List.meta.profile", + "short" : "Profiles this resource claims to conform to", + "definition" : "A list of profiles (references to [StructureDefinition](structuredefinition.html#) resources) that this resource claims to conform to. The URL is a reference to [StructureDefinition.url](structuredefinition-definitions.html#StructureDefinition.url).", + "comment" : "It is up to the server and/or other infrastructure of policy to determine whether/how these claims are verified and/or updated over time. The list of profile URLs is a set.", + "min" : 0, + "max" : "*", + "base" : { + "path" : "Meta.profile", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "canonical", + "targetProfile" : ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true, + "mapping" : [{ + "identity" : "Folder-Mapping", + "map" : "Folder.limitedMetadata" + }] + }, + { + "id" : "List.meta.security", + "path" : "List.meta.security", + "short" : "Security Labels applied to this resource", + "definition" : "Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure.", + "comment" : "The security labels can be updated without changing the stated version of the resource. The list of security labels is a set. Uniqueness is based the system/code, and version and display are ignored.", + "min" : 0, + "max" : "*", + "base" : { + "path" : "Meta.security", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Coding" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true, + "binding" : { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString" : "SecurityLabels" + }], + "strength" : "extensible", + "description" : "Security Labels from the Healthcare Privacy and Security Classification System.", + "valueSet" : "http://hl7.org/fhir/ValueSet/security-labels" + } + }, + { + "id" : "List.meta.tag", + "path" : "List.meta.tag", + "short" : "Tags applied to this resource", + "definition" : "Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource.", + "comment" : "The tags can be updated without changing the stated version of the resource. The list of tags is a set. Uniqueness is based the system/code, and version and display are ignored.", + "min" : 0, + "max" : "*", + "base" : { + "path" : "Meta.tag", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Coding" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true, + "binding" : { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString" : "Tags" + }], + "strength" : "example", + "description" : "Codes that represent various types of tags, commonly workflow-related; e.g. \"Needs review by Dr. Jones\".", + "valueSet" : "http://hl7.org/fhir/ValueSet/common-tags" + } + }, + { + "id" : "List.implicitRules", + "path" : "List.implicitRules", + "short" : "A set of rules under which this content was created", + "definition" : "A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.", + "comment" : "Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of it's narrative along with other profiles, value sets, etc.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "Resource.implicitRules", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "uri" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : true, + "isModifierReason" : "This element is labeled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation", + "isSummary" : true + }, + { + "id" : "List.language", + "path" : "List.language", + "short" : "Language of the resource content", + "definition" : "The base language in which the resource is written.", + "comment" : "Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource. Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute).", + "min" : 0, + "max" : "1", + "base" : { + "path" : "Resource.language", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "code" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : false, + "binding" : { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet", + "valueCanonical" : "http://hl7.org/fhir/ValueSet/all-languages" + }, + { + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString" : "Language" + }], + "strength" : "preferred", + "description" : "A human language.", + "valueSet" : "http://hl7.org/fhir/ValueSet/languages" + } + }, + { + "id" : "List.text", + "path" : "List.text", + "short" : "Text summary of the resource, for human interpretation", + "definition" : "A human-readable narrative that contains a summary of the resource and can be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it \"clinically safe\" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.", + "comment" : "Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied). This may be necessary for data from legacy systems where information is captured as a \"text blob\" or where text is additionally entered raw or narrated and encoded information is added later.", + "alias" : ["narrative", + "html", + "xhtml", + "display"], + "min" : 0, + "max" : "1", + "base" : { + "path" : "DomainResource.text", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "Narrative" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : "Act.text?" + }] + }, + { + "id" : "List.contained", + "path" : "List.contained", + "short" : "Contained, inline Resources", + "definition" : "These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.", + "comment" : "This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. Contained resources may have profiles and tags In their meta elements, but SHALL NOT have security labels.", + "alias" : ["inline resources", + "anonymous resources", + "contained resources"], + "min" : 0, + "max" : "*", + "base" : { + "path" : "DomainResource.contained", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Resource" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : "N/A" + }] + }, + { + "id" : "List.extension", + "path" : "List.extension", + "slicing" : { + "discriminator" : [{ + "type" : "value", + "path" : "url" + }], + "ordered" : false, + "rules" : "open" + }, + "short" : "Extension", + "definition" : "An Extension", + "min" : 1, + "max" : "*", + "base" : { + "path" : "DomainResource.extension", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Extension" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key" : "ext-1", + "severity" : "error", + "human" : "Must have either extensions or value[x], not both", + "expression" : "extension.exists() != value.exists()", + "xpath" : "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source" : "http://hl7.org/fhir/StructureDefinition/Extension" + }], + "isModifier" : false, + "isSummary" : false + }, + { + "id" : "List.extension:designationType", + "path" : "List.extension", + "sliceName" : "designationType", + "short" : "Clinical code of the List", + "definition" : "Expresses contentType of submissionSet or the codeList of a Folder. Usually expressed in LOINC or SNOMED.", + "min" : 1, + "max" : "*", + "base" : { + "path" : "DomainResource.extension", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Extension", + "profile" : ["https://profiles.ihe.net/ITI/MHD/StructureDefinition/ihe-designationType"] + }], + "condition" : ["ele-1"], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key" : "ext-1", + "severity" : "error", + "human" : "Must have either extensions or value[x], not both", + "expression" : "extension.exists() != value.exists()", + "xpath" : "exists(f:extension)!=exists(f:*[starts-with(local-name(.), 'value')])", + "source" : "http://hl7.org/fhir/StructureDefinition/Extension" + }], + "mustSupport" : true, + "isModifier" : false + }, + { + "id" : "List.modifierExtension", + "path" : "List.modifierExtension", + "short" : "Extension", + "definition" : "An Extension", + "min" : 0, + "max" : "0", + "base" : { + "path" : "DomainResource.modifierExtension", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Extension" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key" : "ext-1", + "severity" : "error", + "human" : "Must have either extensions or value[x], not both", + "expression" : "extension.exists() != value.exists()", + "xpath" : "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source" : "http://hl7.org/fhir/StructureDefinition/Extension" + }], + "isModifier" : true, + "isModifierReason" : "Modifier extensions are expected to modify the meaning or interpretation of the resource that contains them", + "isSummary" : false + }, + { + "id" : "List.identifier", + "path" : "List.identifier", + "slicing" : { + "discriminator" : [{ + "type" : "value", + "path" : "use" + }], + "rules" : "open" + }, + "short" : "Business identifier", + "definition" : "Identifier for the List assigned for business purposes outside the context of FHIR.", + "min" : 0, + "max" : "*", + "base" : { + "path" : "List.identifier", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Identifier" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "w5", + "map" : "FiveWs.identifier" + }, + { + "identity" : "rim", + "map" : ".id" + }, + { + "identity" : "Folder-Mapping", + "map" : "Folder.entryUUID and Folder.uniqueId" + }] + }, + { + "id" : "List.identifier:uniqueId", + "path" : "List.identifier", + "sliceName" : "uniqueId", + "short" : "An identifier intended for computation", + "definition" : "An identifier - identifies some entity uniquely and unambiguously. Typically this is used for business identifiers.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "List.identifier", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Identifier", + "profile" : ["https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.UniqueIdIdentifier"] + }], + "condition" : ["ele-1"], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "mapping" : [{ + "identity" : "rim", + "map" : "n/a" + }, + { + "identity" : "v2", + "map" : "CX / EI (occasionally, more often EI maps to a resource id or a URL)" + }, + { + "identity" : "rim", + "map" : "II - The Identifier class is a little looser than the v3 type II because it allows URIs as well as registered OIDs or GUIDs. Also maps to Role[classCode=IDENT]" + }, + { + "identity" : "servd", + "map" : "Identifier" + }] + }, + { + "id" : "List.identifier:entryUUID", + "path" : "List.identifier", + "sliceName" : "entryUUID", + "short" : "An identifier intended for computation", + "definition" : "An identifier - identifies some entity uniquely and unambiguously. Typically this is used for business identifiers.", + "min" : 0, + "max" : "*", + "base" : { + "path" : "List.identifier", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Identifier", + "profile" : ["https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.EntryUUID.Identifier"] + }], + "condition" : ["ele-1"], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "mapping" : [{ + "identity" : "rim", + "map" : "n/a" + }, + { + "identity" : "v2", + "map" : "CX / EI (occasionally, more often EI maps to a resource id or a URL)" + }, + { + "identity" : "rim", + "map" : "II - The Identifier class is a little looser than the v3 type II because it allows URIs as well as registered OIDs or GUIDs. Also maps to Role[classCode=IDENT]" + }, + { + "identity" : "servd", + "map" : "Identifier" + }] + }, + { + "id" : "List.status", + "path" : "List.status", + "short" : "current | retired | entered-in-error", + "definition" : "Indicates the current state of this list.", + "comment" : "This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid.", + "min" : 1, + "max" : "1", + "base" : { + "path" : "List.status", + "min" : 1, + "max" : "1" + }, + "type" : [{ + "code" : "code" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : true, + "isModifierReason" : "This element is labeled as a modifier because it is a status element that contains status entered-in-error which means that the resource should not be treated as valid", + "isSummary" : true, + "binding" : { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString" : "ListStatus" + }], + "strength" : "required", + "description" : "The current state of the list.", + "valueSet" : "http://hl7.org/fhir/ValueSet/list-status|4.0.1" + }, + "mapping" : [{ + "identity" : "w5", + "map" : "FiveWs.status" + }, + { + "identity" : "rim", + "map" : ".status[current=active;retired=obsolete;entered-in-error=nullified]" + }, + { + "identity" : "Folder-Mapping", + "map" : "Folder.availabilityStatus" + }] + }, + { + "id" : "List.mode", + "path" : "List.mode", + "short" : "working | snapshot | changes", + "definition" : "How this list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.", + "comment" : "This element is labeled as a modifier because a change list must not be misunderstood as a complete list.", + "requirements" : "Lists are used in various ways, and it must be known in what way it is safe to use them.", + "min" : 1, + "max" : "1", + "base" : { + "path" : "List.mode", + "min" : 1, + "max" : "1" + }, + "type" : [{ + "code" : "code" + }], + "patternCode" : "working", + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : true, + "isModifierReason" : "If set to \"changes\", the list is considered incomplete, while the other two codes indicate the list is complete, which changes the understanding of the elements listed", + "isSummary" : true, + "binding" : { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString" : "ListMode" + }], + "strength" : "required", + "description" : "The processing mode that applies to this list.", + "valueSet" : "http://hl7.org/fhir/ValueSet/list-mode|4.0.1" + }, + "mapping" : [{ + "identity" : "w5", + "map" : "FiveWs.class" + }, + { + "identity" : "rim", + "map" : ".outBoundRelationship[typeCode=COMP].target[classCode=OBS\"].value" + }, + { + "identity" : "Folder-Mapping", + "map" : "shall be 'working'" + }] + }, + { + "id" : "List.title", + "path" : "List.title", + "short" : "Descriptive name for the list", + "definition" : "A label for the list assigned by the author.", + "requirements" : "Allows customization beyond just the code identifying the kind of list.", + "min" : 1, + "max" : "1", + "base" : { + "path" : "List.title", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "string" + }], + "example" : [{ + "label" : "General", + "valueString" : "Dr. Jane's Patients" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true, + "mapping" : [{ + "identity" : "rim", + "map" : ".title" + }, + { + "identity" : "Folder-Mapping", + "map" : "Folder.title" + }] + }, + { + "id" : "List.code", + "path" : "List.code", + "short" : "What the purpose of this list is", + "definition" : "This code defines the purpose of the list - why it was created.", + "comment" : "If there is no code, the purpose of the list is implied where it is used, such as in a document section using Document.section.code.", + "requirements" : "Lists often contain subsets of resources rather than an exhaustive list. The code identifies what type of subset is included.", + "min" : 1, + "max" : "1", + "base" : { + "path" : "List.code", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "CodeableConcept" + }], + "patternCodeableConcept" : { + "coding" : [{ + "system" : "https://profiles.ihe.net/ITI/MHD/CodeSystem/MHDlistTypes", + "code" : "folder" + }] + }, + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true, + "binding" : { + "strength" : "required", + "valueSet" : "https://profiles.ihe.net/ITI/MHD/ValueSet/MHDlistTypesVS" + }, + "mapping" : [{ + "identity" : "w5", + "map" : "FiveWs.what[x]" + }, + { + "identity" : "rim", + "map" : ".code" + }, + { + "identity" : "Folder-Mapping", + "map" : "shall be 'folder'" + }] + }, + { + "id" : "List.subject", + "path" : "List.subject", + "short" : "If all resources have the same subject", + "definition" : "The common subject (or patient) of the resources that are in the list if there is one.", + "comment" : "Some purely arbitrary lists do not have a common subject, so this is optional.", + "requirements" : "The primary purpose of listing the subject explicitly is to help with finding the right list.", + "min" : 1, + "max" : "1", + "base" : { + "path" : "List.subject", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "Reference", + "targetProfile" : ["http://hl7.org/fhir/StructureDefinition/Patient"] + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "mustSupport" : true, + "isModifier" : false, + "isSummary" : true, + "mapping" : [{ + "identity" : "w5", + "map" : "FiveWs.subject[x]" + }, + { + "identity" : "rim", + "map" : ".participation[typeCode id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "w5", + "map" : "FiveWs.context" + }, + { + "identity" : "rim", + "map" : "inboundRelationship[typeCode=COMP].source[classCode=ENC, moodCode=EVN]" + }, + { + "identity" : "Folder-Mapping", + "map" : "n/a" + }] + }, + { + "id" : "List.date", + "path" : "List.date", + "short" : "When the list was prepared", + "definition" : "The date that the list was prepared.", + "comment" : "The actual important date is the date of currency of the resources that were summarized, but it is usually assumed that these are current when the preparation occurs.", + "requirements" : "Identifies how current the list is which affects relevance.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "List.date", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "dateTime" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true, + "mapping" : [{ + "identity" : "w5", + "map" : "FiveWs.recorded" + }, + { + "identity" : "rim", + "map" : ".participation[typeCode id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true, + "mapping" : [{ + "identity" : "w5", + "map" : "FiveWs.author" + }, + { + "identity" : "rim", + "map" : ".participation[typeCode id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : false, + "binding" : { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString" : "ListOrder" + }], + "strength" : "preferred", + "description" : "What order applies to the items in a list.", + "valueSet" : "http://hl7.org/fhir/ValueSet/list-order" + }, + "mapping" : [{ + "identity" : "rim", + "map" : ".outboundRelationship[typeCode=COMP].sequenceNumber > 1" + }, + { + "identity" : "Folder-Mapping", + "map" : "n/a" + }] + }, + { + "id" : "List.note", + "path" : "List.note", + "short" : "Comments about the list", + "definition" : "Comments that apply to the overall list.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "List.note", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Annotation" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : ".inboundRelationship[typeCode=SUBJ].act.text" + }, + { + "identity" : "Folder-Mapping", + "map" : "Folder.comments" + }] + }, + { + "id" : "List.entry", + "path" : "List.entry", + "short" : "Entries in the list", + "definition" : "Entries in this list.", + "comment" : "If there are no entries in the list, an emptyReason SHOULD be provided.", + "min" : 0, + "max" : "*", + "base" : { + "path" : "List.entry", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "BackboneElement" + }], + "condition" : ["lst-1"], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : ".outboundRelationship[typeCode=COMP] or .participation[typeCode=SBJ]" + }] + }, + { + "id" : "List.entry.id", + "path" : "List.entry.id", + "representation" : ["xmlAttr"], + "short" : "Unique id for inter-element referencing", + "definition" : "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "Element.id", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type", + "valueUrl" : "string" + }], + "code" : "http://hl7.org/fhirpath/System.String" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : "n/a" + }] + }, + { + "id" : "List.entry.extension", + "path" : "List.entry.extension", + "short" : "Additional content defined by implementations", + "definition" : "May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", + "comment" : "There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone.", + "alias" : ["extensions", + "user content"], + "min" : 0, + "max" : "*", + "base" : { + "path" : "Element.extension", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Extension" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key" : "ext-1", + "severity" : "error", + "human" : "Must have either extensions or value[x], not both", + "expression" : "extension.exists() != value.exists()", + "xpath" : "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source" : "http://hl7.org/fhir/StructureDefinition/Extension" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : "n/a" + }] + }, + { + "id" : "List.entry.modifierExtension", + "path" : "List.entry.modifierExtension", + "short" : "Extensions that cannot be ignored even if unrecognized", + "definition" : "May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.\n\nModifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + "comment" : "There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone.", + "requirements" : "Modifier extensions allow for extensions that *cannot* be safely ignored to be clearly distinguished from the vast majority of extensions which can be safely ignored. This promotes interoperability by eliminating the need for implementers to prohibit the presence of extensions. For further information, see the [definition of modifier extensions](http://hl7.org/fhir/R4/extensibility.html#modifierExtension).", + "alias" : ["extensions", + "user content", + "modifiers"], + "min" : 0, + "max" : "*", + "base" : { + "path" : "BackboneElement.modifierExtension", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Extension" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key" : "ext-1", + "severity" : "error", + "human" : "Must have either extensions or value[x], not both", + "expression" : "extension.exists() != value.exists()", + "xpath" : "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source" : "http://hl7.org/fhir/StructureDefinition/Extension" + }], + "isModifier" : true, + "isModifierReason" : "Modifier extensions are expected to modify the meaning or interpretation of the element that contains them", + "isSummary" : true, + "mapping" : [{ + "identity" : "rim", + "map" : "N/A" + }] + }, + { + "id" : "List.entry.flag", + "path" : "List.entry.flag", + "short" : "Status/Workflow information about this item", + "definition" : "The flag allows the system constructing the list to indicate the role and significance of the item in the list.", + "comment" : "The flag can only be understood in the context of the List.code. If the flag means that the entry has actually been deleted from the list, the deleted element SHALL be true. Deleted can only be used if the List.mode is \"changes\".", + "requirements" : "This field is present to support various clinical uses of lists, such as a discharge summary medication list, where flags specify whether the medication was added, modified, or deleted from the list.", + "min" : 0, + "max" : "0", + "base" : { + "path" : "List.entry.flag", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "CodeableConcept" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : false, + "binding" : { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString" : "ListItemFlag" + }], + "strength" : "example", + "description" : "Codes that provide further information about the reason and meaning of the item in the list.", + "valueSet" : "http://hl7.org/fhir/ValueSet/list-item-flag" + }, + "mapping" : [{ + "identity" : "rim", + "map" : ".outBoundRelationship[typeCode=COMP].target[classCode=OBS\"].value" + }, + { + "identity" : "Folder-Mapping", + "map" : "n/a" + }] + }, + { + "id" : "List.entry.deleted", + "path" : "List.entry.deleted", + "short" : "If this item is actually marked as deleted", + "definition" : "True if this item is marked as deleted in the list.", + "comment" : "If the flag means that the entry has actually been deleted from the list, the deleted element SHALL be true. Both flag and deleted can only be used if the List.mode is \"changes\". A deleted entry should be displayed in narrative as deleted. This element is labeled as a modifier because it indicates that an item is (to be) no longer in the list.", + "requirements" : "The flag element may contain codes that an application processing the list does not understand. However there can be no ambiguity if a list item is actually marked as \"deleted\".", + "min" : 0, + "max" : "0", + "base" : { + "path" : "List.entry.deleted", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "boolean" + }], + "meaningWhenMissing" : "List items are generally only treated as deleted when this element explicitly carries a value of true. Systems SHOULD always populate this value when mode is 'changes'", + "condition" : ["lst-2"], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : true, + "isModifierReason" : "If deleted is true, then the item included in the list isn't actually part of the list anymore", + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : "added: .updateMode=(\"A\",\"AR\") retained: .updateMode=\"NC\" updated: .updateMode=\"R\" deleted: .updateMode=\"D\"" + }, + { + "identity" : "Folder-Mapping", + "map" : "n/a" + }] + }, + { + "id" : "List.entry.date", + "path" : "List.entry.date", + "short" : "When item added to list", + "definition" : "When this item was added to the list.", + "requirements" : "The date may be significant for understanding the meaning of items in a working list.", + "min" : 0, + "max" : "0", + "base" : { + "path" : "List.entry.date", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "dateTime" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : ".availabilityTime" + }, + { + "identity" : "Folder-Mapping", + "map" : "n/a" + }] + }, + { + "id" : "List.entry.item", + "path" : "List.entry.item", + "short" : "Actual entry", + "definition" : "A reference to the actual resource from which data was derived.", + "min" : 1, + "max" : "1", + "base" : { + "path" : "List.entry.item", + "min" : 1, + "max" : "1" + }, + "type" : [{ + "code" : "Reference", + "targetProfile" : ["http://hl7.org/fhir/StructureDefinition/DocumentReference"] + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : ".target or .role or .role.entity" + }, + { + "identity" : "Folder-Mapping", + "map" : "references to DocumentReference(s)" + }] + }, + { + "id" : "List.emptyReason", + "path" : "List.emptyReason", + "short" : "Why list is empty", + "definition" : "If the list is empty, why the list is empty.", + "comment" : "The various reasons for an empty list make a significant interpretation to its interpretation. Note that this code is for use when the entire list has been suppressed, and not for when individual items are omitted - implementers may consider using a text note or a flag on an entry in these cases.", + "requirements" : "Allows capturing things like \"none exist\" or \"not asked\" which can be important for most lists.", + "min" : 0, + "max" : "0", + "base" : { + "path" : "List.emptyReason", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "CodeableConcept" + }], + "condition" : ["lst-1"], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : false, + "binding" : { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString" : "ListEmptyReason" + }], + "strength" : "preferred", + "description" : "If a list is empty, why it is empty.", + "valueSet" : "http://hl7.org/fhir/ValueSet/list-empty-reason" + }, + "mapping" : [{ + "identity" : "rim", + "map" : ".inboundRelationship[typeCode=SUBJ,code xdsToFire; + private Function fireToXds; + + @BeforeEach + public void setupTestClass() { + xdsToFire = new XdsToFhirFolderMapper(); + fireToXds = new FhirToXdsFolderMapper(); + } + + @Test + void verifyBirectionalMapping() throws JAXBException { + Folder testFolder = SampleData + .createFolder(new Identifiable("123", new AssigningAuthority("2.999.3.4"))); + verifyFhirXdsMapping(testFolder); + } + + private void verifyFhirXdsMapping(Folder testFolder) throws JAXBException { + MhdFolder mappedFhirFolder = xdsToFire.apply(testFolder); + Folder reverseMappedFolder = fireToXds.apply(mappedFhirFolder); + String transformedFolder = XmlUtils.renderJaxb(JAXBContext.newInstance(Folder.class), reverseMappedFolder, + true); + String originalFolder = XmlUtils.renderJaxb(JAXBContext.newInstance(Folder.class), testFolder, + true); + assertEquals(originalFolder, transformedFolder); + } + +}