Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merging in long lived GIC hpds branch #111

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,11 @@ public enum ResultType {
* is suitable to time series analysis and/or loading into another
* instance of HPDS.
*/
DATAFRAME_TIMESERIES
DATAFRAME_TIMESERIES,

/**
* Count number of patients and number of available concept paths. Useful for federated networks
* where not every concept path in a query is guaranteed to be in a specific portal
*/
PATIENT_AND_CONCEPT_COUNT
}
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,20 @@ public Map<String, Object> runVariantCount(Query query) {
}
return response;
}

public PatientAndConceptCount runPatientAndConceptCount(Query incomingQuery) {
log.info("Starting Patient and Concept Count query {}", incomingQuery.getPicSureId());
log.info("Calculating available concepts");
long concepts = incomingQuery.getFields().stream()
.map(abstractProcessor::nullableGetCube)
.filter(Optional::isPresent)
.count();
log.info("Calculating patient counts");
int patients = runCounts(incomingQuery);
PatientAndConceptCount patientAndConceptCount = new PatientAndConceptCount();
patientAndConceptCount.setConceptCount(concepts);
patientAndConceptCount.setPatientCount(patients);
log.info("Completed Patient and Concept Count query {}", incomingQuery.getPicSureId());
return patientAndConceptCount;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package edu.harvard.hms.dbmi.avillach.hpds.processing;

public class PatientAndConceptCount {
private long patientCount, conceptCount;

public long getPatientCount() {
return patientCount;
}

public void setPatientCount(long patientCount) {
this.patientCount = patientCount;
}

public long getConceptCount() {
return conceptCount;
}

public void setConceptCount(long conceptCount) {
this.conceptCount = conceptCount;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,9 @@ private Response submitQueryAndWaitForCompletion(QueryRequest resultRequest) thr
case COUNT:
return queryOkResponse(countProcessor.runCounts(incomingQuery), incomingQuery).build();

case PATIENT_AND_CONCEPT_COUNT:
return queryOkResponse(countProcessor.runPatientAndConceptCount(incomingQuery), incomingQuery).build();

default:
// no valid type
return Response.status(Status.BAD_REQUEST).build();
Expand Down
Loading