Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
barhodes committed Jan 31, 2025
1 parent d1c549b commit cfe95be
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,4 @@ default IBase newValue(Class<? extends IBase> clazz) {
throw new IllegalArgumentException(e);
}
}

default IBase newValue(String type, IBase value) {
var newValue = newValue(type);
return newValue;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ protected void resolveLaunchContext(
var types = launchContext.getExtensionsByUrl("type").stream()
.map(type -> type.getValueAsPrimitive().getValueAsString())
.collect(Collectors.toList());
// if (!validateContext(SDC_QUESTIONNAIRE_LAUNCH_CONTEXT_CODE.valueOf(name.toUpperCase()), type)) {
// throw new IllegalArgumentException(String.format("Unsupported launch context for %s: %s", name,
// type));
// }
var content = getContent(contexts, name);
if (content != null && !content.isEmpty()) {
var value = getValue(types, content);
Expand All @@ -140,10 +136,6 @@ protected void resolveLaunchContext(
params.addParameter(part(cqlParameterName, resource));
});
}
// else {
// throw new IllegalArgumentException(
// String.format("Unable to retrieve resource for context: %s", name));
// }
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,10 @@ protected void processSliceItem(
sliceIndex = i;
}
}
var sliceName = identifiers[sliceIndex];
var sliceName = sliceIndex == -1 ? null : identifiers[sliceIndex];
if (sliceName == null) {
return;
}
var slicePath = sliceName.split(":")[0];
var slicePropertyDef = propertyDefs.get(sliceName);
var sliceClass = slicePropertyDef instanceof BaseRuntimeChildDatatypeDefinition def
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,67 +295,6 @@ void testUserLaunchContextAsRelatedPersonR4() {
assertEquals(user, actual.getParameter().get(2).getResource());
}

// @Test
// void testUnsupportedLaunchContextR4() {
// var user = new org.hl7.fhir.r4.model.Patient();
// user.setIdElement(Ids.newId(fhirContextR4, "Patient", patientId));
// doReturn(fhirContextR4).when(repository).fhirContext();
// doReturn(user).when(repository).read(org.hl7.fhir.r4.model.Patient.class, user.getIdElement());
// assertThrows(
// IllegalArgumentException.class,
// () -> IInputParameterResolver.createResolver(
// repository,
// user.getIdElement(),
// null,
// null,
// null,
// true,
// null,
// Arrays.asList(adapterFactoryR4.createParametersParameters((IBaseBackboneElement) newPart(
// fhirContextR4,
// "context",
// newStringPart(fhirContextR4, "name", "user"),
// newPart(fhirContextR4, "Reference", "content", user.getId())))),
// Arrays.asList((IBaseExtension<?, ?>)
// new org.hl7.fhir.r4.model.Extension(Constants.SDC_QUESTIONNAIRE_LAUNCH_CONTEXT)
// .setExtension(Arrays.asList(
// new org.hl7.fhir.r4.model.Extension(
// "name", new org.hl7.fhir.r4.model.Coding().setCode("user")),
// new org.hl7.fhir.r4.model.Extension(
// "type", new
// org.hl7.fhir.r4.model.CodeType("Observation")))))));
// }

// @Test
// void testMissingLaunchContextResourceR4() {
// var patient = new org.hl7.fhir.r4.model.Patient();
// patient.setIdElement(Ids.newId(fhirContextR4, "Patient", patientId));
// doReturn(fhirContextR4).when(repository).fhirContext();
// doReturn(patient).when(repository).read(org.hl7.fhir.r4.model.Patient.class, patient.getIdElement());
// assertThrows(
// IllegalArgumentException.class,
// () -> IInputParameterResolver.createResolver(
// repository,
// patient.getIdElement(),
// null,
// null,
// null,
// true,
// null,
// Arrays.asList(adapterFactoryR4.createParametersParameters((IBaseBackboneElement) newPart(
// fhirContextR4,
// "context",
// newStringPart(fhirContextR4, "name", "user"),
// newPart(fhirContextR4, "Reference", "content", practitionerId)))),
// Arrays.asList((IBaseExtension<?, ?>) new org.hl7.fhir.r4.model.Extension(
// Constants.SDC_QUESTIONNAIRE_LAUNCH_CONTEXT)
// .setExtension(Arrays.asList(
// new org.hl7.fhir.r4.model.Extension(
// "name", new org.hl7.fhir.r4.model.Coding().setCode("user")),
// new org.hl7.fhir.r4.model.Extension(
// "type", new org.hl7.fhir.r4.model.CodeType("Practitioner")))))));
// }

@Test
void testResolveParametersR5() {
var patient = new org.hl7.fhir.r5.model.Patient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ void testNullElementType() {
assertNull(Helpers.parseR5ItemType(null, false, false));
assertNotNull(Helpers.parseR5ItemType(null, true, false));
assertNotNull(Helpers.parseR5ItemType(null, false, true));
// assertThrows(IllegalArgumentException.class, () -> Helpers.parseR4ItemType(null, false, false));
// assertThrows(IllegalArgumentException.class, () -> Helpers.parseR5ItemType(null, false, false));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ void extractWithHiddenItems() {
var resources = BundleHelper.getEntryResources(result);
var obs = (Observation) resources.get(0);
assertTrue(obs.hasCode());
// assertTrue(obs.hasSubject());
assertTrue(obs.hasValueBooleanType());
}

Expand Down Expand Up @@ -128,7 +127,7 @@ void definitionExtractAtRoot() {
.getBundle();
var organization = (Organization) BundleHelper.getEntryResourceFirstRep(bundle);
assertNotNull(organization);
// assertEquals(String.format("extract-%s", questionnaireResponseId), organization.getIdPart());
assertEquals(String.format("extract-%s", questionnaireResponseId), organization.getIdPart());
assertEquals("Acme Clinic", organization.getName());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,4 @@ void testItemWithContextExtensionAndRepeatingNestedPath() {
assertEquals("test1", names.get(0).getText());
assertEquals("test2", names.get(1).getText());
}

@Test
@Disabled
void testItemWithContextExtensionAndFixedValueExtension() {}
}

0 comments on commit cfe95be

Please sign in to comment.