use of org.hl7.v3.II in project kindling by HL7.
the class CDAGenerator method buildInfrastructureRoot.
private void buildInfrastructureRoot() throws DefinitionException {
StructureDefinition sd = new StructureDefinition();
sd.setId("InfrastructureRoot");
sd.setUrl("http://hl7.org/fhir/cda/StructureDefinition/InfrastructureRoot");
library.put(sd.getUrl(), sd);
sd.setName("Base Type for all classes in the CDA structure");
sd.setTitle("InfrastructureRoot");
sd.setStatus(PublicationStatus.ACTIVE);
sd.setExperimental(false);
sd.setPublisher("HL7");
sd.setDescription("Defines the base elements and attributes on all CDA elements (other than data types)");
sd.setKind(StructureDefinitionKind.LOGICAL);
sd.setType(sd.getUrl());
sd.setAbstract(true);
sd.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("urn:hl7-org:v3"));
sd.setBaseDefinition("http://hl7.org/fhir/cda/StructureDefinition/ANY");
sd.setDerivation(TypeDerivationRule.SPECIALIZATION);
ElementDefinition edb = new ElementDefinition();
edb.setPath(sd.getId());
seePath(edb);
edb.setMin(1);
edb.setMax("*");
edb.addType().setCode("Element");
sd.getDifferential().getElement().add(edb);
ElementDefinition ed = new ElementDefinition();
ed.setPath("InfrastructureRoot.realmCode");
seePath(ed);
ed.setMin(0);
ed.setMax("*");
ed.setDefinition("When valued in an instance, this attribute signals the imposition of realm-specific constraints. The value of this attribute identifies the realm in question");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/CS");
sd.getDifferential().getElement().add(ed);
ed = new ElementDefinition();
ed.setPath("InfrastructureRoot.typeId");
seePath(ed);
ed.setMin(0);
ed.setMax("1");
ed.setDefinition("When valued in an instance, this attribute signals the imposition of constraints defined in an HL7-specified message type. This might be a common type (also known as CMET in the messaging communication environment), or content included within a wrapper. The value of this attribute provides a unique identifier for the type in question.");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/II");
sd.getDifferential().getElement().add(ed);
ed = new ElementDefinition();
ed.setPath("InfrastructureRoot.templateId");
seePath(ed);
ed.setMin(0);
ed.setMax("*");
ed.setDefinition("When valued in an instance, this attribute signals the imposition of a set of template-defined constraints. The value of this attribute provides a unique identifier for the templates in question");
ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/II");
sd.getDifferential().getElement().add(ed);
new ProfileUtilities(null, null, null).setIds(sd, true);
structures.add(sd);
}
use of org.hl7.v3.II in project ipf by oehf.
the class IiEqualFunction method handle.
@Override
public Object handle(Object... args) throws FunctionProcessingException {
if (args.length != 2) {
throw new FunctionProcessingException("Invalid number of parameters.");
}
try {
var arg0 = (II) args[0];
var arg1 = (II) args[1];
return arg0.getRoot().equals(arg1.getRoot()) && arg0.getExtension().equals(arg1.getExtension());
} catch (ClassCastException e) {
throw new FunctionProcessingException("The arguments are of the wrong datatype", e);
} catch (Exception e) {
throw new FunctionProcessingException(e);
}
}
use of org.hl7.v3.II in project integration-adaptor-111 by nhsconnect.
the class OrganizationMapperTest method mockItkOrganization.
private POCDMT000002UK01Organization mockItkOrganization() {
POCDMT000002UK01Organization itkOrganization = mock(POCDMT000002UK01Organization.class);
AD itkAddress = mock(AD.class);
TEL itkTelecom = mock(TEL.class);
CE codeEntity = mock(CE.class);
II[] iiArray = new II[] { ii };
when(itkOrganization.getIdArray()).thenReturn(iiArray);
when(ii.isSetExtension()).thenReturn(true);
when(ii.getExtension()).thenReturn(ODS_CODE);
when(itkOrganization.sizeOfIdArray()).thenReturn(1);
when(itkOrganization.getAddrArray()).thenReturn(new AD[] { itkAddress });
when(itkOrganization.getTelecomArray()).thenReturn(new TEL[] { itkTelecom });
when(itkOrganization.isSetStandardIndustryClassCode()).thenReturn(true);
when(itkOrganization.getStandardIndustryClassCode()).thenReturn(codeEntity);
when(codeEntity.getDisplayName()).thenReturn(GP_PRACTICE);
when(contactPointMapper.mapContactPoint(any())).thenReturn(contactPoint);
when(addressMapper.mapAddress(any())).thenReturn(address);
when(nodeUtil.getNodeValueString(itkOrganization.getNameArray(0))).thenReturn(ORGANIZATION_NAME);
when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
Organization organization = organizationMapper.mapOrganization(itkOrganization);
assertThat(organization.getName()).isEqualTo(ORGANIZATION_NAME);
assertThat(organization.getAddressFirstRep()).isEqualTo(address);
assertThat(organization.getTelecomFirstRep()).isEqualTo(contactPoint);
assertThat(organization.getTypeFirstRep().getText()).isEqualTo(GP_PRACTICE);
assertThat(organization.getIdentifierFirstRep().getValue()).isEqualTo(ODS_CODE);
assertThat(organization.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
return itkOrganization;
}
use of org.hl7.v3.II in project integration-adaptor-111 by nhsconnect.
the class OrganizationMapper method mapOrganization.
public Organization mapOrganization(POCDMT000002UK01Organization itkOrganization) {
Organization fhirOrganization = new Organization();
fhirOrganization.setIdElement(resourceUtil.newRandomUuid());
fhirOrganization.setName(nodeUtil.getNodeValueString(itkOrganization.getNameArray(0)));
fhirOrganization.setAddress(Arrays.stream(itkOrganization.getAddrArray()).map(addressMapper::mapAddress).collect(Collectors.toList()));
fhirOrganization.setTelecom(Arrays.stream(itkOrganization.getTelecomArray()).map(contactPointMapper::mapContactPoint).collect(Collectors.toList()));
if (itkOrganization.isSetStandardIndustryClassCode()) {
fhirOrganization.setType(Collections.singletonList(new CodeableConcept().setText(itkOrganization.getStandardIndustryClassCode().getDisplayName())));
}
if (itkOrganization.isSetAsOrganizationPartOf()) {
if (itkOrganization.getAsOrganizationPartOf().getWholeOrganization() != null) {
Organization partOf = mapOrganization(itkOrganization.getAsOrganizationPartOf().getWholeOrganization());
fhirOrganization.setPartOf(resourceUtil.createReference(partOf));
fhirOrganization.setPartOfTarget(partOf);
}
}
if (itkOrganization.sizeOfIdArray() > 0) {
List<Identifier> identifierList = new ArrayList<>();
for (II id : itkOrganization.getIdArray()) {
if (id.isSetExtension()) {
identifierList.add(new Identifier().setValue(id.getExtension()));
}
}
fhirOrganization.setIdentifier(identifierList);
}
return fhirOrganization;
}
use of org.hl7.v3.II in project integration-adaptor-111 by nhsconnect.
the class CompositionMapperTest method setUp.
@BeforeEach
public void setUp() {
effectiveTime.setValue(EFFECTIVE_DATE);
questionnaireResponseList = new ArrayList<>();
questionnaireResponseList.add(questionnaireResponse);
POCDMT000002UK01RelatedDocument1[] relatedDocsArray = { mock(POCDMT000002UK01RelatedDocument1.class) };
when(clinicalDocument.getRelatedDocumentArray()).thenReturn(relatedDocsArray);
when(clinicalDocument.getRelatedDocumentArray(0)).thenReturn(relatedDocument1);
when(relatedDocument1.getParentDocument()).thenReturn(parentDocument1);
when(parentDocument1.getIdArray(0)).thenReturn(ii);
when(clinicalDocument.getSetId()).thenReturn(ii);
when(clinicalDocument.getEffectiveTime()).thenReturn(effectiveTime);
when(ii.getRoot()).thenReturn("411910CF-1A76-4330-98FE-C345DDEE5553");
when(clinicalDocument.getConfidentialityCode()).thenReturn(ce);
when(ce.getCode()).thenReturn("V");
when(ce.isSetCode()).thenReturn(true);
when(ii.isSetRoot()).thenReturn(true);
when(referralRequest.fhirType()).thenReturn("ReferralRequest");
when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
when(resourceUtil.createReference(encounter)).thenReturn(new Reference(encounter));
when(resourceUtil.createReference(questionnaireResponse)).thenReturn(new Reference(questionnaireResponse));
when(resourceUtil.createReference(carePlan)).thenReturn(new Reference(carePlan));
when(resourceUtil.createReference(referralRequest)).thenReturn(new Reference(referralRequest));
mockStructuredBody();
}
Aggregations