use of org.hl7.gravity.refimpl.sdohexchange.sdohmappings.System in project quality-measure-and-cohort-service by Alvearie.
the class MeasureSupplementalDataEvaluationTest method testProcessAccumulators_notSDESex.
@Test
public void testProcessAccumulators_notSDESex() {
/*
* Jill - I don't like how this part of the code works. The code grabs everything after (and including) the "-",
* and then looks for that to exist as an extension on the Patient resource. This works for race and ethnicity
* on the US-core patient profile, but since we already calculated this in the populate SDE accumulator method
* the only reason it's "recalculating" is because the system and display aren't on the passed in map.
* Plus, it's coded assuming there is a list of extensions within the extension (which is how US-Core handles race and eth)
* and it magically grabs the first one... so if you have multiple this doesn't match all of them.
*/
Code white = new Code();
white.setCode(WHITE_CODE);
Map<String, Map<String, Integer>> sdeAccumulators = getSDEAccumulators(SDE_RACE, null, white, new HashMap<>());
MeasureReport report = new MeasureReport();
Patient mockPatient = mockPatient();
Extension raceExtension = new Extension();
// This can be anything as long as it includes "-race"
raceExtension.setUrl("something-race");
// This example was stolen from https://www.hl7.org/fhir/us/core/Patient-example.xml.html
Extension valueExtension = new Extension();
valueExtension.setUrl("ombCategory");
valueExtension.setValue(getWhiteCoding());
raceExtension.setExtension(Arrays.asList(valueExtension));
Mockito.when(mockPatient.getExtension()).thenReturn(Arrays.asList(raceExtension));
MeasureSupplementalDataEvaluation.processAccumulators(report, sdeAccumulators, true, Arrays.asList(mockPatient));
assertNotNull(report);
// EvaluatedResource should contain a reference to an observation record created for supplemental data
assertEquals(1, report.getEvaluatedResource().size());
// The observation record mentioned previously should exist within the contained resources of the measure report
assertEquals(1, report.getContained().size());
assertTrue(report.getContained().get(0) instanceof Observation);
Observation obs = (Observation) report.getContained().get(0);
// For a single patient, the code of the observation should be the supplemental data text
assertEquals(SDE_RACE, obs.getCode().getText());
// For a single patient, the value of the observation should be the result of the appropriate define
assertTrue(obs.getValue() instanceof CodeableConcept);
assertEquals(WHITE_CODE, ((CodeableConcept) obs.getValue()).getCoding().get(0).getCode());
}
use of org.hl7.gravity.refimpl.sdohexchange.sdohmappings.System in project quality-measure-and-cohort-service by Alvearie.
the class R4ParameterDefinitionWithDefaultToCohortParameterConverterTest method makeCoding.
private Coding makeCoding(String system, String value, String display, String version) {
Coding coding = new Coding();
coding.setSystem(system);
coding.setCode(value);
coding.setDisplay(display);
coding.setVersion(version);
return coding;
}
use of org.hl7.gravity.refimpl.sdohexchange.sdohmappings.System in project quality-measure-and-cohort-service by Alvearie.
the class R4RestFhirTerminologyProvider method lookup.
/**
* This is a small patch to the OSS implementation to use named-parameter lookup on
* the operation response instead of just assuming a positional location.
*/
@Override
public Code lookup(Code code, CodeSystemInfo codeSystem) throws ResourceNotFoundException {
Parameters respParam = fhirClient.operation().onType(CodeSystem.class).named("lookup").withParameter(Parameters.class, "code", new CodeType(code.getCode())).andParameter("system", new UriType(codeSystem.getId())).execute();
StringType display = (StringType) respParam.getParameter("display");
if (display != null) {
code.withDisplay(display.getValue());
}
return code.withSystem(codeSystem.getId());
}
use of org.hl7.gravity.refimpl.sdohexchange.sdohmappings.System in project quality-measure-and-cohort-service by Alvearie.
the class IdentifierBuilderTest method testBuilder.
@Test
public void testBuilder() {
String system = "TEST SYSTEM";
String code = "TEST CODE";
String display = "TEST DISPLAY";
String value = "TEST VALUE";
Coding coding = new Coding(system, code, display);
CodeableConcept type = new CodeableConcept(coding);
Period period = new Period();
period.setStart(new Date());
period.setEnd(new Date());
Reference assigner = new Reference("TEST REFERENCE");
Identifier identifier = new IdentifierBuilder().buildUse(IdentifierUse.OFFICIAL).buildSystem(system).buildType(type).buildPeriod(period).buildValue(value).buildAssigner(assigner).build();
assertEquals(IdentifierUse.OFFICIAL, identifier.getUse());
assertEquals(system, identifier.getSystem());
assertEquals(type, identifier.getType());
assertEquals(period, identifier.getPeriod());
assertEquals(value, identifier.getValue());
assertEquals(assigner, identifier.getAssigner());
}
use of org.hl7.gravity.refimpl.sdohexchange.sdohmappings.System in project quality-measure-and-cohort-service by Alvearie.
the class RestFhirRetrieveProviderTest method makeValueSet.
protected ValueSet makeValueSet(String name, String system, String... codes) {
ValueSet vs = new ValueSet();
vs.setId(name);
vs.setName(name);
vs.setUrl("http://somewhere.com/fhir/ValueSet/" + name);
vs.setVersion("1.0.0");
for (String code : codes) {
vs.getExpansion().addContains().setSystem(system).setCode(code);
}
return vs;
}
Aggregations