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

#171: improve documentation in properties files #177

Merged
merged 8 commits into from
Feb 20, 2024
2 changes: 1 addition & 1 deletion cerner-config/fhirconfig.properties
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ protocol.answer.no=Did NOT Follow BP Protocol
# e.g. with note text "Systolic: 130, Diastolic: 80", systolic-regex might be "Systolic: ([0-9]+)"
# with note text "BP Goal: 130/80", systolic-regex might be "([0-9]+)\\/"
############################################
service-request-order.bp-goal.custom-codings=
service-request-order.bp-goal.codings=
service-request-order.bp-goal.note.systolic-regex=
service-request-order.bp-goal.note.diastolic-regex=
6 changes: 2 additions & 4 deletions cerner-config/fhirqueries.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ Patient.Lookup=Patient/{id}
Patient.Strategy=PATIENT
Encounter.Query=
Encounter.Strategy=PATIENT
Observation.Category.Query=Observation?patient={subject}&category={category}
Observation.Category.Strategy=PATIENT
Observation.Code.Query=Observation?patient={subject}&code={code}
Observation.Code.Strategy=PATIENT
Observation.Query=Observation?patient={subject}&code={code}
Observation.Strategy=PATIENT
Condition.Query=Condition?patient={subject}&category={category}
Condition.Strategy=PATIENT
#Goal.Query=Goal?subject={subject}&lifecycle-status=active
Expand Down
2 changes: 1 addition & 1 deletion epic-config/fhirconfig.properties
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ protocol.answer.no=Did NOT Follow BP Protocol
# e.g. with note text "Systolic: 130, Diastolic: 80", systolic-regex might be "Systolic: ([0-9]+)"
# with note text "BP Goal: 130/80", systolic-regex might be "([0-9]+)\\/"
############################################
service-request-order.bp-goal.custom-codings=urn:oid:1.2.840.114350.1.13.135.2.7.2.696580|340941|COACH PATIENT REPORTED BLOOD PRESSURE
service-request-order.bp-goal.codings=urn:oid:1.2.840.114350.1.13.135.2.7.2.696580|340941|COACH PATIENT REPORTED BLOOD PRESSURE
service-request-order.bp-goal.note.systolic-regex=Systolic: ([0-9]+)
service-request-order.bp-goal.note.diastolic-regex=Diastolic: ([0-9]+)
6 changes: 2 additions & 4 deletions epic-config/fhirqueries.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ Patient.Lookup=Patient/{id}
Patient.Strategy=PATIENT
Encounter.Query=Encounter?subject={subject}
Encounter.Strategy=PATIENT
Observation.Category.Query=Observation?subject={subject}&category={category}
Observation.Category.Strategy=PATIENT
Observation.Code.Query=Observation?subject={subject}&code={code}
Observation.Code.Strategy=PATIENT
Observation.Query=Observation?subject={subject}&code={code}
Observation.Strategy=PATIENT
Condition.Query=Condition?subject={subject}&category={category}
Condition.Strategy=PATIENT
Goal.Query=Goal?subject={subject}&lifecycle-status=active
Expand Down
2 changes: 1 addition & 1 deletion epic-config/poc/fhirconfig.properties
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ protocol.answer.no=Did NOT Follow BP Protocol
# e.g. with note text "Systolic: 130, Diastolic: 80", systolic-regex might be "Systolic: ([0-9]+)"
# with note text "BP Goal: 130/80", systolic-regex might be "([0-9]+)\\/"
############################################
service-request-order.bp-goal.custom-codings=urn:oid:1.2.840.114350.1.13.135.3.7.2.696580|340941|COACH PATIENT REPORTED BLOOD PRESSURE
service-request-order.bp-goal.codings=urn:oid:1.2.840.114350.1.13.135.3.7.2.696580|340941|COACH PATIENT REPORTED BLOOD PRESSURE
service-request-order.bp-goal.note.systolic-regex=Systolic: ([0-9]+)
service-request-order.bp-goal.note.diastolic-regex=Diastolic: ([0-9]+)
2 changes: 1 addition & 1 deletion logica-config/fhirconfig.properties
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ protocol.answer.no=Did NOT Follow BP Protocol
# e.g. with note text "Systolic: 130, Diastolic: 80", systolic-regex might be "Systolic: ([0-9]+)"
# with note text "BP Goal: 130/80", systolic-regex might be "([0-9]+)\\/"
############################################
service-request-order.bp-goal.custom-codings=
service-request-order.bp-goal.codings=
service-request-order.bp-goal.note.systolic-regex=
service-request-order.bp-goal.note.diastolic-regex=
6 changes: 2 additions & 4 deletions logica-config/fhirqueries.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ Patient.Lookup=Patient/{id}
Patient.Strategy=PATIENT
Encounter.Query=Encounter?subject={subject}
Encounter.Strategy=PATIENT
Observation.Category.Query=Observation?subject={subject}&category={category}
Observation.Category.Strategy=PATIENT
Observation.Code.Query=Observation?subject={subject}&code={code}
Observation.Code.Strategy=PATIENT
Observation.Query=Observation?subject={subject}&code={code}
Observation.Strategy=PATIENT
Condition.Query=Condition?subject={subject}&category={category}
Condition.Strategy=PATIENT
Goal.Query=Goal?subject={subject}&lifecycle-status=active
Expand Down
2 changes: 1 addition & 1 deletion meld-config/fhirconfig.properties
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ protocol.answer.no=Did NOT Follow BP Protocol
# e.g. with note text "Systolic: 130, Diastolic: 80", systolic-regex might be "Systolic: ([0-9]+)"
# with note text "BP Goal: 130/80", systolic-regex might be "([0-9]+)\\/"
############################################
service-request-order.bp-goal.custom-codings=
service-request-order.bp-goal.codings=
service-request-order.bp-goal.note.systolic-regex=
service-request-order.bp-goal.note.diastolic-regex=
6 changes: 2 additions & 4 deletions meld-config/fhirqueries.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ Patient.Lookup=Patient/{id}
Patient.Strategy=PATIENT
Encounter.Query=Encounter?subject={subject}
Encounter.Strategy=PATIENT
Observation.Category.Query=Observation?subject={subject}&category={category}
Observation.Category.Strategy=PATIENT
Observation.Code.Query=Observation?subject={subject}&code={code}
Observation.Code.Strategy=PATIENT
Observation.Query=Observation?subject={subject}&code={code}
Observation.Strategy=PATIENT
Condition.Query=Condition?subject={subject}&category={category}
Condition.Strategy=PATIENT
Goal.Query=Goal?subject={subject}&lifecycle-status=active
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/edu/ohsu/cmp/coach/fhir/FhirConfigManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class FhirConfigManager {
@Value("${protocol.answer.yes}") private String protocolAnswerYes;
@Value("${protocol.answer.no}") private String protocolAnswerNo;

private List<Coding> serviceRequestOrderBPGoalCustomCodings = null;
private List<Coding> serviceRequestOrderBPGoalCodings = null;
private Pattern serviceRequestOrderBPGoalNoteSystolicRegex = null;
private Pattern serviceRequestOrderBPGoalNoteDiastolicRegex = null;

Expand Down Expand Up @@ -265,11 +265,11 @@ public List<Coding> getPulseCustomCodings() {
return pulseCustomCodings;
}

public List<Coding> getServiceRequestOrderBPGoalCustomCodings() {
if (serviceRequestOrderBPGoalCustomCodings == null) {
serviceRequestOrderBPGoalCustomCodings = buildCodings(env.getProperty("service-request-order.bp-goal.custom-codings"));
public List<Coding> getServiceRequestOrderBPGoalCodings() {
if (serviceRequestOrderBPGoalCodings == null) {
serviceRequestOrderBPGoalCodings = buildCodings(env.getProperty("service-request-order.bp-goal.codings"));
}
return serviceRequestOrderBPGoalCustomCodings;
return serviceRequestOrderBPGoalCodings;
}

public Pattern getServiceRequestOrderBPGoalNoteSystolicRegex() {
Expand Down Expand Up @@ -377,10 +377,10 @@ private List<Coding> buildCodings(String s) {
* @param s a string of the form "system|code" or "system|code|display"
* Coding components may be blank; if they are, those components are ignored
* e.g., "system" -> Coding("system", null, null)
* "system|coding" -> Coding("system", "coding", null)
* "system|coding|display" -> Coding("system", "coding", "display")
* "|coding" -> Coding(null, "coding", null)
* "|coding|display" -> Coding(null, "coding", "display")
* "system|code" -> Coding("system", "code", null)
* "system|code|display" -> Coding("system", "code", "display")
* "|code" -> Coding(null, "code", null)
* "|code|display" -> Coding(null, "code", "display")
* "system||display" -> Coding("system", null, "display")
* "||display" -> Coding(null, null, "display")
*
Expand Down
30 changes: 15 additions & 15 deletions src/main/java/edu/ohsu/cmp/coach/fhir/FhirQueryManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ public class FhirQueryManager {
@Value("${Patient.Strategy}") private FhirStrategy patientStrategy;
@Value("${Encounter.Query}") private String encounterQuery;
@Value("${Encounter.Strategy}") private FhirStrategy encounterStrategy;
@Value("${Observation.Category.Query}") private String observationCategoryQuery;
@Value("${Observation.Category.Strategy}") private FhirStrategy observationCategoryStrategy;
@Value("${Observation.Code.Query}") private String observationCodeQuery;
@Value("${Observation.Code.Strategy}") private FhirStrategy observationCodeStrategy;
// @Value("${Observation.Category.Query}") private String observationCategoryQuery;
// @Value("${Observation.Category.Strategy}") private FhirStrategy observationCategoryStrategy;
@Value("${Observation.Query}") private String observationQuery;
@Value("${Observation.Strategy}") private FhirStrategy observationStrategy;
@Value("${Condition.Query}") private String conditionQuery;
@Value("${Condition.Strategy}") private FhirStrategy conditionStrategy;
@Value("${Goal.Query}") private String goalQuery;
Expand Down Expand Up @@ -46,20 +46,20 @@ public FhirStrategy getEncounterStrategy() {
return encounterStrategy;
}

public String getObservationCategoryQuery() {
return observationCategoryQuery;
}

public FhirStrategy getObservationCategoryStrategy() {
return observationCategoryStrategy;
}
// public String getObservationCategoryQuery() {
// return observationCategoryQuery;
// }
//
// public FhirStrategy getObservationCategoryStrategy() {
// return observationCategoryStrategy;
// }

public String getObservationCodeQuery() {
return observationCodeQuery;
public String getObservationQuery() {
return observationQuery;
}

public FhirStrategy getObservationCodeStrategy() {
return observationCodeStrategy;
public FhirStrategy getObservationStrategy() {
return observationStrategy;
}

public String getConditionQuery() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,35 +80,35 @@ public String getEncounterQuery(String patientId, String lookbackPeriod) {
);
}

@Override
public String getObservationCategoryQuery(String patientId, String category) {
return getObservationCategoryQuery(patientId, category, null);
}

@Override
public String getObservationCategoryQuery(String patientId, String category, String lookbackPeriod) {
String observationCategoryQuery = workspace.getFhirQueryManager().getObservationCategoryQuery();
String query = lookbackPeriod != null ?
addLookbackPeriodParam(observationCategoryQuery, lookbackPeriod) :
observationCategoryQuery;

return buildQuery(query, params()
.add(TOKEN_SUBJECT, patientId)
.add(TOKEN_CATEGORY, category)
);
}
// @Override
// public String getObservationCategoryQuery(String patientId, String category) {
// return getObservationCategoryQuery(patientId, category, null);
// }
//
// @Override
// public String getObservationCategoryQuery(String patientId, String category, String lookbackPeriod) {
// String observationCategoryQuery = workspace.getFhirQueryManager().getObservationCategoryQuery();
// String query = lookbackPeriod != null ?
// addLookbackPeriodParam(observationCategoryQuery, lookbackPeriod) :
// observationCategoryQuery;
//
// return buildQuery(query, params()
// .add(TOKEN_SUBJECT, patientId)
// .add(TOKEN_CATEGORY, category)
// );
// }

@Override
public String getObservationCodeQuery(String patientId, String code) {
return getObservationCodeQuery(patientId, code, null);
public String getObservationQuery(String patientId, String code) {
return getObservationQuery(patientId, code, null);
}

@Override
public String getObservationCodeQuery(String patientId, String code, String lookbackPeriod) {
String observationCodeQuery = workspace.getFhirQueryManager().getObservationCodeQuery();
public String getObservationQuery(String patientId, String code, String lookbackPeriod) {
String observationQuery = workspace.getFhirQueryManager().getObservationQuery();
String query = StringUtils.isNotBlank(lookbackPeriod) ?
addLookbackPeriodParam(observationCodeQuery, lookbackPeriod) :
observationCodeQuery;
addLookbackPeriodParam(observationQuery, lookbackPeriod) :
observationQuery;

return buildQuery(query, params()
.add(TOKEN_SUBJECT, patientId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public interface VendorTransformer {
String getPatientLookup(String id);
String getEncounterQuery(String patientId);
String getEncounterQuery(String patientId, String lookbackPeriod);
String getObservationCategoryQuery(String patientId, String category);
String getObservationCategoryQuery(String patientId, String category, String lookbackPeriod);
String getObservationCodeQuery(String patientId, String code);
String getObservationCodeQuery(String patientId, String code, String lookbackPeriod);
// String getObservationCategoryQuery(String patientId, String category);
// String getObservationCategoryQuery(String patientId, String category, String lookbackPeriod);
String getObservationQuery(String patientId, String code);
String getObservationQuery(String patientId, String code, String lookbackPeriod);
String getConditionQuery(String patientId, String category);
String getGoalQuery(String patientId);
String getMedicationStatementQuery(String patientId);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/edu/ohsu/cmp/coach/service/EHRService.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ public Bundle getObservations(String sessionId, String code, String lookbackPeri
logger.info("getting Observations for session=" + sessionId + " having code(s): " + code);
UserWorkspace workspace = userWorkspaceService.get(sessionId);
FHIRCredentialsWithClient fcc = workspace.getFhirCredentialsWithClient();
return fhirService.search(fcc, workspace.getFhirQueryManager().getObservationCodeStrategy(),
workspace.getVendorTransformer().getObservationCodeQuery(fcc.getCredentials().getPatientId(), code, lookbackPeriod),
return fhirService.search(fcc, workspace.getFhirQueryManager().getObservationStrategy(),
workspace.getVendorTransformer().getObservationQuery(fcc.getCredentials().getPatientId(), code, lookbackPeriod),
new Function<ResourceWithBundle, Boolean>() {
@Override
public Boolean apply(ResourceWithBundle resourceWithBundle) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/edu/ohsu/cmp/coach/service/GoalService.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public Bundle buildServiceRequestBasedBPGoals(String sessionId) {
if (entry.getResource() instanceof ServiceRequest) {
ServiceRequest sr = (ServiceRequest) entry.getResource();
try {
if (sr.hasCode() && FhirUtil.hasCoding(sr.getCode(), fcm.getServiceRequestOrderBPGoalCustomCodings())) {
if (sr.hasCode() && FhirUtil.hasCoding(sr.getCode(), fcm.getServiceRequestOrderBPGoalCodings())) {
Goal g = buildBPGoal(sessionId, sr);
if (logger.isDebugEnabled()) {
logger.debug("created Goal: " + FhirUtil.toJson(g));
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/edu/ohsu/cmp/coach/util/ObservationUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ public static ObservationSource getBPSource(Observation bpObservation, FhirConfi
ObservationSource.UNKNOWN;
}

// todo : getPulseSource doesn't have an implementation that takes Encounter as a parameter, as getBPSource
// functions above do. This means that the PulseModel constructor doesn't make use of a fallback strategy
// in the way that BloodPressureModel does, and this should be updated

public static ObservationSource getPulseSource(Observation pulseObservation) {
return FhirUtil.hasHomeSettingExtension(pulseObservation) ?
ObservationSource.HOME : // this should remain generic HOME as a more specific source is unknown
Expand Down
Loading
Loading