use of org.hl7.elm.r1.Time in project summary-care-record-api by NHSDigital.
the class FindingMapper method mapPerformer.
private void mapPerformer(List<Resource> resources, Encounter encounter, Node performer) {
DateTimeType time = parseDate(xmlUtils.getValueByXPath(performer, FINDING_PARTICIPANT_TIME_XPATH), DateTimeType.class);
participantMapper.map(performer).stream().peek(it -> resources.add(it)).filter(it -> it instanceof PractitionerRole).map(Reference::new).forEach(it -> {
EncounterParticipantComponent participant = new EncounterParticipantComponent();
String modeCode = xmlUtils.getValueByXPath(performer, FINDING_PERFORMER_MODE_CODE_XPATH);
participant.addExtension(PERFORMER_EXTENSION_URL, new CodeableConcept(new Coding().setSystem(ENCOUNTER_PARTICIPATION_MODE_SYSTEM).setCode(modeCode).setDisplay(getParticipationModeDisplay(modeCode))));
encounter.addParticipant(participant.setPeriod(new Period().setStartElement(time)).addType(getParticipationType("PRF", "performer")).setIndividual(it));
});
}
use of org.hl7.elm.r1.Time in project summary-care-record-api by NHSDigital.
the class FindingMapper method mapAuthor.
private void mapAuthor(List<Resource> resources, Encounter encounter, Node author) {
DateTimeType time = parseDate(xmlUtils.getValueByXPath(author, FINDING_PARTICIPANT_TIME_XPATH), DateTimeType.class);
participantMapper.map(author).stream().peek(it -> resources.add(it)).filter(it -> it instanceof PractitionerRole).map(Reference::new).forEach(it -> encounter.addParticipant(new EncounterParticipantComponent().setPeriod(new Period().setStartElement(time)).addType(getParticipationType("AUT", "author")).setIndividual(it)));
}
use of org.hl7.elm.r1.Time in project drug-formulary-ri by HL7-DaVinci.
the class ExampleServerDstu3IT method testWebsocketSubscription.
@Test
public void testWebsocketSubscription() throws Exception {
/*
* Create subscription
*/
Subscription subscription = new Subscription();
subscription.setReason("Monitor new neonatal function (note, age will be determined by the monitor)");
subscription.setStatus(Subscription.SubscriptionStatus.REQUESTED);
subscription.setCriteria("Observation?status=final");
Subscription.SubscriptionChannelComponent channel = new Subscription.SubscriptionChannelComponent();
channel.setType(Subscription.SubscriptionChannelType.WEBSOCKET);
channel.setPayload("application/json");
subscription.setChannel(channel);
MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
IIdType mySubscriptionId = methodOutcome.getId();
// Wait for the subscription to be activated
waitForSize(1, () -> ourClient.search().forResource(Subscription.class).where(Subscription.STATUS.exactly().code("active")).cacheControl(new CacheControlDirective().setNoCache(true)).returnBundle(Bundle.class).execute().getEntry().size());
/*
* Attach websocket
*/
WebSocketClient myWebSocketClient = new WebSocketClient();
SocketImplementation mySocketImplementation = new SocketImplementation(mySubscriptionId.getIdPart(), EncodingEnum.JSON);
myWebSocketClient.start();
URI echoUri = new URI("ws://localhost:" + ourPort + "/hapi-fhir-jpaserver/websocket");
ClientUpgradeRequest request = new ClientUpgradeRequest();
ourLog.info("Connecting to : {}", echoUri);
Future<Session> connection = myWebSocketClient.connect(mySocketImplementation, echoUri, request);
Session session = connection.get(2, TimeUnit.SECONDS);
ourLog.info("Connected to WS: {}", session.isOpen());
/*
* Create a matching resource
*/
Observation obs = new Observation();
obs.setStatus(Observation.ObservationStatus.FINAL);
ourClient.create().resource(obs).execute();
// Give some time for the subscription to deliver
Thread.sleep(2000);
/*
* Ensure that we receive a ping on the websocket
*/
waitForSize(1, () -> mySocketImplementation.myPingCount);
/*
* Clean up
*/
ourClient.delete().resourceById(mySubscriptionId).execute();
}
use of org.hl7.elm.r1.Time in project ab2d by CMSgov.
the class PatientClaimsProcessorUnitTest method process_whenPatientHasDataWithBadLastUpdated.
@Test
void process_whenPatientHasDataWithBadLastUpdated() throws ExecutionException, InterruptedException {
ExplanationOfBenefit firstEob = eob.copy();
eob.getMeta().setLastUpdated(null);
org.hl7.fhir.dstu3.model.Bundle bundle1 = EobTestDataUtil.createBundle(eob.copy());
ExplanationOfBenefit eob2 = eob.copy();
// now set the last updated date to a time before the since date (which is attribution date here)
eob2.getMeta().setLastUpdated(new Date(LATER_ATT_DATE.toInstant().toEpochMilli() - 1000));
final org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent bundleEntryComponent = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent();
bundleEntryComponent.setResource(eob2);
bundle1.addEntry(bundleEntryComponent);
ExplanationOfBenefit eob3 = eob.copy();
eob2.getMeta().setLastUpdated(new Date());
final org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent bundleEntryComponent3 = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent();
bundleEntryComponent3.setResource(eob3);
bundle1.addEntry(bundleEntryComponent3);
assertEquals(3, bundle1.getEntry().size());
PatientClaimsRequest request2 = new PatientClaimsRequest(List.of(coverageSummary), LATER_ATT_DATE, LATER_ATT_DATE, "client", "job", "contractNum", Contract.ContractType.NORMAL, noOpToken, STU3, tmpEfsMountDir.getAbsolutePath());
when(mockBfdClient.requestEOBFromServer(STU3, patientId, request2.getAttTime())).thenReturn(bundle1);
cut.process(request2).get();
}
use of org.hl7.elm.r1.Time in project integration-adaptor-111 by nhsconnect.
the class ParticipantMapperTest method shouldMapParticipant.
@Test
public void shouldMapParticipant() {
POCDMT000002UK01Participant1 encounterParticipant = mock(POCDMT000002UK01Participant1.class);
POCDMT000002UK01AssociatedEntity associatedEntity = mock(POCDMT000002UK01AssociatedEntity.class);
IVLTS time = mock(IVLTS.class);
when(encounterParticipant.getTypeCode()).thenReturn("CON");
when(encounterParticipant.getAssociatedEntity()).thenReturn(associatedEntity);
when(encounterParticipant.isSetTime()).thenReturn(true);
when(encounterParticipant.getTime()).thenReturn(time);
when(periodMapper.mapPeriod(ArgumentMatchers.isA(IVLTS.class))).thenReturn(period);
when(practitionerMapper.mapPractitioner(ArgumentMatchers.isA(POCDMT000002UK01AssociatedEntity.class))).thenReturn(practitioner);
when(resourceUtil.createReference(practitioner)).thenReturn(new Reference(practitioner));
Encounter.EncounterParticipantComponent participantComponent = participantMapper.mapEncounterParticipant(encounterParticipant);
assertThat(participantComponent.getIndividualTarget()).isEqualTo(practitioner);
assertThat(participantComponent.getPeriod()).isEqualTo(period);
assertThat(participantComponent.getType().get(0).getText()).isEqualTo("CON");
}
Aggregations