use of org.hl7.fhir.r4.model.Endpoint in project himss_2021_sepsis_detection by redhat-na-ssa.
the class GetObservationsSignalEventCommand method getTimeBoxedObservation.
private List<Observation> getTimeBoxedObservation(Patient patient) {
List<Observation> obsList = new ArrayList<>();
Calendar instance = Calendar.getInstance();
instance.add(Calendar.DATE, -1);
Date timeBoxDate = instance.getTime();
String patientID = patient.getId();
String url = fhirURL + "/fhir/Observation?patient=" + patientID + "&_pretty=true";
log.info("getTimeBoxedObservation() fhirUrl endpoint = " + url);
String bundleStr = template.getForEntity(url, String.class).getBody();
Bundle newBundle = fhirCtx.newJsonParser().parseResource(Bundle.class, bundleStr);
for (BundleEntryComponent component : newBundle.getEntry()) {
if (component.getResource() instanceof Observation) {
Observation obs = (Observation) component.getResource();
if (// Adding Observation only if its 24 hrs
obs.getMeta().getLastUpdatedElement().after(timeBoxDate))
obsList.add(obs);
}
}
log.info("getTimedBoxedObservation() Patient Id : " + patientID + " # of Observations = " + obsList.size());
return obsList;
}
use of org.hl7.fhir.r4.model.Endpoint in project CRD by HL7-DaVinci.
the class CoverageRequirementsDiscoveryOperationHardCodedResponseTests method testCrdSuccess.
@Test
@DisplayName("Test CRD with good data.")
void testCrdSuccess() {
CoverageRequirementsDiscoveryOperationHardCodedResponse crdop = new CoverageRequirementsDiscoveryOperationHardCodedResponse();
// valid parameters
Parameters.ParametersParameterComponent request = buildRequest(buildCoverageEligibilityRequest("1234"), buildPatient("patient-4", "Bob Smith"), buildCoverage("4321"), buildProvider("5678"), buildInsurer("87654", "InsureCo"), buildFacility(), buildCondition("condition-1"), buildDevice("XYZ-123"), buildProcedure("12345678"), buildMedication(40));
Endpoint endpoint = buildEndpoint();
CodeableConcept requestQualification = buildRequestQualification();
Parameters outParams = crdop.coverageRequirementsDiscovery(request, endpoint, requestQualification);
assertFalse(outParams.isEmpty());
}
use of org.hl7.fhir.r4.model.Endpoint in project CRD by HL7-DaVinci.
the class CdsHooksController method serviceDiscovery.
/**
* The FHIR r4 services discovery endpoint.
* @return A services object containing an array of all services available on this server
*/
@CrossOrigin
@GetMapping(value = FHIR_RELEASE + URL_BASE)
public CdsServiceInformation serviceDiscovery() {
logger.info("r4/serviceDiscovery");
CdsServiceInformation serviceInformation = new CdsServiceInformation();
serviceInformation.addServicesItem(orderSignService);
serviceInformation.addServicesItem(orderSelectService);
return serviceInformation;
}
use of org.hl7.fhir.r4.model.Endpoint in project dpc-app by CMSgov.
the class OrganizationResourceTest method testOrganizationFetchById.
@Test
void testOrganizationFetchById() {
final IGenericClient client = APIAuthHelpers.buildAuthenticatedClient(ctx, getBaseURL(), ORGANIZATION_TOKEN, PUBLIC_KEY_ID, PRIVATE_KEY);
final Organization organization = client.read().resource(Organization.class).withId(ORGANIZATION_ID).encodedJson().execute();
assertNotNull(organization, "Should have organization");
// Try to get all public endpoints
final Bundle endPointBundle = client.search().forResource(Endpoint.class).encodedJson().returnBundle(Bundle.class).execute();
assertEquals(1, endPointBundle.getTotal(), "Should have one endpoint");
// Try to fetch it
final Endpoint endpoint = (Endpoint) endPointBundle.getEntryFirstRep().getResource();
final Endpoint fetchedEndpoint = client.read().resource(Endpoint.class).withId(endpoint.getId()).encodedJson().execute();
assertTrue(endpoint.equalsDeep(fetchedEndpoint), "Should have matching records");
}
use of org.hl7.fhir.r4.model.Endpoint in project dpc-app by CMSgov.
the class EndpointResourceUnitTest method testCreateEndpoint.
@Test
public void testCreateEndpoint() {
UUID orgId = UUID.randomUUID();
Organization organization = new Organization();
organization.setId(orgId.toString());
OrganizationPrincipal organizationPrincipal = new OrganizationPrincipal(organization);
Endpoint endpoint = new Endpoint();
ICreateTyped createExec = Mockito.mock(ICreateTyped.class);
Mockito.when(attributionClient.create().resource(endpoint).encodedJson()).thenReturn(createExec);
MethodOutcome outcome = new MethodOutcome();
outcome.setResource(endpoint);
Mockito.when(createExec.execute()).thenReturn(outcome);
Response response = resource.createEndpoint(organizationPrincipal, endpoint);
Endpoint result = (Endpoint) response.getEntity();
assertEquals(endpoint, result);
assertEquals("Organization/" + orgId.toString(), endpoint.getManagingOrganization().getReference());
}
Aggregations