From 55df3edde520a542a490d2fb08041cb38128e1f5 Mon Sep 17 00:00:00 2001 From: gcolon021 Date: Thu, 8 Jun 2023 15:46:57 -0400 Subject: [PATCH 1/2] Update runCategoryCrossCounts Changed default value. It would see that on cases where the paint is not in the baseQueryPatientSet we should have the default value be 0. --- .../hms/dbmi/avillach/hpds/processing/CountProcessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/CountProcessor.java b/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/CountProcessor.java index add8cbed..a84f32e8 100644 --- a/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/CountProcessor.java +++ b/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/CountProcessor.java @@ -140,7 +140,7 @@ public Map> runCategoryCrossCounts(Query query) { if (baseQueryPatientSet.contains(patient)) { varCount.put(category, varCount.getOrDefault(category, 1) + 1); } else { - varCount.put(category, varCount.getOrDefault(category, 1)); + varCount.put(category, varCount.getOrDefault(category, 0)); } } } From 6f3b7491e03686c93b35dcef5bc6896f22a45869 Mon Sep 17 00:00:00 2001 From: gcolon021 Date: Fri, 9 Jun 2023 08:17:19 -0400 Subject: [PATCH 2/2] Add additional comments --- .../hms/dbmi/avillach/hpds/processing/CountProcessor.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/CountProcessor.java b/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/CountProcessor.java index a84f32e8..8e9a4878 100644 --- a/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/CountProcessor.java +++ b/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/CountProcessor.java @@ -138,8 +138,14 @@ public Map> runCategoryCrossCounts(Query query) { } else { for (Integer patient : patientSet) { if (baseQueryPatientSet.contains(patient)) { + // If we have a patient in the base set, we add 1 to the count. + // We are only worried about patients in the base set varCount.put(category, varCount.getOrDefault(category, 1) + 1); } else { + // If we don't have a patient in the base set, we add 0 to the count. + // This is necessary because we need to ensure that all categories are included in the + // map, even if they have a count of 0. This is because we are displaying the counts + // in a table (or other form). varCount.put(category, varCount.getOrDefault(category, 0)); } }