-
Notifications
You must be signed in to change notification settings - Fork 0
Derive observation type from the observation type's category #748
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
base: release26.7-SNAPSHOT
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,13 +22,13 @@ | |
| public class NIRCClinicalObservationsFormSection extends BaseFormSection | ||
| { | ||
| public static final String LABEL = "Observations"; | ||
| private boolean _autoPopulateDailyObs; | ||
| private final String _dailyObsOption; | ||
|
|
||
| public NIRCClinicalObservationsFormSection(boolean autoPopulateDailyObs, boolean initCollapsed) | ||
| public NIRCClinicalObservationsFormSection(String dailyObsOption, boolean initCollapsed) | ||
| { | ||
| super("study", "clinical_observations", LABEL, "ehr-clinicalobservationgridpanel", true, initCollapsed, true); | ||
|
|
||
| _autoPopulateDailyObs = autoPopulateDailyObs; | ||
| _dailyObsOption = dailyObsOption; | ||
| addClientDependency(ClientDependency.supplierFromPath("ehr/plugin/ClinicalObservationsCellEditing.js")); | ||
| addClientDependency(ClientDependency.supplierFromPath("nirc_ehr/data/ClinicalObservationClientStore.js")); | ||
| addClientDependency(ClientDependency.supplierFromPath("ehr/grid/ClinicalObservationGridPanel.js")); | ||
|
|
@@ -37,9 +37,9 @@ public NIRCClinicalObservationsFormSection(boolean autoPopulateDailyObs, boolean | |
| setClientStoreClass("NIRC_EHR.data.ClinicalObservationsClientStore"); | ||
| } | ||
|
|
||
| public NIRCClinicalObservationsFormSection(boolean isChild, String parentQueryName) | ||
| public NIRCClinicalObservationsFormSection(String dailyObsOption, boolean isChild, String parentQueryName) | ||
| { | ||
| this(false, true); | ||
| this(dailyObsOption, true); | ||
|
|
||
| if (isChild && null != parentQueryName) | ||
| { | ||
|
|
@@ -57,12 +57,9 @@ public List<String> getTbarButtons() | |
| { | ||
| List<String> defaults = super.getTbarButtons(); | ||
|
|
||
| if (_autoPopulateDailyObs) | ||
| if (_dailyObsOption != null) | ||
| { | ||
| defaults.add("NIRC_AUTO_POPULATE_DAILY_OBS"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I might have missed, but do we need |
||
| } | ||
| else { | ||
| defaults.add("NIRC_DAILY_CLINICAL_OBS"); | ||
| defaults.add(_dailyObsOption); | ||
| } | ||
|
|
||
| return defaults; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,6 +83,7 @@ public class NIRC_EHRTriggerHelper | |
| private User _user; | ||
| private static final Logger _log = LogManager.getLogger(NIRC_EHRTriggerHelper.class); | ||
| private final Map<String,Object> _cachedDrugFormulary = new HashMap<>(); | ||
| private final Map<String,String> _cachedObservationTypeCategories = new HashMap<>(); | ||
|
|
||
| // Maps an originating observation order's taskid to the task its scheduled observations are grouped under, | ||
| // for the duration of a single save batch (the same helper instance is reused across rows in the batch). | ||
|
|
@@ -810,6 +811,26 @@ public void ensureDailyClinicalObservationOrders(String id, String caseid, final | |
| } | ||
| } | ||
|
|
||
| /** | ||
| * Returns the category of an observation type from ehr.observation_types, or null when the type has no | ||
| * category or is not found. Cached for the life of the save batch. | ||
| */ | ||
| public String getObservationTypeCategory(String observationType) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this cache ever need to be cleared for when ehr.observation_types is edited? |
||
| { | ||
| if (observationType == null) | ||
| return null; | ||
|
|
||
| if (!_cachedObservationTypeCategories.containsKey(observationType)) | ||
| { | ||
| TableInfo ti = getTableInfo("ehr", "observation_types"); | ||
| SimpleFilter filter = new SimpleFilter(FieldKey.fromString("value"), observationType); | ||
| List<String> categories = new TableSelector(ti, Collections.singleton("category"), filter, null).getArrayList(String.class); | ||
| _cachedObservationTypeCategories.put(observationType, categories.isEmpty() ? null : categories.get(0)); | ||
| } | ||
|
|
||
| return _cachedObservationTypeCategories.get(observationType); | ||
| } | ||
|
|
||
| // This helper function propagates clinical observations through clinical cases | ||
| public Map<String, Object> handleScheduledObservations(Map<String, Object> row, String qcstate, String orderTasks) throws SQLException, BatchValidationException, QueryUpdateServiceException, DuplicateKeyException | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it be case insensitive check?