diff --git a/nirc_ehr/resources/data/alopecia_score.tsv b/nirc_ehr/resources/data/alopecia_score.tsv index d6b82ab5..2c4a408d 100644 --- a/nirc_ehr/resources/data/alopecia_score.tsv +++ b/nirc_ehr/resources/data/alopecia_score.tsv @@ -1,25 +1,6 @@ -value sort_order description Date Disabled -0% 1 -1% 2 -9% 3 -10% 4 -18% 5 -19% 6 -27% 7 -28% 8 -36% 9 -37% 10 -45% 11 -46% 12 -54% 13 -55% 14 -63% 15 -64% 16 -72% 17 -73% 18 -81% 19 -82% 20 -90% 21 -91% 22 -99% 23 -100% 24 \ No newline at end of file +value title sort_order description Date Disabled +Very good coat condition (1) Very good coat condition (1) 1 +1-25% hair loss (2) 1-25% hair loss (2) 2 +25-50% hair loss (3) 25-50% hair loss (3) 3 +More than 50% (4) More than 50% (4) 4 +Completely bald (5) Completely bald (5) 5 \ No newline at end of file diff --git a/nirc_ehr/resources/data/bcs_score.tsv b/nirc_ehr/resources/data/bcs_score.tsv index 9fa3c1c4..4f02d849 100644 --- a/nirc_ehr/resources/data/bcs_score.tsv +++ b/nirc_ehr/resources/data/bcs_score.tsv @@ -1,10 +1,10 @@ value title category description sort_order date_disabled -1 Emaciated -1.5 Very Thin -2 Thin -2.5 Lean -3 Optimum -3.5 Slightly Overweight -4 Heavy -4.5 Obese -5 Grossly Obese +Emaciated (1) 1 +Very Thin (1.5) 2 +Thin (2) 3 +Lean (2.5) 4 +Optimum (3) 5 +Slightly Overweight (3.5) 6 +Heavy (4) 7 +Obese (4.5) 8 +Grossly Obese (5) 9 diff --git a/nirc_ehr/resources/data/behavior_mgmt_codes.tsv b/nirc_ehr/resources/data/behavior_mgmt_codes.tsv new file mode 100644 index 00000000..60efc6e7 --- /dev/null +++ b/nirc_ehr/resources/data/behavior_mgmt_codes.tsv @@ -0,0 +1,4 @@ +value title sort_order description Date Disabled +No Fleece Tube No Fleece Tube 1 +Fleece Tube Fleece Tube 2 +Wood Wood 3 \ No newline at end of file diff --git a/nirc_ehr/resources/data/daily_enrich_codes.tsv b/nirc_ehr/resources/data/daily_enrich_codes.tsv new file mode 100644 index 00000000..8705eaf7 --- /dev/null +++ b/nirc_ehr/resources/data/daily_enrich_codes.tsv @@ -0,0 +1,13 @@ +value title sort_order description Date Disabled +Cone Cone 1 +Cap Feeder Cap Feeder 2 +Blind Forager Blind Forager 3 +Dried Fruit Dried Fruit 4 +Forage on Board Forage on Board 5 +Forage Tray Forage Tray 6 +Produce Produce 7 +Paper Burrito Paper Burrito 8 +Puzzle Feeder Puzzle Feeder 9 +Paper Paper 10 +Fleece Tube Replaced Fleece Tube Replaced 11 +Other Other 12 \ No newline at end of file diff --git a/nirc_ehr/resources/data/editable_lookups.tsv b/nirc_ehr/resources/data/editable_lookups.tsv index b78d2b06..34cb051a 100644 --- a/nirc_ehr/resources/data/editable_lookups.tsv +++ b/nirc_ehr/resources/data/editable_lookups.tsv @@ -12,6 +12,7 @@ arrival_type Colony Management Arrival Type Types of arrivals. arthritis_types Clinical Arthritis Types Clinical observation fixed values. att_score Behavior Attitude Score Behavior observation fixed values. bcs_score Clinical Body Condition Score Clinical observation fixed values. +behavior_mgmt_codes Behavior Behavior Managment Codes Behavior observation fixed values. behavior_types Behavior Behavior Types Behavior observation fixed values. blood_draw_reason Clinical Blood Draw Reason Used in blood draw datasets. blood_draw_tube_type Clinical Blood Draw Tube Type Used in blood draw datasets. @@ -28,6 +29,7 @@ cost_center Colony Management Cost Center cost_type Colony Management Cost Type country Colony Management Country country_category Colony Management Country Category +daily_enrich_codes Behavior Daily enrichment codes. data_category Clinical Data Categories Used in datasets. death_reason Colony Management Death Reason delivery_state Colony Management Delivery State @@ -36,6 +38,7 @@ dental_trauma Clinical Dental Trauma Clinical observation fixed values. digit_amputation Clinical Digit Amputation Clinical observation fixed values. divider_types Colony Management Divider Type Used in cage details. dosage_units Clinical Dosage Units Used in drug and treatment datasets. +drug_defaults Clinical Formulary Default values in drug and treatment datasets. ear_types Clinical Ear Types Clinical observation fixed values. esig_events Colony Management Esig Events euthanasia_type Colony Management Euthanasia Type @@ -114,4 +117,6 @@ vendor_production_location Colony Management Vendor Production Location volume_units Clinical Volume Units Used in drug and treatment datasets. weight_ranges Clinical Weight Ranges Min/Max allowable weight per species. Used in various weight reports. wound_score Clinical Wound Score Clinical observation fixed values. -yesno Clinical Yes/No Values Used for yes/no values in various datasets \ No newline at end of file +wound_severity Clinical Wound Severity Clinical observation fixed values. +wound_status Clinical Wound Status Clinical observation fixed values. +yes_no_order Clinical Yes/No Values in Order Used for yes/no values in various datasets. Includes sort order. \ No newline at end of file diff --git a/nirc_ehr/resources/data/lookup_sets.tsv b/nirc_ehr/resources/data/lookup_sets.tsv index 566d5346..78d3272a 100644 --- a/nirc_ehr/resources/data/lookup_sets.tsv +++ b/nirc_ehr/resources/data/lookup_sets.tsv @@ -10,6 +10,7 @@ arrival_type Arrival Type value arthritis_types Arthritis Types value att_score Attitude Score value bcs_score BCS Store value title +behavior_mgmt_codes Behavior Management Codes value behavior_types Behavior Types value blood_draw_reason Blood Draw Reason value blood_sample_type Blood Sample Types value @@ -22,6 +23,7 @@ cost_center Cost Center value title cost_type Cost Type value title country Country value title country_category Country Category value title +daily_enrich_codes Daily Enrichment Codes value data_category Data Category Field Values value death_reason Death Reason value delivery_state Delivery State value title @@ -96,4 +98,6 @@ vendor_approval_code Vendor Approval Code value title vendor_production_location Vendor Production Location value title weight_ranges Weight Ranges value wound_score Wound Score value -yesno Yes/No Values value \ No newline at end of file +wound_severity Wound Severity value +wound_status Wound Status value +yes_no_order Yes/No Values in Order value \ No newline at end of file diff --git a/nirc_ehr/resources/data/lookupsManifest.tsv b/nirc_ehr/resources/data/lookupsManifest.tsv index 57c94a24..fbe53604 100644 --- a/nirc_ehr/resources/data/lookupsManifest.tsv +++ b/nirc_ehr/resources/data/lookupsManifest.tsv @@ -12,6 +12,7 @@ arrival_type arthritis_types att_score bcs_score +behavior_mgmt_codes behavior_types blood_draw_reason blood_draw_tube_type @@ -25,6 +26,7 @@ conc_units cost_type country country_category +daily_enrich_codes data_category death_reason delivery_state @@ -107,4 +109,6 @@ vendor_production_location volume_units weight_ranges wound_score -yesno \ No newline at end of file +wound_severity +wound_status +yes_no_order \ No newline at end of file diff --git a/nirc_ehr/resources/data/lookupsManifestTest.tsv b/nirc_ehr/resources/data/lookupsManifestTest.tsv index 1a95827c..cb967c9e 100644 --- a/nirc_ehr/resources/data/lookupsManifestTest.tsv +++ b/nirc_ehr/resources/data/lookupsManifestTest.tsv @@ -11,6 +11,7 @@ app_score arrival_type arthritis_types bcs_score +behavior_mgmt_codes behavior_types blood_draw_reason blood_draw_tube_type @@ -24,6 +25,7 @@ congenital_abnormalities cost_type country country_category +daily_enrich_codes data_category death_reason delivery_state @@ -109,4 +111,6 @@ vendor_production_location volume_units weight_ranges wound_score -yesno \ No newline at end of file +wound_severity +wound_status +yes_no_order \ No newline at end of file diff --git a/nirc_ehr/resources/data/observation_types.tsv b/nirc_ehr/resources/data/observation_types.tsv index 395e185e..fb1ee28b 100644 --- a/nirc_ehr/resources/data/observation_types.tsv +++ b/nirc_ehr/resources/data/observation_types.tsv @@ -1,7 +1,14 @@ value category editorconfig schemaName queryName valueColumn -Alopecia Score Behavior {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"alopecia_score","forceSelection":true,"displayField":"value","valueField":"value","sortFields":"sort_order"} ehr_lookups alopecia_score value +Alopecia Score Behavior {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"alopecia_score","forceSelection":true,"displayField":"title","valueField":"value","sortFields":"sort_order"} ehr_lookups alopecia_score value Alopecia Type Behavior {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"alopecia_type","forceSelection":true,"displayField":"value","valueField":"value","sortFields":"sort_order"} ehr_lookups alopecia_type value Alopecia Regrowth Behavior {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"alopecia_regrowth","forceSelection":true,"displayField":"value","valueField":"value","sortFields":"sort_order"} ehr_lookups alopecia_regrowth value +Behavior Managment Behavior {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"behavior_mgmt_codes","forceSelection":true,"displayField":"title","valueField":"value","sortFields":"sort_order"} ehr_lookups behavior_mgmt_codes value +Daily Enrichment Behavior {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"daily_enrich_codes","forceSelection":true,"displayField":"title","valueField":"value","sortFields":"sort_order"} ehr_lookups daily_enrich_codes value +Self Biting Observed Behavior {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"yes_no_order","forceSelection":true,"displayField":"value","valueField":"value","sortFields":"sort_order"} ehr_lookups yes_no_order value +New Injury Observed Behavior {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"yes_no_order","forceSelection":true,"displayField":"value","valueField":"value","sortFields":"sort_order"} ehr_lookups yes_no_order value +Other Stereotopy Behavior {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"yes_no_order","forceSelection":true,"displayField":"value","valueField":"value","sortFields":"sort_order"} ehr_lookups yes_no_order value +Environmental Change Behavior {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"yes_no_order","forceSelection":true,"displayField":"value","valueField":"value","sortFields":"sort_order"} ehr_lookups yes_no_order value +Special Enrichment Behavior {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"yes_no_order","forceSelection":true,"displayField":"value","valueField":"value","sortFields":"sort_order"} ehr_lookups yes_no_order value Preferences Behavior {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"preferences","displayField":"value","valueField":"value"} ehr_lookups preferences value Temperament Behavior {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"temperament","displayField":"value","valueField":"value"} ehr_lookups temperament value BCS {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"bcs_score","forceSelection":true,"displayField":"value","valueField":"value"} ehr_lookups bcs_score value @@ -22,7 +29,7 @@ TB TST Score (Day 2) {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","que TB TST Score (Day 3) {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"tb_obs_score","displayField":"value","valueField":"value","sortFields":"sort_order"} ehr_lookups tb_obs_score value Auscultation {"xtype":"textfield"} Abdominal Palpation {"xtype":"textfield"} -Pregnant {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"yesno","forceSelection":true,"displayField":"value","valueField":"value"} ehr_lookups yesno value +Pregnant {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"yes_no_order","forceSelection":true,"displayField":"value","valueField":"value","sortFields":"sort_order"} ehr_lookups yes_no_order value Dental Disease {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"dental_disease","forceSelection":true,"displayField":"value","valueField":"value","sortFields":"sort_order"} ehr_lookups dental_disease value Congenital Abnormalities {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"congenital_abnormalities","forceSelection":true,"displayField":"value","valueField":"value","sortFields":"sort_order"} ehr_lookups congenital_abnormalities value Urine {"xtype":"textfield"} @@ -31,6 +38,8 @@ Gait/Posture {"xtype":"textfield"} Digit Amputation {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"digit_amputation","displayField":"value","valueField":"value"} Dental Trauma {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"dental_trauma","displayField":"value","valueField":"value","sortFields":"sort_order"} Wound Score {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"wound_score","displayField":"value","valueField":"value","sortFields":"sort_order"} +Wound Status Behavior {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"wound_status","displayField":"value","valueField":"value","sortFields":"sort_order"} +Wound Severity Behavior {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"wound_severity","displayField":"value","valueField":"value","sortFields":"sort_order"} Fecal Score {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"fecal_score","displayField":"value","valueField":"value"} ehr_lookups fecal_score value Trauma: Laceration {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"trauma_size","displayField":"value","valueField":"value","sortFields":"sort_order"} ehr_lookups trauma_size value Trauma: Degloving {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"trauma_size","displayField":"value","valueField":"value","sortFields":"sort_order"} ehr_lookups trauma_size value @@ -56,6 +65,6 @@ Respiratory Tract {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryN Feed Assessment Behavior {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"feed_assess_types","displayField":"value","valueField":"value"} ehr_lookups feed_assess_types value Stool {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"stool_types","displayField":"value","sortFields":"sort_order","valueField":"value"} Activity Behavior {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"activity","forceSelection":true,"displayField":"value","valueField":"value","sortFields":"sort_order"} ehr_lookups activity value -Verified Id? {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"yesno","forceSelection":true,"displayField":"value","valueField":"value","sortFields":"sort_order"} ehr_lookups yesno value +Verified Id? {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"yes_no_order","forceSelection":true,"displayField":"value","valueField":"value","sortFields":"sort_order"} ehr_lookups yes_no_order value Turgor {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"turgor_score","displayField":"value","sortFields":"sort_order","valueField":"value"} SIB Score Behavior {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"sib_score","forceSelection":true,"displayField":"value","valueField":"value"} ehr_lookups sib_score value diff --git a/nirc_ehr/resources/data/treatment_frequency.tsv b/nirc_ehr/resources/data/treatment_frequency.tsv index 6841e1a6..0a62bed3 100644 --- a/nirc_ehr/resources/data/treatment_frequency.tsv +++ b/nirc_ehr/resources/data/treatment_frequency.tsv @@ -1,5 +1,6 @@ Meaning Sort Order Week of Month Day of Month Day of Week Interval in Days Short Name Active? Monthly 30 true +Weekly 7 true Alternating Days 2 true SID 1 true QID 1 true diff --git a/nirc_ehr/resources/data/treatment_frequency_times.tsv b/nirc_ehr/resources/data/treatment_frequency_times.tsv index e45d370e..92a33eb6 100644 --- a/nirc_ehr/resources/data/treatment_frequency_times.tsv +++ b/nirc_ehr/resources/data/treatment_frequency_times.tsv @@ -1,6 +1,7 @@ Frequency Hour of Day Time Description SID 800 AM Monthly 800 AM +Weekly 800 AM Alternating Days 800 AM TID 800 AM TID 1200 PM diff --git a/nirc_ehr/resources/data/wound_severity.tsv b/nirc_ehr/resources/data/wound_severity.tsv new file mode 100644 index 00000000..480eaabd --- /dev/null +++ b/nirc_ehr/resources/data/wound_severity.tsv @@ -0,0 +1,6 @@ +value sort_order +N/A (0) 1 +Superficial (1) 2 +Partial Thickness (2) 3 +Full Thickness (3) 4 +Muscle Damage (4) 5 \ No newline at end of file diff --git a/nirc_ehr/resources/data/wound_status.tsv b/nirc_ehr/resources/data/wound_status.tsv new file mode 100644 index 00000000..6db86ef5 --- /dev/null +++ b/nirc_ehr/resources/data/wound_status.tsv @@ -0,0 +1,5 @@ +value sort_order +Completely Healed (0) 1 +Mostly Healed (1) 2 +Partially Healed (2) 3 +Not Healed (4) 4 \ No newline at end of file diff --git a/nirc_ehr/resources/data/yes_no_order.tsv b/nirc_ehr/resources/data/yes_no_order.tsv new file mode 100644 index 00000000..90cd6525 --- /dev/null +++ b/nirc_ehr/resources/data/yes_no_order.tsv @@ -0,0 +1,4 @@ +value sort_order +Yes 1 +No 2 +N/A 3 \ No newline at end of file diff --git a/nirc_ehr/resources/data/yesno.tsv b/nirc_ehr/resources/data/yesno.tsv deleted file mode 100644 index 31bed3c8..00000000 --- a/nirc_ehr/resources/data/yesno.tsv +++ /dev/null @@ -1,4 +0,0 @@ -value -Yes -No -N/A diff --git a/nirc_ehr/resources/queries/ehr_lookups/snomed.query.xml b/nirc_ehr/resources/queries/ehr_lookups/snomed.query.xml new file mode 100644 index 00000000..4613f3ef --- /dev/null +++ b/nirc_ehr/resources/queries/ehr_lookups/snomed.query.xml @@ -0,0 +1,9 @@ + + + + + Treatments +
+
+
+
\ No newline at end of file diff --git a/nirc_ehr/resources/queries/study/cases.js b/nirc_ehr/resources/queries/study/cases.js index e452727f..874ab0ab 100644 --- a/nirc_ehr/resources/queries/study/cases.js +++ b/nirc_ehr/resources/queries/study/cases.js @@ -24,7 +24,7 @@ EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Even } var reopen = oldRow && oldRow.enddate && !row.enddate; - if (!helper.isValidateOnly() && (reopen || helper.getEvent() == 'insert') && row.caseid && row.Id && row.performedby && row.taskid) { + if (!helper.isValidateOnly() && (reopen || helper.getEvent() == 'insert') && row.caseid && row.Id && row.performedby && row.taskid && row.category == 'Clinical') { var qc; if (row.QCStateLabel) { qc = EHR.Server.Security.getQCStateByLabel(row.QCStateLabel); diff --git a/nirc_ehr/resources/queries/study/cases/Active Behavior Cases.qview.xml b/nirc_ehr/resources/queries/study/cases/Active Behavior Cases.qview.xml index 83432037..0f3bf9fc 100644 --- a/nirc_ehr/resources/queries/study/cases/Active Behavior Cases.qview.xml +++ b/nirc_ehr/resources/queries/study/cases/Active Behavior Cases.qview.xml @@ -4,8 +4,7 @@ - - + diff --git a/nirc_ehr/resources/queries/study/cases/Active Clinical Cases.qview.xml b/nirc_ehr/resources/queries/study/cases/Active Clinical Cases.qview.xml index 52910a50..66d5aea1 100644 --- a/nirc_ehr/resources/queries/study/cases/Active Clinical Cases.qview.xml +++ b/nirc_ehr/resources/queries/study/cases/Active Clinical Cases.qview.xml @@ -1,6 +1,7 @@ + @@ -22,10 +23,9 @@ - - + diff --git a/nirc_ehr/resources/queries/study/cases/All Behavior Cases.qview.xml b/nirc_ehr/resources/queries/study/cases/All Behavior Cases.qview.xml index 3a95581d..d460044b 100644 --- a/nirc_ehr/resources/queries/study/cases/All Behavior Cases.qview.xml +++ b/nirc_ehr/resources/queries/study/cases/All Behavior Cases.qview.xml @@ -1,17 +1,21 @@ + + - + + + + - - + diff --git a/nirc_ehr/resources/queries/study/cases/All Clinical Cases.qview.xml b/nirc_ehr/resources/queries/study/cases/All Clinical Cases.qview.xml index ed7a73b8..70c5f5bb 100644 --- a/nirc_ehr/resources/queries/study/cases/All Clinical Cases.qview.xml +++ b/nirc_ehr/resources/queries/study/cases/All Clinical Cases.qview.xml @@ -1,6 +1,7 @@ + diff --git a/nirc_ehr/resources/queries/study/clinical_observations.js b/nirc_ehr/resources/queries/study/clinical_observations.js index 6dff14bb..45b57ddb 100644 --- a/nirc_ehr/resources/queries/study/clinical_observations.js +++ b/nirc_ehr/resources/queries/study/clinical_observations.js @@ -27,6 +27,15 @@ function onUpsert(helper, scriptErrors, row, oldRow) { EHR.Server.Utils.addError(scriptErrors, 'remark', "You selected 'No' for 'Verified Id?', please enter Remark", "WARN"); } + if (row.category === "Daily Enrichment" && row.observation === "Other" && !row.remark) { + EHR.Server.Utils.addError(scriptErrors, 'remark', "You selected 'Other' for 'Daily Enrichment', please enter Remark", "WARN"); + } + + var yesRemarkRequired = (row.category === "Self Biting Observed" || row.category === "New Injury Observed" || row.category === "Other Stereotopy" || row.category === "Environmental Change" || row.category === "Special Enrichment"); + if (yesRemarkRequired && row.observation === "Yes" && !row.remark) { + EHR.Server.Utils.addError(scriptErrors, 'remark', "You selected 'Yes' for " + row.category + ", please explain in the Remark", "WARN"); + } + // Handle scheduled observations if (!helper.isValidateOnly() && row.scheduledDate) { var qc; diff --git a/nirc_ehr/resources/queries/study/clinical_observations/Behavior.qview.xml b/nirc_ehr/resources/queries/study/clinical_observations/Behavior.qview.xml index afddfc9d..0d61d3a0 100644 --- a/nirc_ehr/resources/queries/study/clinical_observations/Behavior.qview.xml +++ b/nirc_ehr/resources/queries/study/clinical_observations/Behavior.qview.xml @@ -12,6 +12,6 @@ - + \ No newline at end of file diff --git a/nirc_ehr/resources/queries/study/clinical_observations/Clinical.qview.xml b/nirc_ehr/resources/queries/study/clinical_observations/Clinical.qview.xml new file mode 100644 index 00000000..e333ee9b --- /dev/null +++ b/nirc_ehr/resources/queries/study/clinical_observations/Clinical.qview.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nirc_ehr/resources/queries/study/observation_order/Active Orders.qview.xml b/nirc_ehr/resources/queries/study/observation_order/Active Behavior Orders.qview.xml similarity index 90% rename from nirc_ehr/resources/queries/study/observation_order/Active Orders.qview.xml rename to nirc_ehr/resources/queries/study/observation_order/Active Behavior Orders.qview.xml index aaff737b..6d5251c5 100644 --- a/nirc_ehr/resources/queries/study/observation_order/Active Orders.qview.xml +++ b/nirc_ehr/resources/queries/study/observation_order/Active Behavior Orders.qview.xml @@ -13,6 +13,7 @@ + diff --git a/nirc_ehr/resources/queries/study/observation_order/Active Clinical Orders.qview.xml b/nirc_ehr/resources/queries/study/observation_order/Active Clinical Orders.qview.xml new file mode 100644 index 00000000..9f2855ed --- /dev/null +++ b/nirc_ehr/resources/queries/study/observation_order/Active Clinical Orders.qview.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nirc_ehr/resources/queries/study/observation_order/Behavior Orders.qview.xml b/nirc_ehr/resources/queries/study/observation_order/Behavior Orders.qview.xml new file mode 100644 index 00000000..19fbac02 --- /dev/null +++ b/nirc_ehr/resources/queries/study/observation_order/Behavior Orders.qview.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nirc_ehr/resources/queries/study/observation_order/Clinical Orders.qview.xml b/nirc_ehr/resources/queries/study/observation_order/Clinical Orders.qview.xml new file mode 100644 index 00000000..8fa59905 --- /dev/null +++ b/nirc_ehr/resources/queries/study/observation_order/Clinical Orders.qview.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nirc_ehr/resources/queries/study/treatmentSchedule.sql b/nirc_ehr/resources/queries/study/treatmentSchedule.sql index 0b7883d9..ce3530df 100644 --- a/nirc_ehr/resources/queries/study/treatmentSchedule.sql +++ b/nirc_ehr/resources/queries/study/treatmentSchedule.sql @@ -71,7 +71,6 @@ SELECT FROM nirc_ehr.dateRange dr JOIN study."Treatment Orders" t1 - --NOTE: should the enddate consider date/time? ON (dr.dateOnly >= t1.dateOnly and dr.dateOnly <= t1.enddateCoalesced AND --technically the first day of the treatment is day 1, not day 0 ((mod(CAST(timestampdiff('SQL_TSI_DAY', CAST(t1.dateOnly as timestamp), dr.dateOnly) as integer), t1.frequency.intervalindays) = 0 And t1.frequency.intervalindays is not null And t1.frequency.dayofweek is null )) @@ -90,8 +89,6 @@ LEFT JOIN ( --NOTE: if we run this report on a future interval, we want to include those treatments WHERE t1.date is not null ---NOTE: they have decided to include non-public data ---AND t1.qcstate.publicdata = true --and t1.dateOnly <= curdate() ) s1 diff --git a/nirc_ehr/resources/queries/study/treatment_order/Behavior Active Treatment Orders.qview.xml b/nirc_ehr/resources/queries/study/treatment_order/Behavior Active Treatment Orders.qview.xml new file mode 100644 index 00000000..77cd9939 --- /dev/null +++ b/nirc_ehr/resources/queries/study/treatment_order/Behavior Active Treatment Orders.qview.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/nirc_ehr/resources/queries/study/treatment_order/Behavior.qview.xml b/nirc_ehr/resources/queries/study/treatment_order/Behavior.qview.xml deleted file mode 100644 index 4f0ef20c..00000000 --- a/nirc_ehr/resources/queries/study/treatment_order/Behavior.qview.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/nirc_ehr/resources/queries/study/treatment_order/Clinical Active Treatment Orders.qview.xml b/nirc_ehr/resources/queries/study/treatment_order/Clinical Active Treatment Orders.qview.xml index d685132c..b85e1ee5 100644 --- a/nirc_ehr/resources/queries/study/treatment_order/Clinical Active Treatment Orders.qview.xml +++ b/nirc_ehr/resources/queries/study/treatment_order/Clinical Active Treatment Orders.qview.xml @@ -1,6 +1,6 @@ - - + + \ No newline at end of file diff --git a/nirc_ehr/resources/referenceStudy/study/datasets/datasets_metadata.xml b/nirc_ehr/resources/referenceStudy/study/datasets/datasets_metadata.xml index d15d622f..8c32956e 100644 --- a/nirc_ehr/resources/referenceStudy/study/datasets/datasets_metadata.xml +++ b/nirc_ehr/resources/referenceStudy/study/datasets/datasets_metadata.xml @@ -1041,7 +1041,7 @@ - Clinical Treatment Cases + Treatment Cases varchar diff --git a/nirc_ehr/resources/reports/additionalReports.tsv b/nirc_ehr/resources/reports/additionalReports.tsv index 6c246067..d9ae7f47 100644 --- a/nirc_ehr/resources/reports/additionalReports.tsv +++ b/nirc_ehr/resources/reports/additionalReports.tsv @@ -8,12 +8,14 @@ foster Reproductive Management query Fostering TRUE study foster FALSE FALSE projects Colony Management query Project Assignment TRUE study assignment FALSE FALSE qcstate/publicdata This is for project assignments chemistry Clinical query Chemistry TRUE study chemistryResults FALSE FALSE qcstate/publicdata This is for chemistry results alias Colony Management query Aliases true study demographicsAliases false false qcstate/publicdata This report shows the animal aliases -activeClinTreatmentOrders Clinical query Active Medication Orders true study treatment_order Clinical Active Treatment Orders date false false qcstate/publicdata This report contains the treatment orders entered for each animal +activeClinTreatmentOrders Clinical query Active Clinical Medication Orders true study treatment_order Clinical Active Treatment Orders date false false qcstate/publicdata This report contains the treatment orders entered for each animal +activeBehaviorTreatmentOrders Behavior query Active Behavior Medication Orders true study treatment_order Behavior Active Treatment Orders date false false qcstate/publicdata This report contains the treatment orders entered for each animal allTreatments Clinical query All Treatment Orders true study treatment_order false false qcstate/publicdata This report shows all treatment orders -behTreatments Clinical query Behavior Medication Orders true study treatment_order behavior false false qcstate/publicdata This report shows all treatment orders +behTreatments Behavior query All Behavior Medication Orders true study treatment_order behavior false false qcstate/publicdata This report shows all treatment orders FileRepository General js File Repository true study FileRepository false false qcstate/publicdata File Repository for uploading and viewing animal related files observationSchedule Daily Reports js Observation Schedule true study observationSchedule date false false qcstate/publicdata This report contains a list of today's treatments to be administered -activeObservationOrders Clinical query Active Observation Orders true study observation_order Active Orders date false false qcstate/publicdata This report contains a list of today's treatments to be administered +activeClinicalObservationOrders Clinical query Active Clinical Observation Orders true study observation_order Active Clinical Orders date false false qcstate/publicdata This report contains a list of today's treatments to be administered +activeBehaviorObservationOrders Behavior query Active Behavior Observation Orders true study observation_order Active Behavior Orders date false false qcstate/publicdata This report contains a list of today's treatments to be administered observationOrders Clinical query Observation Orders true study observation_order date false false qcstate/publicdata This report contains a list of today's treatments to be administered alopecia Clinical query Alopecia Scores TRUE study clinical_observations Alopecia Scores date FALSE FALSE qcstate/publicdata This report contains the alopecia scores for the animal behaviorCases Behavior query Active Behavior Cases true study cases Active Behavior Cases date false false qcstate/publicdata This displays active behavioral cases @@ -25,8 +27,9 @@ clinCases Clinical query All Clinical Cases true study Cases All Clinical Cases clinMedicationSchedule Daily Reports js Medication Schedule true study clinMedicationSchedule date false false qcstate/publicdata This report contains a list of today's treatments to be administered dietSchedule drug -incompleteTreatments -pairingsBehavior +incompleteTreatments Daily Reports js Incomplete Treatments true study incompleteTreatments date false false qcstate/publicdata This report contains a list of incomplete treatments for the previous 30 days +incompleteObservations Daily Reports js Incomplete Observations true study incompleteObservations date false false qcstate/publicdata This report contains a list of incomplete observations for the previous 30 days +pairingsBehavior pairingHousingSummary pairingSummary Behavior query Pairing Summary TRUE study pairingSummary date FALSE FALSE qcstate/publicdata This report displays animal pairings activePairing Behavior query Active Pairing TRUE study pairingSummary Active Pairing date FALSE FALSE qcstate/publicdata This report displays animal pairings diff --git a/nirc_ehr/resources/views/begin.html b/nirc_ehr/resources/views/begin.html index 65af337d..8f0e1606 100644 --- a/nirc_ehr/resources/views/begin.html +++ b/nirc_ehr/resources/views/begin.html @@ -165,7 +165,9 @@ }, items: [ {name: 'Today\'s Medication/Treatment Schedule', url: '<%=contextPath%>' + ctx['EHRStudyContainer'] + '/ehr-animalHistory.view#inputType:none&showReport:1&activeReport:clinMedicationSchedule'}, + {name: 'Incomplete Past Treatments', url: '<%=contextPath%>' + ctx['EHRStudyContainer'] + '/ehr-animalHistory.view#inputType:none&showReport:1&activeReport:incompleteTreatments'}, {name: 'Active Clinical Medication Orders', url: '<%=contextPath%>' + ctx['EHRStudyContainer'] + '/ehr-animalHistory.view#inputType:none&showReport:1&activeReport:activeClinTreatmentOrders'}, + {name: 'Active Behavior Medication Orders', url: '<%=contextPath%>' + ctx['EHRStudyContainer'] + '/ehr-animalHistory.view#inputType:none&showReport:1&activeReport:activeBehaviorTreatmentOrders'}, ] }, { @@ -176,7 +178,9 @@ }, items: [ {name: 'Today\'s Observation Schedule', url: '<%=contextPath%>' + ctx['EHRStudyContainer'] + '/ehr-animalHistory.view#inputType:none&showReport:1&activeReport:observationSchedule'}, - {name: 'Active Observation Orders', url: '<%=contextPath%>' + ctx['EHRStudyContainer'] + '/ehr-animalHistory.view#inputType:none&showReport:1&activeReport:activeObservationOrders'}, + {name: 'Incomplete Past Observations', url: '<%=contextPath%>' + ctx['EHRStudyContainer'] + '/ehr-animalHistory.view#inputType:none&showReport:1&activeReport:incompleteObservations'}, + {name: 'Active Clinical Observation Orders', url: '<%=contextPath%>' + ctx['EHRStudyContainer'] + '/ehr-animalHistory.view#inputType:none&showReport:1&activeReport:activeClinicalObservationOrders'}, + {name: 'Active Behavior Observation Orders', url: '<%=contextPath%>' + ctx['EHRStudyContainer'] + '/ehr-animalHistory.view#inputType:none&showReport:1&activeReport:activeBehaviorObservationOrders'}, ] } ] diff --git a/nirc_ehr/resources/web/nirc_ehr/model/sources/BehaviorRounds.js b/nirc_ehr/resources/web/nirc_ehr/model/sources/BehaviorRounds.js new file mode 100644 index 00000000..0c45965e --- /dev/null +++ b/nirc_ehr/resources/web/nirc_ehr/model/sources/BehaviorRounds.js @@ -0,0 +1,126 @@ +EHR.model.DataModelManager.registerMetadata('BehaviorRounds', { + allQueries: { + Id: { + inheritFromParent: true, + editable: false, + hidden: true, + columnConfig: { + editable: false + } + }, + date: { + editable: true, + hidden: false, + columnConfig: { + editable: true + } + }, + caseid: { + inheritFromParent: true, + editable: false, + hidden: true, + columnConfig: { + editable: false + } + } + }, + byQuery: { + 'study.cases': { + Id: { + xtype: 'nirc_ehr-animalIdCases', + inheritFromParent: false, + editable: true, + hidden: false, + columnConfig: { + editable: true + } + }, + date: { + id: 'open_date', + editorConfig: { + editable: false, + disabled: true, + fieldCls: 'form-panel-input-disabled', + labelClsExtra: 'form-panel-input-disabled' + }, + getInitialValue: function(v, rec){ + return null; + } + }, + enddate: { + id: 'close_date', + editorConfig: { + editable: false, + disabled: true, + fieldCls: 'form-panel-input-disabled', + labelClsExtra: 'form-panel-input-disabled' + } + }, + category: { + getInitialValue: function (v, rec){ + return 'Behavior' + }, + editable: false, + hidden: true, + columnConfig: { + editable: false + } + }, + problemCategory: { + editorConfig: { + editable: false, + disabled: true, + fieldCls: 'form-panel-input-disabled', + labelClsExtra: 'form-panel-input-disabled' + } + }, + problemSubcategory: { + editorConfig: { + editable: false, + disabled: true, + fieldCls: 'form-panel-input-disabled', + labelClsExtra: 'form-panel-input-disabled' + } + }, + plan: { + editorConfig: { + editable: false, + disabled: true, + fieldCls: 'form-panel-input-disabled', + labelClsExtra: 'form-panel-input-disabled' + } + }, + openRemark: { + editorConfig: { + editable: false, + disabled: true, + fieldCls: 'form-panel-input-disabled', + labelClsExtra: 'form-panel-input-disabled' + } + }, + closeRemark: { + editorConfig: { + editable: false, + disabled: true, + fieldCls: 'form-panel-input-disabled', + labelClsExtra: 'form-panel-input-disabled' + } + }, + performedby: { + hidden: false, + editorConfig: { + editable: false, + disabled: true, + fieldCls: 'form-panel-input-disabled', + labelClsExtra: 'form-panel-input-disabled' + } + }, + formCasesLink: { + xtype: 'nirc_ehr-editCases', + editorConfig: { + readonly: true + } + }, + } + } +}); \ No newline at end of file diff --git a/nirc_ehr/resources/web/nirc_ehr/model/sources/ClinicalDefaults.js b/nirc_ehr/resources/web/nirc_ehr/model/sources/ClinicalDefaults.js index 4d3e794f..c3b46811 100644 --- a/nirc_ehr/resources/web/nirc_ehr/model/sources/ClinicalDefaults.js +++ b/nirc_ehr/resources/web/nirc_ehr/model/sources/ClinicalDefaults.js @@ -12,6 +12,9 @@ EHR.model.DataModelManager.registerMetadata('ClinicalDefaults', { }, performedby: { hidden: true + }, + enddate: { + allowBlank: true, } }, 'study.drug': { @@ -27,6 +30,9 @@ EHR.model.DataModelManager.registerMetadata('ClinicalDefaults', { }, treatmentId: { hidden: true + }, + date: { + header: 'Date/Time', } }, 'study.prc': { diff --git a/nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js b/nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js index 7fc5df88..87b161ce 100644 --- a/nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js +++ b/nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js @@ -134,10 +134,6 @@ EHR.model.DataModelManager.registerMetadata('Default', { } }, 'study.treatment_order': { - category: { - defaultValue: 'Clinical', - hidden: true - }, endTreatmentOrderedBy: { columnConfig: { width: 200 @@ -145,10 +141,6 @@ EHR.model.DataModelManager.registerMetadata('Default', { } }, 'study.drug': { - category: { - defaultValue: 'Clinical', - hidden: true - }, treatmentid: { hidden: true, nullable: true diff --git a/nirc_ehr/resources/web/nirc_ehr/model/sources/TreatmentSchedule.js b/nirc_ehr/resources/web/nirc_ehr/model/sources/TreatmentSchedule.js index e8d5e5fa..d900c56f 100644 --- a/nirc_ehr/resources/web/nirc_ehr/model/sources/TreatmentSchedule.js +++ b/nirc_ehr/resources/web/nirc_ehr/model/sources/TreatmentSchedule.js @@ -53,17 +53,11 @@ EHR.model.DataModelManager.registerMetadata('TreatmentSchedule', { }, byQuery: { 'study.drug': { - category: { - defaultValue: 'Clinical', - }, date: { header: 'Date/Time', } }, 'study.treatment_order': { - category: { - defaultValue: 'Clinical', - }, enddate: { allowBlank: true, } diff --git a/nirc_ehr/resources/web/nirc_ehr/nircReports.js b/nirc_ehr/resources/web/nirc_ehr/nircReports.js index b8ab1b6c..ad3f1e12 100644 --- a/nirc_ehr/resources/web/nirc_ehr/nircReports.js +++ b/nirc_ehr/resources/web/nirc_ehr/nircReports.js @@ -218,4 +218,65 @@ EHR.reports.observationSchedule = function(panel, tab, viewName){ } }) }); +} + +EHR.reports.incompleteTreatments = function(panel, tab, viewName){ + const currentDate = new Date(); + const previousDate = new Date(); + previousDate.setDate(currentDate.getDate() - 30); + + const gridFilterArray = panel.getFilterArray(tab); + const filterArray = gridFilterArray.nonRemovable.concat(LABKEY.Filter.create('treatmentStatus', "Completed", LABKEY.Filter.Types.NEQ_OR_NULL)); + + const config = panel.getQWPConfig({ + title: 'Incomplete Treatments For Past 30 Days', + schemaName: 'study', + queryName: 'treatmentSchedule', + dataRegionName: 'incomplete_treatments', + parameters: { + StartDate: `${String(previousDate.getMonth() + 1).padStart(2, '0')}/${String(previousDate.getDate()).padStart(2, '0')}/${previousDate.getFullYear()}`, + NumDays: 30 + }, + filters: filterArray, + removeableFilters: gridFilterArray.removable, + frame: true + }); + + tab.add({ + xtype: 'ldk-querycmp', + style: 'margin-bottom:20px;', + queryConfig: config + }); +} + +EHR.reports.incompleteObservations = function(panel, tab, viewName){ + const currentDate = new Date(); + const previousDate = new Date(); + previousDate.setDate(currentDate.getDate() - 30); + + const gridFilterArray = panel.getFilterArray(tab); + const filterArray = gridFilterArray.nonRemovable.concat( + [LABKEY.Filter.create('status', "Completed", LABKEY.Filter.Types.DOES_NOT_CONTAIN), + ] + ); + + const config = panel.getQWPConfig({ + title: 'Incomplete Observations For Past 30 Days', + schemaName: 'study', + queryName: 'observationSchedule', + dataRegionName: 'incomplete_observations', + parameters: { + StartDate: `${String(previousDate.getMonth() + 1).padStart(2, '0')}/${String(previousDate.getDate()).padStart(2, '0')}/${previousDate.getFullYear()}`, + NumDays: 30 + }, + filters: filterArray, + removeableFilters: gridFilterArray.removable, + frame: true + }); + + tab.add({ + xtype: 'ldk-querycmp', + style: 'margin-bottom:20px;', + queryConfig: config + }); } \ No newline at end of file diff --git a/nirc_ehr/resources/web/nirc_ehr/panel/SelectCasePanel.js b/nirc_ehr/resources/web/nirc_ehr/panel/SelectCasePanel.js index c732377c..af5c0736 100644 --- a/nirc_ehr/resources/web/nirc_ehr/panel/SelectCasePanel.js +++ b/nirc_ehr/resources/web/nirc_ehr/panel/SelectCasePanel.js @@ -57,7 +57,8 @@ Ext4.define('NIRC_EHR.panel.SelectCasePanel', { return { 'Clinical Cases': 'Clinical', 'Clinical Rounds': 'Clinical', - 'Behavior Cases': 'Behavioral', + 'Behavioral Cases': 'Behavior', + 'Behavioral Rounds': 'Behavior', }; } }, diff --git a/nirc_ehr/src/org/labkey/nirc_ehr/NIRC_EHRManager.java b/nirc_ehr/src/org/labkey/nirc_ehr/NIRC_EHRManager.java index 663cc589..4ef62e87 100644 --- a/nirc_ehr/src/org/labkey/nirc_ehr/NIRC_EHRManager.java +++ b/nirc_ehr/src/org/labkey/nirc_ehr/NIRC_EHRManager.java @@ -9,7 +9,9 @@ public class NIRC_EHRManager @Queryable public static final String DAILY_CLINICAL_OBS_TITLE = "Daily Clinical Observations"; public static final List DAILY_CLINICAL_OBS = List.of("Activity", "Appetite", "BCS", "Hydration", "Stool", "Verified Id?"); - public static final String DAILY_CLINICAL_OBS_LIST = String.join(";",NIRC_EHRManager.DAILY_CLINICAL_OBS); + public static final String SIB_OBS_TITLE = "SIB Observations"; + public static final List SIB_OBS = List.of("Environmental Change", "Self Biting Observed", "Other Stereotopy", "New Injury Observed", "Special Enrichment", "Wound Status", "Wound Severity"); + private static NIRCOrchardFileGenerator _orchardFileGenerator = new NIRCOrchardFileGenerator(); public static NIRCOrchardFileGenerator getOrchardFileGenerator() { diff --git a/nirc_ehr/src/org/labkey/nirc_ehr/NIRC_EHRModule.java b/nirc_ehr/src/org/labkey/nirc_ehr/NIRC_EHRModule.java index d97c9756..ffacf6d6 100644 --- a/nirc_ehr/src/org/labkey/nirc_ehr/NIRC_EHRModule.java +++ b/nirc_ehr/src/org/labkey/nirc_ehr/NIRC_EHRModule.java @@ -21,8 +21,8 @@ import org.labkey.api.data.UpgradeCode; import org.labkey.api.ehr.EHRService; import org.labkey.api.ehr.SharedEHRUpgradeCode; +import org.labkey.api.ehr.buttons.MarkCompletedButton; import org.labkey.api.ehr.dataentry.DefaultDataEntryFormFactory; -import org.labkey.api.ehr.demographics.ActiveTreatmentsDemographicsProvider; import org.labkey.api.ehr.demographics.ParentsDemographicsProvider; import org.labkey.api.ehr.demographics.SourceDemographicsProvider; import org.labkey.api.ehr.history.DefaultAlopeciaDataSource; @@ -48,6 +48,7 @@ import org.labkey.nirc_ehr.demographics.ActiveAssignmentsDemographicsProvider; import org.labkey.nirc_ehr.demographics.ActiveCasesDemographicsProvider; import org.labkey.nirc_ehr.demographics.ActiveFlagsDemographicsProvider; +import org.labkey.nirc_ehr.demographics.ActiveTreatmentsDemographicsProvider; import org.labkey.nirc_ehr.demographics.CagematesDemographicsProvider; import org.labkey.nirc_ehr.demographics.HousingDemographicsProvider; import org.labkey.nirc_ehr.demographics.NecropsyStatusDemographicsProvider; @@ -181,7 +182,7 @@ protected void doStartupAfterSpringConfig(ModuleContext moduleContext) EHRService.get().unregisterMoreActionsButtons("study", "treatment_order"); EHRService.get().registerMoreActionsButton(new MarkTreatmentCompletedButton(this, "study", "treatment_order", "Set End Date"), "study", "treatment_order"); - EHRService.get().registerMoreActionsButton(new MarkTreatmentCompletedButton(this, "study", "observation_order", "Set End Date"), "study", "observation_order"); + EHRService.get().registerMoreActionsButton(new MarkCompletedButton(this, "study", "observation_order", "Set End Date"), "study", "observation_order"); registerDataEntry(); NotificationService.get().registerNotification(new NIRCDeathNotification()); @@ -223,6 +224,7 @@ private void registerDataEntry() EHRService.get().registerFormType(new DefaultDataEntryFormFactory(NIRCAnimalTrainingFormType.class, this)); EHRService.get().registerFormType(new DefaultDataEntryFormFactory(NIRCPairingsFormType.class, this)); EHRService.get().registerFormType(new DefaultDataEntryFormFactory(NIRCBulkBehaviorFormType.class, this)); + EHRService.get().registerFormType(new DefaultDataEntryFormFactory(NIRCBehaviorRoundsFormType.class, this)); } @Override diff --git a/nirc_ehr/src/org/labkey/nirc_ehr/buttons/MarkTreatmentCompletedButton.java b/nirc_ehr/src/org/labkey/nirc_ehr/buttons/MarkTreatmentCompletedButton.java index 6aee7ede..42c9c081 100644 --- a/nirc_ehr/src/org/labkey/nirc_ehr/buttons/MarkTreatmentCompletedButton.java +++ b/nirc_ehr/src/org/labkey/nirc_ehr/buttons/MarkTreatmentCompletedButton.java @@ -26,7 +26,7 @@ protected String getJsHandler(TableInfo ti) // NOTE: we have a problem if this is called before all XML metadata is applied. for example, a dataset could call the tablecustomizer from studyData.query.xml // but the dataset-specific query.xml file will apply a different format to the enddate column. as a result, defer creating the JS handler as long as we can. ColumnInfo col = ti.getColumn("enddate"); - String xtype = "datefield"; + String xtype = "xdatetime"; if (!_forceDateOnlyField && col != null && col.getFormat() != null && col.getFormat().contains("HH")) xtype = "xdatetime"; diff --git a/nirc_ehr/src/org/labkey/nirc_ehr/dataentry/form/NIRCBehaviorRoundsFormType.java b/nirc_ehr/src/org/labkey/nirc_ehr/dataentry/form/NIRCBehaviorRoundsFormType.java new file mode 100644 index 00000000..115bffa4 --- /dev/null +++ b/nirc_ehr/src/org/labkey/nirc_ehr/dataentry/form/NIRCBehaviorRoundsFormType.java @@ -0,0 +1,98 @@ +package org.labkey.nirc_ehr.dataentry.form; + +import org.labkey.api.ehr.dataentry.AbstractFormSection; +import org.labkey.api.ehr.dataentry.DataEntryFormContext; +import org.labkey.api.ehr.dataentry.FormSection; +import org.labkey.api.ehr.dataentry.SimpleFormSection; +import org.labkey.api.ehr.security.EHRClinicalEntryPermission; +import org.labkey.api.module.Module; +import org.labkey.api.query.Queryable; +import org.labkey.api.view.template.ClientDependency; +import org.labkey.nirc_ehr.dataentry.section.NIRCAnimalDetailsFormSection; +import org.labkey.nirc_ehr.dataentry.section.NIRCCaseTemplateFormSection; +import org.labkey.nirc_ehr.dataentry.section.NIRCCasesFormPanelSection; +import org.labkey.nirc_ehr.dataentry.section.NIRCClinicalObservationsFormSection; +import org.labkey.nirc_ehr.dataentry.section.NIRCObservationOrdersFormSection; +import org.labkey.nirc_ehr.dataentry.section.NIRCTaskFormSection; +import org.labkey.nirc_ehr.dataentry.section.NIRCTreatmentGivenFormSection; +import org.labkey.nirc_ehr.dataentry.section.NIRCTreatmentOrderFormSection; + +import java.util.Arrays; +import java.util.List; + +public class NIRCBehaviorRoundsFormType extends NIRCBaseTaskFormType +{ + @Queryable + public static final String NAME = "Behavioral Rounds"; + public static final String LABEL = "Behavioral Rounds"; + + public NIRCBehaviorRoundsFormType(DataEntryFormContext ctx, Module owner) + { + super(ctx, owner, NAME, LABEL, "Behavior", Arrays.asList( + new NIRCTaskFormSection(), + new NIRCAnimalDetailsFormSection(), + new NIRCCaseTemplateFormSection("Case Template", "Case Template", "nirc_ehr-casetemplatepanel", Arrays.asList(ClientDependency.supplierFromPath("nirc_ehr/panel/CaseTemplatePanel.js"))), + new NIRCCasesFormPanelSection("Behavior Case", ctx, true), + new NIRCClinicalObservationsFormSection(true, "cases"), + new NIRCObservationOrdersFormSection(null, true, "cases"), + new NIRCTreatmentGivenFormSection(true, "cases"), + new NIRCTreatmentOrderFormSection(true, "cases") + )); + + setTemplateMode(AbstractFormSection.TEMPLATE_MODE.NO_ID); + setDisplayReviewRequired(true); + + for (FormSection s : this.getFormSections()) + { + s.addConfigSource("BehavioralCase"); + s.addConfigSource("BehaviorDefaults"); + s.addConfigSource("TreatmentSchedule"); + s.addConfigSource("BehaviorRounds"); + + if (s instanceof SimpleFormSection && !s.getName().equals("tasks")) + s.setTemplateMode(AbstractFormSection.TEMPLATE_MODE.NO_ID); + + if (s instanceof AbstractFormSection) + { + ((AbstractFormSection)s).setAllowBulkAdd(false); + } + } + setStoreCollectionClass("NIRC_EHR.data.CaseStoreCollection"); + addClientDependency(ClientDependency.supplierFromPath("nirc_ehr/data/CaseStoreCollection.js")); + addClientDependency(ClientDependency.supplierFromPath("nirc_ehr/model/sources/TreatmentSchedule.js")); + addClientDependency(ClientDependency.supplierFromPath("nirc_ehr/field/DrugVolumeField.js")); + addClientDependency(ClientDependency.supplierFromPath("nirc_ehr/window/DrugAmountWindow.js")); + + addClientDependency(ClientDependency.supplierFromPath("nirc_ehr/model/sources/BehavioralCase.js")); + addClientDependency(ClientDependency.supplierFromPath("nirc_ehr/model/sources/BehaviorDefaults.js")); + addClientDependency(ClientDependency.supplierFromPath("nirc_ehr/model/sources/BehaviorRounds.js")); + addClientDependency(ClientDependency.supplierFromPath("ehr/panel/ExamDataEntryPanel.js")); + setJavascriptClass("EHR.panel.ExamDataEntryPanel"); + + addClientDependency(ClientDependency.supplierFromPath("nirc_ehr/panel/NIRCExamCasesDataEntryPanel.js")); + setJavascriptClass("NIRC_EHR.panel.ExamCasesDataEntryPanel"); + + // Needed for case and scheduled date/time when navigating from treatment or observation schedule + addClientDependency(ClientDependency.supplierFromPath("nirc_ehr/buttons/treatmentSubmit.js")); + } + + @Override + protected boolean canInsert() + { + if (!getCtx().getContainer().hasPermission(getCtx().getUser(), EHRClinicalEntryPermission.class)) + return false; + + return super.canInsert(); + } + + @Override + protected List getButtonConfigs() + { + List ret = super.getButtonConfigs(); + + ret.remove("SUBMIT"); + ret.add("NIRC_TREATMENT_SUBMIT"); + + return ret; + } +} \ No newline at end of file diff --git a/nirc_ehr/src/org/labkey/nirc_ehr/dataentry/form/NIRCClinicalObservationsFormType.java b/nirc_ehr/src/org/labkey/nirc_ehr/dataentry/form/NIRCClinicalObservationsFormType.java index 12e89025..4a05cb43 100644 --- a/nirc_ehr/src/org/labkey/nirc_ehr/dataentry/form/NIRCClinicalObservationsFormType.java +++ b/nirc_ehr/src/org/labkey/nirc_ehr/dataentry/form/NIRCClinicalObservationsFormType.java @@ -14,7 +14,7 @@ public class NIRCClinicalObservationsFormType extends NIRCBaseTaskFormType { - public static final String NAME = "Clinical Observations"; + public static final String NAME = "Observations"; public NIRCClinicalObservationsFormType(DataEntryFormContext ctx, Module owner) { diff --git a/nirc_ehr/src/org/labkey/nirc_ehr/demographics/ActiveTreatmentsDemographicsProvider.java b/nirc_ehr/src/org/labkey/nirc_ehr/demographics/ActiveTreatmentsDemographicsProvider.java new file mode 100644 index 00000000..50f7128e --- /dev/null +++ b/nirc_ehr/src/org/labkey/nirc_ehr/demographics/ActiveTreatmentsDemographicsProvider.java @@ -0,0 +1,70 @@ +package org.labkey.nirc_ehr.demographics; + +import org.labkey.api.data.SimpleFilter; +import org.labkey.api.ehr.demographics.AbstractListDemographicsProvider; +import org.labkey.api.module.Module; +import org.labkey.api.query.FieldKey; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +public class ActiveTreatmentsDemographicsProvider extends AbstractListDemographicsProvider +{ + public ActiveTreatmentsDemographicsProvider(Module owner) + { + super(owner, "study", "Treatment Orders", "activeTreatments"); + _supportsQCState = false; + } + + @Override + protected Set getFieldKeys() + { + Set keys = new HashSet(); + keys.add(FieldKey.fromString("lsid")); + keys.add(FieldKey.fromString("Id")); + keys.add(FieldKey.fromString("code")); + keys.add(FieldKey.fromString("code/meaning")); + keys.add(FieldKey.fromString("date")); + keys.add(FieldKey.fromString("enddate")); + keys.add(FieldKey.fromString("performedby")); + keys.add(FieldKey.fromString("route")); + + keys.add(FieldKey.fromString("dosage")); + keys.add(FieldKey.fromString("dosage_units")); + keys.add(FieldKey.fromString("amount")); + keys.add(FieldKey.fromString("amount_units")); + keys.add(FieldKey.fromString("concentration")); + keys.add(FieldKey.fromString("concentration_units")); + keys.add(FieldKey.fromString("volume")); + keys.add(FieldKey.fromString("vol_units")); + keys.add(FieldKey.fromString("amountAndVolume")); + + keys.add(FieldKey.fromString("remark")); + keys.add(FieldKey.fromString("frequency")); + keys.add(FieldKey.fromString("frequency/meaning")); + + keys.add(FieldKey.fromString("amountWithUnits")); + keys.add(FieldKey.fromString("category")); + + return keys; + } + + @Override + public Collection getKeysToTest() + { + //for now, simply skip the whole provider. because different records can be active from day to day, this makes validation tricky + Set keys = new HashSet<>(super.getKeysToTest()); + keys.remove(_propName); + + return keys; + } + + protected SimpleFilter getFilter(Collection ids) + { + SimpleFilter filter = super.getFilter(ids); + filter.addCondition(FieldKey.fromString("isOpen"), true); + + return filter; + } +} \ No newline at end of file diff --git a/nirc_ehr/src/org/labkey/nirc_ehr/table/NIRC_EHRCustomizer.java b/nirc_ehr/src/org/labkey/nirc_ehr/table/NIRC_EHRCustomizer.java index 4140a2bc..08ac2654 100644 --- a/nirc_ehr/src/org/labkey/nirc_ehr/table/NIRC_EHRCustomizer.java +++ b/nirc_ehr/src/org/labkey/nirc_ehr/table/NIRC_EHRCustomizer.java @@ -1040,7 +1040,7 @@ public void renderGridCellContents(RenderContext ctx, Writer out) throws IOExcep { if (caseid != null) { - linkAction.addParameter("formType", "Behavior Rounds"); + linkAction.addParameter("formType", "Behavioral Rounds"); linkAction.addParameter("caseid", caseid); } else @@ -1123,10 +1123,11 @@ public DisplayColumn createRenderer(final ColumnInfo colInfo) public void renderGridCellContents(RenderContext ctx, Writer out) throws IOException { String status = (String) getBoundColumn().getValue(ctx); - String stat = status; + String stat = null; if (status != null) { Set dailies = new HashSet<>(); + Set sib = new HashSet<>(); Set nonDailies = new HashSet<>(); String[] sts = status.split(";"); @@ -1136,21 +1137,64 @@ public void renderGridCellContents(RenderContext ctx, Writer out) throws IOExcep { dailies.add(st); } + else if (NIRC_EHRManager.SIB_OBS.contains(st)) + { + sib.add(st); + } else { nonDailies.add(st); } } + // Compress to daily clinical observations if (dailies.size() == NIRC_EHRManager.DAILY_CLINICAL_OBS.size()) { stat = NIRC_EHRManager.DAILY_CLINICAL_OBS_TITLE; - if (!nonDailies.isEmpty()) + } + else if (!dailies.isEmpty()) + { + stat = String.join("; ", dailies); + } + + // Compress to SIB observations + if (sib.size() == NIRC_EHRManager.SIB_OBS.size()) + { + if (stat == null) + { + stat = NIRC_EHRManager.SIB_OBS_TITLE; + } + else + { + stat += "; " + NIRC_EHRManager.SIB_OBS_TITLE; + } + } + else if (!sib.isEmpty()) + { + if (stat == null) + { + stat = String.join("; ", sib); + } + else + { + stat += "; " + String.join("; ", sib); + } + } + + // Add list of the rest of the observations + if (!nonDailies.isEmpty()) + { + if (stat == null) + { + stat = String.join("; ", nonDailies); + } + else { stat += "; " + String.join("; ", nonDailies); } } - else + + if (stat == null) { stat = status; } diff --git a/nirc_ehr/test/src/org.labkey.test/tests.nirc_ehr/NIRC_EHRTest.java b/nirc_ehr/test/src/org.labkey.test/tests.nirc_ehr/NIRC_EHRTest.java index f5921be6..8ab84ffc 100644 --- a/nirc_ehr/test/src/org.labkey.test/tests.nirc_ehr/NIRC_EHRTest.java +++ b/nirc_ehr/test/src/org.labkey.test/tests.nirc_ehr/NIRC_EHRTest.java @@ -454,12 +454,12 @@ public void testClinicalObservation() observationOrders.setGridCell(1, "frequency", "QID"); submitForm("Submit Final", "Finalize"); - log("Verifying Active Observation Orders"); + log("Verifying Active Clinical Observation Orders"); goToEHRFolder(); - waitAndClickAndWait(Locator.linkWithText("Active Observation Orders")); + waitAndClickAndWait(Locator.linkWithText("Active Clinical Observation Orders")); DataRegionTable table = new AnimalHistoryPage<>(getDriver()).getActiveReportDataRegion(); table.setFilter("Id", "Equals", animalId); - Assert.assertEquals("Incorrect active observation orders", Arrays.asList("Ears", "Activity", "Appetite", "BCS", "Hydration", + Assert.assertEquals("Incorrect active clinical observation orders", Arrays.asList("Ears", "Activity", "Appetite", "BCS", "Hydration", "Stool", "Verified Id?"), table.getColumnDataAsText("category")); log("Verifying Today's Observation Schedule");