use of org.hl7.fhir.r4.model.Specimen in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeSpecimen.
protected void composeSpecimen(Complex parent, String parentType, String name, Specimen element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "Specimen", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Specimen", "identifier", element.getIdentifier().get(i), i);
if (element.hasAccessionIdentifier())
composeIdentifier(t, "Specimen", "accessionIdentifier", element.getAccessionIdentifier(), -1);
if (element.hasStatusElement())
composeEnum(t, "Specimen", "status", element.getStatusElement(), -1);
if (element.hasType())
composeCodeableConcept(t, "Specimen", "type", element.getType(), -1);
if (element.hasSubject())
composeReference(t, "Specimen", "subject", element.getSubject(), -1);
if (element.hasReceivedTimeElement())
composeDateTime(t, "Specimen", "receivedTime", element.getReceivedTimeElement(), -1);
for (int i = 0; i < element.getParent().size(); i++) composeReference(t, "Specimen", "parent", element.getParent().get(i), i);
for (int i = 0; i < element.getRequest().size(); i++) composeReference(t, "Specimen", "request", element.getRequest().get(i), i);
if (element.hasCollection())
composeSpecimenSpecimenCollectionComponent(t, "Specimen", "collection", element.getCollection(), -1);
for (int i = 0; i < element.getProcessing().size(); i++) composeSpecimenSpecimenProcessingComponent(t, "Specimen", "processing", element.getProcessing().get(i), i);
for (int i = 0; i < element.getContainer().size(); i++) composeSpecimenSpecimenContainerComponent(t, "Specimen", "container", element.getContainer().get(i), i);
for (int i = 0; i < element.getNote().size(); i++) composeAnnotation(t, "Specimen", "note", element.getNote().get(i), i);
}
use of org.hl7.fhir.r4.model.Specimen in project nia-patient-switching-standard-adaptor by NHSDigital.
the class SpecimenMapperTest method testInvalidSpecimenIsNotMapped.
@Test
public void testInvalidSpecimenIsNotMapped() {
RCMRMT030101UK04EhrExtract ehrExtract = unmarshallEhrExtract("specimen_invalid.xml");
List<Specimen> specimenList = specimenMapper.mapSpecimen(ehrExtract, List.of(DIAGNOSTIC_REPORT_WITHOUT_SPECIMEN), PATIENT, PRACTICE_CODE);
assertThat(specimenList).isEmpty();
}
use of org.hl7.fhir.r4.model.Specimen in project nia-patient-switching-standard-adaptor by NHSDigital.
the class SpecimenMapperTest method generateDiagnosticReportWithSpecimenReference.
private static DiagnosticReport generateDiagnosticReportWithSpecimenReference() {
DiagnosticReport diagnosticReport = (DiagnosticReport) new DiagnosticReport().setId(DR_ID);
List<Reference> specimen = List.of(new Reference(SPECIMEN_PREFIX + TEST_SPECIMEN_ID));
diagnosticReport.setSpecimen(specimen);
return diagnosticReport;
}
use of org.hl7.fhir.r4.model.Specimen in project nia-patient-switching-standard-adaptor by NHSDigital.
the class SpecimenMapperTest method testSpecimenIsMapped.
@Test
public void testSpecimenIsMapped() {
when(dateTimeMapper.mapDateTime(any())).thenCallRealMethod();
RCMRMT030101UK04EhrExtract ehrExtract = unmarshallEhrExtract("specimen_valid.xml");
List<Specimen> specimenList = specimenMapper.mapSpecimen(ehrExtract, List.of(DIAGNOSTIC_REPORT_WITH_SPECIMEN), PATIENT, PRACTICE_CODE);
assertThat(specimenList).isNotEmpty();
final Specimen specimen = specimenList.get(0);
checkFixedValues(specimen);
assertThat(specimen.getNote().get(0).getText()).isEqualTo(NOTE_TEXT);
assertThat(specimen.getAccessionIdentifier().getValue()).isEqualTo(ACCESSION_IDENTIFIER_VALUE);
assertThat(specimen.getType().getText()).isEqualTo(SPECIMEN_TYPE_TEXT);
assertThat(specimen.getCollection().getCollected().toString()).isEqualTo(SPECIMEN_COLLECTED_DATETIME.toString());
}
Aggregations