protected Element participantObjectIdentification(ParticipantObjectIdentificationType poi) { Element element = new Element("ParticipantObjectIdentification"); if (poi != null) { conditionallyAddAttribute(element, "ParticipantObjectID", poi.getParticipantObjectID()); if (poi.getParticipantObjectTypeCode() != null) { conditionallyAddAttribute(element, "ParticipantObjectTypeCode", poi.getParticipantObjectTypeCode().getValue().toString()); } conditionallyAddAttribute(element, "ParticipantObjectTypeCodeRole", poi.getParticipantObjectTypeCodeRole()); conditionallyAddAttribute(element, "ParticipantObjectDataLifeCycle", poi.getParticipantObjectDataLifeCycle()); conditionallyAddAttribute(element, "ParticipantObjectSensitivity", poi.getParticipantObjectSensitivity()); element.addContent(codedValueType("ParticipantObjectIDTypeCode", poi.getParticipantObjectIDTypeCode())); if (poi.getParticipantObjectName() != null) { element.addContent(new Element("ParticipantObjectName") .addContent(poi.getParticipantObjectName())); } if (poi.getParticipantObjectQuery() != null) { element.addContent(new Element("ParticipantObjectQuery") .addContent(new String( Base64.getEncoder().encode(poi.getParticipantObjectQuery()), StandardCharsets.UTF_8))); } poi.getParticipantObjectDetails().stream() .map(participantObjectDetail -> typeValuePairType("ParticipantObjectDetail", participantObjectDetail)) .forEach(element::addContent); poi.getParticipantObjectDescriptions().stream() .map(this::dicomObjectDescription) .forEach(element::addContent); } return element; }
@Override public void validate() { super.validate(); ParticipantObjectIdentificationType patient = getMessage().findParticipantObjectIdentifications(poi -> ParticipantObjectIdTypeCode.PatientNumber.equals(poi.getParticipantObjectIDTypeCode())).get(0); if (!PATIENT_ID_PATTERN.matcher(patient.getParticipantObjectID()).matches()) { throw new AuditException("Patient ID should be in CX format " + PATIENT_ID_PATTERN.pattern()); } } }
ParticipantObjectDataLifeCycle objectDataLifeCycle, String objectSensitivity) { ParticipantObjectIdentificationType poit = new ParticipantObjectIdentificationType(objectID, objectIDTypeCode); poit.setParticipantObjectName(objectName); poit.setParticipantObjectQuery(objectQuery); if (objectDetails != null) { objectDetails.stream() .filter(Objects::nonNull) .forEach(objectDetail -> poit.getParticipantObjectDetails().add(objectDetail)); poit.setParticipantObjectTypeCode(objectTypeCode); poit.setParticipantObjectTypeCodeRole(objectTypeCodeRole); poit.setParticipantObjectDataLifeCycle(objectDataLifeCycle); poit.setParticipantObjectSensitivity(objectSensitivity); return addParticipantObjectIdentification(poit);
.filter(poi -> ParticipantObjectIdTypeCode.PatientNumber == poi.getParticipantObjectIDTypeCode()) .findFirst().orElseThrow(() -> new AssertionError("Expected patient participant object")); assertEquals(PATIENT_IDS[0], patient.getParticipantObjectID()); assertEquals(ParticipantObjectTypeCode.Person, patient.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Patient, patient.getParticipantObjectTypeCodeRole()); if (!patient.getParticipantObjectDetails().isEmpty()) { assertEquals(MESSAGE_ID, new String( patient.getParticipantObjectDetails().get(0).getValue(), StandardCharsets.UTF_8)); if (patient.getParticipantObjectQuery() != null) { assertEquals(QUERY_PAYLOAD, new String( patient.getParticipantObjectQuery(), StandardCharsets.UTF_8));
@Test public void testGetResource() { PdqPatient p = client.read() .resource(PdqPatient.class) .withId("4711") .execute(); assertEquals("Test", p.getName().get(0).getFamily().get(0).getValue()); assertEquals(String.format("http://localhost:%d/Patient/4711", DEMO_APP_PORT), p.getId()); AbstractMockedAuditMessageQueue sender = getAuditSender(); assertEquals(1, sender.getMessages().size()); AuditMessage event = sender.getMessages().get(0); // Patient ParticipantObjectIdentificationType patient = event.getParticipantObjectIdentifications().get(0); assertEquals(ParticipantObjectTypeCode.Person, patient.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Patient, patient.getParticipantObjectTypeCodeRole()); assertEquals("Patient/4711", patient.getParticipantObjectID()); }
private void testRequest(boolean serverSide, XdsIRetrieveAuditStrategy30 strategy) { XdsNonconstructiveDocumentSetRequestAuditDataset auditDataset = getXdsAuditDataset(strategy); AuditMessage auditMessage = makeAuditMessage(strategy, auditContext, auditDataset); assertNotNull(auditMessage); auditMessage.validate(); // System.out.println(printAuditMessage(auditMessage)); assertCommonXdsAuditAttributes(auditMessage, EventOutcomeIndicator.Success, serverSide ? EventIdCode.Export : EventIdCode.Import, serverSide ? EventActionCode.Read : EventActionCode.Create, serverSide, true); assertEquals(3, auditMessage.findParticipantObjectIdentifications( poit -> poit.getParticipantObjectTypeCodeRole() == ParticipantObjectTypeCodeRole.Report).size()); assertEquals(4, auditMessage.findParticipantObjectIdentifications( poit -> poit.getParticipantObjectTypeCode() == ParticipantObjectTypeCode.System) .get(0) .getParticipantObjectDetails().size()); }
private void testRequest(boolean serverSide, Iti59AuditStrategy strategy) { Iti59AuditDataset auditDataset = getHpdAuditDataset(strategy); AuditMessage[] auditMessages = makeAuditMessages(strategy, auditContext, auditDataset); assertEquals(3, auditMessages.length); for (AuditMessage auditMessage : auditMessages) { auditMessage.validate(); System.out.println(printAuditMessage(auditMessage)); assertEquals(1, auditMessage.getParticipantObjectIdentifications().size()); ParticipantObjectIdentificationType participant = auditMessage.getParticipantObjectIdentifications().get(0); assertEquals(ParticipantObjectTypeCodeRole.Provider, participant.getParticipantObjectTypeCodeRole()); assertEquals(HpdParticipantObjectIdTypeCode.RelativeDistinguishedName, participant.getParticipantObjectIDTypeCode()); } assertCommonHpdAuditAttributes(auditMessages[0], EventOutcomeIndicator.Success, serverSide ? EventIdCode.Import : EventIdCode.Export, EventActionCode.Update, serverSide); ParticipantObjectIdentificationType participant = auditMessages[2].getParticipantObjectIdentifications().get(0); assertEquals(1, participant.getParticipantObjectDetails().size()); assertEquals("old uid", participant.getParticipantObjectDetails().get(0).getType()); assertEquals("1.11.111.1111:klmno", new String(participant.getParticipantObjectDetails().get(0).getValue())); }
p.getParticipantObjectTypeCode() == ParticipantObjectTypeCode.System).get(0); assertEquals(Iti68TestRouteBuilder.DOCUMENT_UNIQUE_ID, poit.getParticipantObjectID()); assertEquals(2, poit.getParticipantObjectDetails().size());
@Override public void validate() { super.validate(); int participants = getMessage().getActiveParticipants().size(); if (participants < 1 || participants > 2) { throw new AuditException("Must have one or two ActiveParticipants"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.PatientNumber).size() != 1) { throw new AuditException("Must one ParticipantObjectIdentification with ParticipantObjectIDTypeCode PatientNumber"); } } }
private void testRequest(boolean serverSide) { Iti63AuditStrategy strategy = new Iti63AuditStrategy(serverSide); XdsQueryAuditDataset auditDataset = getXdsAuditDataset(strategy); AuditMessage auditMessage = makeAuditMessage(strategy, auditContext, auditDataset); assertNotNull(auditMessage); auditMessage.validate(); // System.out.println(printAuditMessage(auditMessage)); assertCommonXdsAuditAttributes(auditMessage, EventOutcomeIndicator.Success, EventIdCode.Query, EventActionCode.Execute, serverSide, true); assertEquals(2, auditMessage.findParticipantObjectIdentifications( poit -> poit.getParticipantObjectTypeCode() == ParticipantObjectTypeCode.System) .get(0) .getParticipantObjectDetails().size()); }
private void testRequest(boolean serverSide) { Iti86AuditStrategy strategy = new Iti86AuditStrategy(serverSide); XdsNonconstructiveDocumentSetRequestAuditDataset auditDataset = getXdsAuditDataset(strategy); AuditMessage auditMessage = makeAuditMessage(strategy, auditContext, auditDataset); assertNotNull(auditMessage); auditMessage.validate(); // System.out.println(printAuditMessage(auditMessage)); assertCommonXdsAuditAttributes(auditMessage, EventOutcomeIndicator.Success, EventIdCode.PatientRecord, EventActionCode.Delete, serverSide, true); assertEquals(3, auditMessage.findParticipantObjectIdentifications( poit -> poit.getParticipantObjectTypeCodeRole() == ParticipantObjectTypeCodeRole.Report).size()); }
@Override public void validate() { super.validate(); if (getMessage().getActiveParticipants().isEmpty() || getMessage().getActiveParticipants().size() > 2) { throw new AuditException("Must have one or two participants that started the Application"); } if (getMessage().findParticipantObjectIdentifications(poi -> ParticipantObjectIdTypeCode.URI.equals(poi.getParticipantObjectTypeCode())).size() != 1) { throw new AuditException("Must have exactly Audit Log Identity Participating Object "); } } }
assertEquals(ParticipantObjectTypeCode.Person, patient.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Patient, patient.getParticipantObjectTypeCodeRole()); assertEquals(ParticipantObjectIdTypeCode.PatientNumber, patient.getParticipantObjectIDTypeCode()); assertEquals("Patient/a2", patient.getParticipantObjectID()); assertEquals(ParticipantObjectTypeCode.System, poit.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Job, poit.getParticipantObjectTypeCodeRole()); ParticipantObjectIdType poitTypeCode = poit.getParticipantObjectIDTypeCode(); assertEquals("urn:uuid:a54d6aa5-d40d-43f9-88c5-b4633d873bdd", poitTypeCode.getCode()); assertEquals("IHE XDS Metadata", poitTypeCode.getCodeSystemName());
@Test public void testGetResource() { PdqPatient p = client.read() .resource(PdqPatient.class) .withId("4711") .execute(); assertEquals("Test", p.getName().get(0).getFamily()); assertEquals(String.format("http://localhost:%d/Patient/4711", DEMO_APP_PORT), p.getId()); AbstractMockedAuditMessageQueue sender = getAuditSender(); assertEquals(1, sender.getMessages().size()); AuditMessage event = sender.getMessages().get(0); // Patient ParticipantObjectIdentificationType patient = event.getParticipantObjectIdentifications().get(0); assertEquals(ParticipantObjectTypeCode.Person, patient.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Patient, patient.getParticipantObjectTypeCodeRole()); assertEquals("Patient/4711", patient.getParticipantObjectID()); }
private void testRequest(boolean serverSide, XdsIRetrieveAuditStrategy30 strategy) { XdsNonconstructiveDocumentSetRequestAuditDataset auditDataset = getXdsAuditDataset(strategy); AuditMessage auditMessage = makeAuditMessage(strategy, auditContext, auditDataset); assertNotNull(auditMessage); auditMessage.validate(); // System.out.println(printAuditMessage(auditMessage)); assertCommonXdsAuditAttributes(auditMessage, EventOutcomeIndicator.Success, serverSide ? EventIdCode.Export : EventIdCode.Import, serverSide ? EventActionCode.Read : EventActionCode.Create, serverSide, true); assertEquals(3, auditMessage.findParticipantObjectIdentifications( poit -> poit.getParticipantObjectTypeCodeRole() == ParticipantObjectTypeCodeRole.Report).size()); assertEquals(4, auditMessage.findParticipantObjectIdentifications( poit -> poit.getParticipantObjectTypeCode() == ParticipantObjectTypeCode.System) .get(0) .getParticipantObjectDetails().size()); }
@Override public void validate() { super.validate(); int participants = getMessage().getActiveParticipants().size(); if (participants < 1 || participants > 2) { throw new AuditException("Must have one or two ActiveParticipants"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.StudyInstanceUID).isEmpty()) { throw new AuditException("Must have one or more ParticipantObjectIdentification with ParticipantObjectIDTypeCode StudyInstanceUID"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.PatientNumber).size() != 1) { throw new AuditException("Must one ParticipantObjectIdentification with ParticipantObjectIDTypeCode PatientNumber"); } } }
private void testRequest(boolean serverSide) { Iti62AuditStrategy strategy = new Iti62AuditStrategy(serverSide); XdsRemoveMetadataAuditDataset auditDataset = getXdsAuditDataset(strategy); AuditMessage auditMessage = makeAuditMessage(strategy, auditContext, auditDataset); assertNotNull(auditMessage); auditMessage.validate(); // System.out.println(printAuditMessage(auditMessage)); assertCommonXdsAuditAttributes(auditMessage, EventOutcomeIndicator.Success, EventIdCode.PatientRecord, EventActionCode.Delete, serverSide, true); assertEquals(OBJECT_UUIDS.length, auditMessage.findParticipantObjectIdentifications( poit -> poit.getParticipantObjectTypeCodeRole() == ParticipantObjectTypeCodeRole.Report).size()); }
assertEquals(ParticipantObjectTypeCode.Person, patientIn.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Patient, patientIn.getParticipantObjectTypeCodeRole()); assertEquals("urn:oid:1.2.3.4|0815", patientIn.getParticipantObjectID()); assertEquals(ParticipantObjectTypeCode.System, patient.getParticipantObjectTypeCode()); assertEquals(ParticipantObjectTypeCodeRole.Query, patient.getParticipantObjectTypeCodeRole()); assertEquals("http://localhost:8999/Patient/$ihe-pix?sourceIdentifier=urn:oid:1.2.3.4|0815&targetSystem=urn:oid:1.2.3.4.6", new String(patient.getParticipantObjectQuery(), StandardCharsets.UTF_8)); assertEquals(FhirParticipantObjectIdTypeCode.MobilePatientIdentifierCrossReferenceQuery, patient.getParticipantObjectIDTypeCode());
protected AuditEvent.AuditEventEntityComponent participantObjectIdentificationToEntity(ParticipantObjectIdentificationType poit) { AuditEvent.AuditEventEntityComponent entity = new AuditEvent.AuditEventEntityComponent() .setIdentifier(new Identifier() .setValue(poit.getParticipantObjectID())) // poit.getParticipantObjectIDTypeCode())) not used here .setType(new Coding() .setCode(String.valueOf(poit.getParticipantObjectTypeCode().getValue())) .setSystem("http://hl7.org/fhir/audit-entity-type")) .setRole(new Coding() .setCode(String.valueOf(poit.getParticipantObjectTypeCodeRole().getValue())) .setSystem("http://hl7.org/fhir/object-role")) .setLifecycle(new Coding() .setCode(String.valueOf(poit.getParticipantObjectDataLifeCycle().getValue())) .setSystem("http://hl7.org/fhir/dicom-audit-lifecycle")) .addSecurityLabel(new Coding() .setCode(poit.getParticipantObjectSensitivity())) .setName(poit.getParticipantObjectName()) // poit.getParticipantObjectDescription) not mappable here .setQuery(poit.getParticipantObjectQuery()); poit.getParticipantObjectDetails().forEach(tvp -> entity.addDetail(new AuditEvent.AuditEventEntityDetailComponent() .setType(tvp.getType()) .setValue(tvp.getValue()))); return entity; }
@Override public void validate() { super.validate(); int participants = getMessage().getActiveParticipants().size(); if (participants < 1 || participants > 2) { throw new AuditException("Must have one or two ActiveParticipants"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.StudyInstanceUID).isEmpty()) { throw new AuditException("Must have one or more ParticipantObjectIdentification with ParticipantObjectIDTypeCode StudyInstanceUID"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.PatientNumber).size() != 1) { throw new AuditException("Must have one ParticipantObjectIdentification with ParticipantObjectIDTypeCode PatientNumber"); } } }