Skip to content

Commit

Permalink
code review edits
Browse files Browse the repository at this point in the history
  • Loading branch information
Capt-Mac committed Oct 28, 2024
1 parent 3edc24c commit 05d451b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,9 @@ protected void buildStratifier(
}
} else {
var values = subjectValues.values().stream()
.map(t -> (Resource) t.rawValue())
.map(CriteriaResult::rawValue)
.filter(Resource.class::isInstance)
.map(Resource.class::cast)
.map(x -> x.getResourceType().toString().concat("/").concat(x.getIdPart()))
.collect(Collectors.toList());
for (String value : values) {
Expand Down Expand Up @@ -527,7 +529,8 @@ protected void buildStratumExtPopulation(
.collect(Collectors.toSet());
} else {
subjectPop = reportPopulation.getResources().stream()
.map(t -> (Resource) t)
.filter(Resource.class::isInstance)
.map(Resource.class::cast)
.map(x -> x.getResourceType().toString().concat("/").concat(x.getIdPart()))
.collect(Collectors.toSet());
}
Expand Down Expand Up @@ -562,7 +565,6 @@ protected void buildStratumPopulation(
}

Set<String> intersection = new HashSet<>(subjectIds);
// subjectIds.get(0).split("/")
intersection.retainAll(popSubjectIds);
sgpc.setCount(intersection.size());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ public SelectedContained observationHasExtensionUrl() {
* @return
*/
public SelectedContained observationHasSDECoding() {
assert value() instanceof Observation;
var obs = (Observation) value();
assertEquals(SDE_SYSTEM_URL, obs.getCode().getCodingFirstRep().getSystem());
assertEquals("supplemental-data", obs.getCode().getCodingFirstRep().getCode());
Expand Down Expand Up @@ -731,6 +732,7 @@ public SelectedReference referenceHasExtension(String extValueRef) {
}
String foundRef = null;
for (Extension extension : ex) {
assert extension.getValue() instanceof StringType;
StringType extValue = (StringType) extension.getValue();
if (extValue.getValue().equals(extValueRef)) {
foundRef = extValue.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void cohortBooleanMultiStrat() {
void cohortBooleanNoIdStrat() {
try {
given.when().measureId("CohortBooleanStratNoId").evaluate().then().report();
fail();
fail("should throw a missing Id scenario");
} catch (NullPointerException e) {
assertTrue(e.getMessage().contains("id is required on all Elements of type: Measure.group.stratifier"));
}
Expand Down Expand Up @@ -210,7 +210,7 @@ void cohortBooleanComponentStrat() {
.evaluate()
.then()
.report();
fail();
fail("components are not implemented and should fail");
} catch (UnsupportedOperationException e) {
assertTrue(e.getMessage().contains("multi-component stratifiers are not yet supported"));
}
Expand Down Expand Up @@ -253,7 +253,7 @@ void ratioResourceDifferentTypeStrat() {
.evaluate()
.then()
.report();
fail();
fail("Since this is Resource based, it can't intersect with subject based expression");
} catch (IllegalArgumentException e) {
assertTrue(e.getMessage()
.contains("stratifier expression criteria results must match the same type as population"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@ public class TestDataGenerator {
private final Logger ourLog = LoggerFactory.getLogger(TestDataGenerator.class);

public TestDataGenerator(Repository repository) {

this.repository = repository;
}

public void makePatient(String practitioner, String organization, Period encounterPeriod) {
int patientQty = 10;
int i = 0;
while (i < patientQty) {
int i;
for (i = 0; i < patientQty; i++) {
// Patient Creation
var patientId = "Patient/patient-" + i;
createPatient(patientId, practitioner, organization, i);
Expand Down Expand Up @@ -56,8 +55,6 @@ public void makePatient(String practitioner, String organization, Period encount
createEncounter(patientId, encounterPeriod, EncounterStatus.INPROGRESS, i, 2);
}
}
// increment
i++;
}
ourLog.info(String.format("Patients created: %s", i));
}
Expand Down

0 comments on commit 05d451b

Please sign in to comment.