diff --git a/onprc_ehr/resources/queries/study/IPC_CassetteColors.sql b/onprc_ehr/resources/queries/study/IPC_CassetteColors.sql
new file mode 100644
index 000000000..1d8615bbb
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_CassetteColors.sql
@@ -0,0 +1,2 @@
+SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.IPC_Reference_Data
+Where name like 'IPCCassetteColor' and dateDisabled is null
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/IPC_CassettePrinting.query.xml b/onprc_ehr/resources/queries/study/IPC_CassettePrinting.query.xml
new file mode 100644
index 000000000..411c222a9
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_CassettePrinting.query.xml
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+ IPC Cassette Printing
+
+
+ true
+
+
+
+ Id
+
+
+
+ Date
+
+
+
+ Tissue Types
+
+ study
+ IPC_TissueTypes
+ value
+
+
+
+
+ PI Label Text
+
+
+
+ Cassette Color
+
+ study
+ IPC_CassetteColors
+ value
+
+
+
+
+ Remarks
+
+
+
+
+ study
+ qcstate
+ RowId
+
+
+
+
+ Task Id
+
+ ehr
+ tasks
+ taskid
+
+
+
+ true
+
+
+ Performed By
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/IPC_CurrentFixative.sql b/onprc_ehr/resources/queries/study/IPC_CurrentFixative.sql
new file mode 100644
index 000000000..938ce4733
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_CurrentFixative.sql
@@ -0,0 +1,2 @@
+SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.IPC_Reference_Data
+Where name like 'IPCCurrentFixative' and dateDisabled is null
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/IPC_Embedding.sql b/onprc_ehr/resources/queries/study/IPC_Embedding.sql
new file mode 100644
index 000000000..c6eaaaf27
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_Embedding.sql
@@ -0,0 +1,3 @@
+-- Get Embedding values
+SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.IPC_Reference_Data
+Where name like 'IPCEmbedding' and dateDisabled is null
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/IPC_FixationMethod.sql b/onprc_ehr/resources/queries/study/IPC_FixationMethod.sql
new file mode 100644
index 000000000..6ecbe81c9
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_FixationMethod.sql
@@ -0,0 +1,2 @@
+SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.IPC_Reference_Data
+Where name like 'IPCFixationMethod' and dateDisabled is null
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/IPC_FrozenSectionThickness.sql b/onprc_ehr/resources/queries/study/IPC_FrozenSectionThickness.sql
new file mode 100644
index 000000000..fba375624
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_FrozenSectionThickness.sql
@@ -0,0 +1,2 @@
+SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.IPC_Reference_Data
+Where name like 'IPCFrozenSectionThickness' and dateDisabled is null
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/IPC_FrozenSectioning.sql b/onprc_ehr/resources/queries/study/IPC_FrozenSectioning.sql
new file mode 100644
index 000000000..58c327335
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_FrozenSectioning.sql
@@ -0,0 +1,2 @@
+SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.IPC_Reference_Data
+Where name like 'IPCFrozenSectioning' and dateDisabled is null
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/IPC_HandE.sql b/onprc_ehr/resources/queries/study/IPC_HandE.sql
new file mode 100644
index 000000000..2ce40daf3
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_HandE.sql
@@ -0,0 +1,2 @@
+SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.IPC_Reference_Data
+Where name like 'IPCHAndE' and dateDisabled is null
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/IPC_IHC.sql b/onprc_ehr/resources/queries/study/IPC_IHC.sql
new file mode 100644
index 000000000..ae25fc6a7
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_IHC.sql
@@ -0,0 +1,2 @@
+SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.IPC_Reference_Data
+Where name like 'IPCIHC' and dateDisabled is null
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/IPC_IHCAntibody.sql b/onprc_ehr/resources/queries/study/IPC_IHCAntibody.sql
new file mode 100644
index 000000000..e6c0c0f3f
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_IHCAntibody.sql
@@ -0,0 +1,2 @@
+SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.IPC_Reference_Data
+Where name like 'IPCIHCAntibody' and dateDisabled is null
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/IPC_Investigators.sql b/onprc_ehr/resources/queries/study/IPC_Investigators.sql
new file mode 100644
index 000000000..2daa61cc5
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_Investigators.sql
@@ -0,0 +1,3 @@
+SELECT lastName + ', ' + firstName as name
+From Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.investigators
+Where dateDisabled is null
diff --git a/onprc_ehr/resources/queries/study/IPC_Locations.sql b/onprc_ehr/resources/queries/study/IPC_Locations.sql
new file mode 100644
index 000000000..6841c99bd
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_Locations.sql
@@ -0,0 +1,3 @@
+SELECT room
+From Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr_lookups.rooms
+Where dateDisabled is null order by room
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/IPC_Other.query.xml b/onprc_ehr/resources/queries/study/IPC_Other.query.xml
new file mode 100644
index 000000000..576026f9c
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_Other.query.xml
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+ IPC Other
+
+
+ true
+
+
+
+ Id
+
+
+
+ Date
+
+
+
+ Tissue Types
+
+ study
+ IPC_TissueTypes
+ value
+
+
+
+
+ Services And Products
+
+ study
+ IPC_OtherServices
+ value
+
+
+
+
+ Performed By
+
+
+
+
+ study
+ qcstate
+ RowId
+
+
+
+
+ Task Id
+
+ ehr
+ tasks
+ taskid
+
+
+
+ true
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/IPC_OtherServices.sql b/onprc_ehr/resources/queries/study/IPC_OtherServices.sql
new file mode 100644
index 000000000..e386f8d10
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_OtherServices.sql
@@ -0,0 +1,2 @@
+SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.IPC_Reference_Data
+Where name like 'IPCOtherServices' and dateDisabled is null
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/IPC_ParaffinSectioning.sql b/onprc_ehr/resources/queries/study/IPC_ParaffinSectioning.sql
new file mode 100644
index 000000000..051c9c60d
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_ParaffinSectioning.sql
@@ -0,0 +1,2 @@
+SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.IPC_Reference_Data
+Where name like 'IPCParaffinSectioning' and dateDisabled is null
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/IPC_Pathologist.sql b/onprc_ehr/resources/queries/study/IPC_Pathologist.sql
new file mode 100644
index 000000000..8aa6bf066
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_Pathologist.sql
@@ -0,0 +1,3 @@
+SELECT displayname as name
+From Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.Reference_StaffNames
+Where Type like 'Necropsy' and DisableDate is null
diff --git a/onprc_ehr/resources/queries/study/IPC_ProcessingEmbedding.query.xml b/onprc_ehr/resources/queries/study/IPC_ProcessingEmbedding.query.xml
new file mode 100644
index 000000000..07d1ee788
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_ProcessingEmbedding.query.xml
@@ -0,0 +1,115 @@
+
+
+
+
+
+
+ IPC Processing Embedding
+
+
+ true
+
+
+
+ Id
+
+
+
+ Date
+
+
+
+ Tissue Types
+
+ study
+ IPC_TissueTypes
+ value
+
+
+
+
+ Embedding
+
+ study
+ IPC_Embedding
+ value
+
+
+
+
+ Initial Fixative
+
+ study
+ IPC_FixationMethod
+ value
+
+
+
+
+ Fixation Duration
+
+
+
+ Current Fixative
+
+ study
+ IPC_CurrentFixative
+ value
+
+
+
+
+ Processing Type
+
+ study
+ IPC_ProcessingType
+ value
+
+
+
+
+ Embedding Instructions
+
+
+
+ Performed By
+
+
+
+
+ study
+ qcstate
+ RowId
+
+
+
+
+ Task Id
+
+ ehr
+ tasks
+ taskid
+
+
+
+ true
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/IPC_ProcessingType.sql b/onprc_ehr/resources/queries/study/IPC_ProcessingType.sql
new file mode 100644
index 000000000..e83a09e73
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_ProcessingType.sql
@@ -0,0 +1,2 @@
+SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.IPC_Reference_Data
+Where name like 'IPCProcessingType' and dateDisabled is null
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/IPC_RNAScope.sql b/onprc_ehr/resources/queries/study/IPC_RNAScope.sql
new file mode 100644
index 000000000..be4d130ca
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_RNAScope.sql
@@ -0,0 +1,2 @@
+SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.IPC_Reference_Data
+Where name like 'IPCRNAScope' and dateDisabled is null
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/IPC_SectionThickness.sql b/onprc_ehr/resources/queries/study/IPC_SectionThickness.sql
new file mode 100644
index 000000000..c5ee1653e
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_SectionThickness.sql
@@ -0,0 +1,2 @@
+SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.IPC_Reference_Data
+Where name like 'IPCSectionThickness' and dateDisabled is null
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/IPC_Sectioning.query.xml b/onprc_ehr/resources/queries/study/IPC_Sectioning.query.xml
new file mode 100644
index 000000000..8dbc44715
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_Sectioning.query.xml
@@ -0,0 +1,102 @@
+
+
+
+
+
+
+ IPC Sectioning
+
+
+ true
+
+
+
+ Id
+
+
+
+ Date
+
+
+
+ Tissue Types
+
+ study
+ IPC_TissueTypes
+ value
+
+
+
+
+ Paraffin Sectioning
+
+ study
+ IPC_ParaffinSectioning
+ value
+
+
+
+
+ Paraffin Section Thickness
+
+ study
+ IPC_SectionThickness
+ value
+
+
+
+
+ Frozen Section Thickness
+
+ study
+ IPC_FrozenSectionThickness
+ value
+
+
+
+
+ Special Instructions
+
+
+
+ Performed By
+
+
+
+
+ study
+ qcstate
+ RowId
+
+
+
+
+ Task Id
+
+ ehr
+ tasks
+ taskid
+
+
+
+ true
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/IPC_ServiceRequestDetails.query.xml b/onprc_ehr/resources/queries/study/IPC_ServiceRequestDetails.query.xml
new file mode 100644
index 000000000..566f5ac49
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_ServiceRequestDetails.query.xml
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+ IPC Service Request Details
+
+
+ true
+
+
+
+ Id
+
+
+
+ Date
+
+
+
+ Requested By
+
+
+
+ Email
+
+
+
+ Department
+
+
+
+ Pathologist
+
+ study
+ IPC_Pathologist
+ name
+
+
+
+
+ Investigator
+
+ study
+ IPC_Investigators
+ name
+
+
+
+
+ Alias
+
+
+
+ Sample Dropoff/Pickup Location
+
+ study
+ IPC_Locations
+ room
+
+
+
+
+
+ study
+ qcstate
+ RowId
+
+
+
+
+ Task Id
+
+ ehr
+ tasks
+ taskid
+
+
+
+ true
+
+
+ Performed By
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/IPC_SlidePrinting.query.xml b/onprc_ehr/resources/queries/study/IPC_SlidePrinting.query.xml
new file mode 100644
index 000000000..af5f93e07
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_SlidePrinting.query.xml
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+ IPC Sectioning
+
+
+ true
+
+
+
+ Id
+
+
+
+ Date
+
+
+
+ Tissue Types
+
+ study
+ IPC_TissueTypes
+ value
+
+
+
+
+ Project Notes
+
+
+
+ Additional text on slide
+
+
+
+ Performed By
+
+
+
+
+ study
+ qcstate
+ RowId
+
+
+
+
+ Task Id
+
+ ehr
+ tasks
+ taskid
+
+
+
+ true
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/IPC_Staining.query.xml b/onprc_ehr/resources/queries/study/IPC_Staining.query.xml
new file mode 100644
index 000000000..21be6119d
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_Staining.query.xml
@@ -0,0 +1,124 @@
+
+
+
+
+
+
+ IPC Staining
+
+
+ true
+
+
+
+ Id
+
+
+
+ Date
+
+
+
+ Tissue Types
+
+ study
+ IPC_TissueTypes
+ value
+
+
+
+
+ H And E
+
+ study
+ IPC_HandE
+ value
+
+
+
+
+ Special Stain
+
+ study
+ IPC_Stains
+ value
+
+
+
+
+ IHC
+
+ study
+ IPC_IHC
+ value
+
+
+
+
+ IHC Primary Antibody
+
+ study
+ IPC_IHCAntibody
+ value
+
+
+
+
+ Irrevelant Antibody
+
+
+
+ RNA Scope
+
+ study
+ IPC_RNAScope
+ value
+
+
+
+
+ Other
+
+
+
+ Performed By
+
+
+
+
+ study
+ qcstate
+ RowId
+
+
+
+
+ Task Id
+
+ ehr
+ tasks
+ taskid
+
+
+
+ true
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/IPC_Stains.sql b/onprc_ehr/resources/queries/study/IPC_Stains.sql
new file mode 100644
index 000000000..d2aa3e2e8
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_Stains.sql
@@ -0,0 +1,3 @@
+--Get the stains data
+SELECT value, name from Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.IPC_Reference_Data
+Where name like 'IPCStains' and dateDisabled is null
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/IPC_TissueTypes.sql b/onprc_ehr/resources/queries/study/IPC_TissueTypes.sql
new file mode 100644
index 000000000..028ed41d1
--- /dev/null
+++ b/onprc_ehr/resources/queries/study/IPC_TissueTypes.sql
@@ -0,0 +1,2 @@
+SELECT value, name From Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.onprc_ehr.IPC_Reference_Data
+Where name like 'IPCTissueType' and dateDisabled is null
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/Notes_WithLocation.query.xml b/onprc_ehr/resources/queries/study/Notes_WithLocation.query.xml
deleted file mode 100644
index 948863812..000000000
--- a/onprc_ehr/resources/queries/study/Notes_WithLocation.query.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/onprc_ehr/resources/queries/study/Notes_WithLocation.sql b/onprc_ehr/resources/queries/study/Notes_WithLocation.sql
deleted file mode 100644
index 68b54fa60..000000000
--- a/onprc_ehr/resources/queries/study/Notes_WithLocation.sql
+++ /dev/null
@@ -1,15 +0,0 @@
-Select
- Id,
- CASE
- WHEN id.curLocation.cage is null then id.curLocation.room
- ELSE (id.curLocation.room || '-' || id.curLocation.cage)
- END AS Location,
- date,
- actiondate,
- enddate,
- category,
- value,
- remark,
- qcstate,
- taskid
-From study.notes
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/TreatmentSchedulePostOps.sql b/onprc_ehr/resources/queries/study/TreatmentSchedulePostOps.sql
deleted file mode 100644
index ece5f0b8e..000000000
--- a/onprc_ehr/resources/queries/study/TreatmentSchedulePostOps.sql
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright (c) 2015 LabKey Corporation
- * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
-
- -- Modified by Kolli on 9/10/2019
-*/
-SELECT
- h.id,
- h.calculated_status,
- --s.TreatmentStatus,
- (SELECT max(d.qcstate.label) as label FROM study.drug d WHERE s.objectid = d.treatmentid and s.date = d.timeordered) as TreatmentStatus,
- h.Id.curLocation.room as room,
- h.Id.curLocation.cage as cage,
- s.date,
- s.startDate,
- s.endDate,
- s.dayselapsed,
- s.category,
- s.code,
- s.code.meaning as medication,
- s.volume,
- s.vol_units,
- s.concentration,
- s.conc_units,
- s.amountWithUnits,
- s.amountAndVolume,
- s.dosage,
- s.dosage_units,
- s.frequency,
- s.route,
- s.reason,
- s.remark,
- s.performedby
-FROM study.demographics h JOIN (
-
-SELECT
- s.animalid, s.TreatmentStatus, timestampadd('SQL_TSI_MINUTE', ((s.hours * 60) + s.minutes), s.origDate) as date, s.objectid,
- s.startdate, s.enddate, s.dayselapsed, s.category, s.code, s.volume, s.vol_units, s.concentration, s.conc_units,
- s.amountWithUnits, s.amountAndVolume, s.dosage, s.dosage_units, s.frequency, s.route, s.reason, s.remark, s.performedby
-FROM (
-
- SELECT
- t1.objectid,
- t1.id as animalid,
- (coalesce(tt.time, ft.hourofday, (hour(t1.date) * 100)) / 100) as hours,
-
- CASE
- WHEN (tt.time IS NOT NULL OR ft.hourofday IS NOT NULL) THEN (((coalesce(tt.time, ft.hourofday) / 100.0) - floor(coalesce(tt.time, ft.hourofday) / 100)) * 100)
- ELSE minute(t1.date)
- END as minutes,
- dr.date as origDate,
-
- CASE
- WHEN snomed.code IS NOT NULL THEN 'Post Op Meds'
- ELSE t1.category
- END as category,
-
- t1.date as startDate,
- timestampdiff('SQL_TSI_DAY', cast(t1.dateOnly as timestamp), dr.dateOnly) + 1 as daysElapsed,
- t1.enddate, t1.code, t1.volume, t1.vol_units, t1.concentration, t1.conc_units, t1.amountWithUnits,
- t1.amountAndVolume, t1.dosage, t1.dosage_units, t1.frequency.meaning + ' (' + t1.frequency.times + ')' as frequency, t1.route,
- t1.reason, t1.performedby, t1.remark, t1.qcstate.label as TreatmentStatus
-
- FROM ehr_lookups.dateRange dr
-
-Join study."Treatment Orders" t1
- ON (dr.dateOnly >= t1.dateOnly and dr.dateOnly <= t1.enddateCoalesced AND
- mod(CAST(timestampdiff('SQL_TSI_DAY', CAST(t1.dateOnly as timestamp), dr.dateOnly) as integer), t1.frequency.intervalindays) = 0
- )
-
-LEFT JOIN ehr.treatment_times tt ON (tt.treatmentid = t1.objectid)
-LEFT JOIN ehr_lookups.treatment_frequency_times ft ON (ft.frequency = t1.frequency.meaning AND tt.rowid IS NULL)
-
-INNER JOIN (
- SELECT
- sc.code
- FROM ehr_lookups.snomed_subset_codes sc
- WHERE sc.primaryCategory = 'Post Op Meds'
- /* Added this clause by Kollil on 10/4/2023 to exclude the MPA injection from the list.
- This change is made according to the new request by Cassie Tkt# 9939. The MPA med is part of the post op meds category
- but a separate alert is created so, excluding this med from this alert list.
- */
- AND sc.code NOT IN ('E-85760')
- GROUP BY sc.code
-) snomed ON snomed.code = t1.code
-
---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
-
-) s
-
-) s ON (s.animalid = h.id)
- WHERE h.calculated_status = 'Alive'
- --account for date/time in schedule
- and s.date >= s.startDate and s.date <= s.enddate
-
-
--- /*
--- * Copyright (c) 2015 LabKey Corporation
--- *
--- * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
--- */
---
--- SELECT
--- h.id,
--- h.calculated_status,
--- s.*,
--- s.objectid as treatmentid,
--- ---Modified 7-2-2015 Blasa from d.qcstate to d.qcstate.label
--- (SELECT max(d.qcstate.label) as label FROM study.drug d WHERE s.objectid = d.treatmentid AND s.date = d.timeordered) as treatmentStatus
---
---
--- FROM study.demographics h JOIN (
---
--- SELECT
--- s.*,
--- timestampadd('SQL_TSI_MINUTE', ((s.hours * 60) + s.minutes), s.origDate) as date,
--- CASE
--- WHEN (hours >= 6 AND hours < 20) THEN 'AM'
--- WHEN (hours < 6 OR hours >= 20) THEN 'PM'
--- ELSE 'Other'
--- END as timeOfDay,
---
--- ((s.hours * 60) + s.minutes) as timeOffset
---
--- FROM (
---
--- SELECT
--- t1.lsid,
--- t1.objectid,
--- t1.dataset,
--- t1.id as animalid,
---
--- coalesce(tt.time, ft.hourofday, ((hour(t1.date) * 100) + minute(t1.date))) as time,
--- (coalesce(tt.time, ft.hourofday, (hour(t1.date) * 100)) / 100) as hours,
--- CASE
--- WHEN (tt.time IS NOT NULL OR ft.hourofday IS NOT NULL) THEN (((coalesce(tt.time, ft.hourofday) / 100.0) - floor(coalesce(tt.time, ft.hourofday) / 100)) * 100)
--- ELSE minute(t1.date)
--- END as minutes,
--- dr.date as origDate,
--- --ft.timedescription as timeOfDay,
--- CASE
--- WHEN (tt.time IS NULL) THEN 'Default'
--- ELSE 'Custom'
--- END as timeType,
---
--- CASE
--- WHEN snomed.code IS NOT NULL THEN 'Post Op Meds'
--- ELSE t1.category
--- END as category,
--- --t1.category,
---
--- t1.frequency.meaning as frequency,
--- t1.date as startDate,
--- timestampdiff('SQL_TSI_DAY', cast(t1.dateOnly as timestamp), dr.dateOnly) + 1 as daysElapsed,
--- t1.enddate,
--- --t1.duration,
--- t1.project,
--- t1.code,
---
--- t1.volume,
--- t1.vol_units,
--- t1.concentration,
--- t1.conc_units,
--- t1.amount,
--- t1.amount_units,
--- t1.amountWithUnits,
--- t1.amountAndVolume,
--- t1.dosage,
--- t1.dosage_units,
--- t1.qualifier,
---
--- t1.route,
--- t1.reason,
--- t1.performedby,
--- t1.remark,
--- --t1.description,
---
--- t1.qcstate
---
--- FROM ehr_lookups.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
--- )
---
--- LEFT JOIN ehr.treatment_times tt ON (tt.treatmentid = t1.objectid)
--- LEFT JOIN ehr_lookups.treatment_frequency_times ft ON (ft.frequency = t1.frequency.meaning AND tt.rowid IS NULL)
---
--- INNER JOIN (
--- SELECT
--- sc.code
--- from ehr_lookups.snomed_subset_codes sc
--- WHERE sc.primaryCategory = 'Post Op Meds'
--- GROUP BY sc.code
--- ) snomed ON snomed.code = t1.code
---
--- --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()
---
--- ) s
---
--- ) s ON (s.animalid = h.id)
---
--- WHERE h.calculated_status = 'Alive'
---
--- --account for date/time in schedule
--- and s.date >= s.startDate and s.date <= s.enddate
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/demographicsAssignedVet.query.xml b/onprc_ehr/resources/queries/study/demographicsAssignedVet.query.xml
deleted file mode 100644
index 16a065547..000000000
--- a/onprc_ehr/resources/queries/study/demographicsAssignedVet.query.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
- Assigned Vets
-
-
- true
-
-
-
-
-
-
-
diff --git a/onprc_ehr/resources/queries/study/demographicsAssignedVet.sql b/onprc_ehr/resources/queries/study/demographicsAssignedVet.sql
deleted file mode 100644
index 3a7ba2602..000000000
--- a/onprc_ehr/resources/queries/study/demographicsAssignedVet.sql
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-study.demographicsAssignedVet
-
-Returns one or more assigned vets per animal ID
- * When there is an open case, it returns one record for each vet having an open
- case for that animal
- * When there is not an open case, it returns one record for the lowest-numbered
- matched rule
- * VAF2 determines the lowest matched rule for each animal. Doing an inner join
- with VAF1 results in only those records matching the lowest matched rule per
- animal. The select distinct limits it to a single record.
-
-Future enhancements
- * Add ProjectType to select statement and hide in XML
- * Add Protocol_PI to study.vet_assignmentFilter and to onprc_ehr.vet_assignment
- * Add species to study.vet_assignmentFilter and to onprc_ehr.vet_assignment
- * Add validation to onprc_ehr.vet_assignment to prevent creating a rule that has
- * no match in the filter
- */
-
-SELECT DISTINCT VAF1.Id
- , VAF1.AssignedVet
- , VAF1.AssignmentType
- , VAF1.Room
- , VAF1.Area
- , VAF1.Calculated_Status
- , VAF1.MatchedRule
-FROM vetAssignment_filter AS VAF1
- INNER JOIN (
- SELECT VAF2.Id
- , MIN(VAF2.matchedRule) AS minRule
- FROM vetAssignment_filter AS VAF2
- GROUP BY VAF2.id
-) AS VAF3
- ON VAF1.id = VAF3.id
- AND VAF1.matchedRule = VAF3.minRule
-
-
--- SELECT VAF1.Id
--- , VAF1.AssignedVet
--- , VAF1.AssignmentType
--- /* , VAF1.AssignmentType AS codeAssignmentType*/
--- , VAF1.Room
--- , VAF1.Area
--- , VAF1.Project
--- , VAF1.Protocol
--- , VAF1.ProtocolPI
--- , VAF1.Calculated_Status
--- , VAF1.MatchedRule
--- , VAF1.history
--- FROM vetAssignment_filter AS VAF1
--- INNER JOIN (
--- SELECT VAF2.Id
--- , MIN(VAF2.matchedRule) AS minRule
--- FROM vetAssignment_filter AS VAF2
--- GROUP BY VAF2.id
--- ) AS VAF3 ON VAF1.id = VAF3.id
--- AND VAF1.matchedRule = VAF3.minRule
diff --git a/onprc_ehr/resources/queries/study/treatmentScheduleMPA.query.xml b/onprc_ehr/resources/queries/study/treatmentScheduleMPA.query.xml
deleted file mode 100644
index 830f79524..000000000
--- a/onprc_ehr/resources/queries/study/treatmentScheduleMPA.query.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
- MPA Injections
-
-
- Status
-
-
-
-
-
-
diff --git a/onprc_ehr/resources/queries/study/treatmentScheduleMPA.sql b/onprc_ehr/resources/queries/study/treatmentScheduleMPA.sql
deleted file mode 100644
index 13defec33..000000000
--- a/onprc_ehr/resources/queries/study/treatmentScheduleMPA.sql
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2015 LabKey Corporation
- * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
-
- -- Created by Kollil on 9/25/2023
- Tkt# 9939
- Creating a new alert for this medication. This MPA injection is a post op med category but scheduled once a month.
-
- */
-SELECT
- h.id,
- h.calculated_status,
- --s.TreatmentStatus,
- (SELECT max(d.qcstate.label) as label FROM study.drug d WHERE s.objectid = d.treatmentid and s.date = d.timeordered) as TreatmentStatus,
- h.Id.curLocation.room as room,
- h.Id.curLocation.cage as cage,
- s.date,
- s.startDate,
- s.endDate,
- s.dayselapsed,
- s.category,
- s.code,
- s.code.meaning as medication,
- s.volume,
- s.vol_units,
- s.concentration,
- s.conc_units,
- s.amountWithUnits,
- s.amountAndVolume,
- s.dosage,
- s.dosage_units,
- s.frequency,
- s.route,
- s.reason,
- s.remark,
- s.performedby
-FROM study.demographics h JOIN (
-
- SELECT
- s.animalid, s.TreatmentStatus, timestampadd('SQL_TSI_MINUTE', ((s.hours * 60) + s.minutes), s.origDate) as date, s.objectid,
- s.startdate, s.enddate, s.dayselapsed, s.category, s.code, s.volume, s.vol_units, s.concentration, s.conc_units,
- s.amountWithUnits, s.amountAndVolume, s.dosage, s.dosage_units, s.frequency, s.route, s.reason, s.remark, s.performedby
- FROM (
-
- SELECT
- t1.objectid,
- t1.id as animalid,
- (coalesce(tt.time, ft.hourofday, (hour(t1.date) * 100)) / 100) as hours,
-
- CASE
- WHEN (tt.time IS NOT NULL OR ft.hourofday IS NOT NULL) THEN (((coalesce(tt.time, ft.hourofday) / 100.0) - floor(coalesce(tt.time, ft.hourofday) / 100)) * 100)
- ELSE minute(t1.date)
- END as minutes,
- dr.date as origDate,
-
- CASE
- WHEN snomed.code IS NOT NULL THEN 'Post Op Meds'
- ELSE t1.category
- END as category,
-
- t1.date as startDate,
- timestampdiff('SQL_TSI_DAY', cast(t1.dateOnly as timestamp), dr.dateOnly) + 1 as daysElapsed,
- t1.enddate, t1.code, t1.volume, t1.vol_units, t1.concentration, t1.conc_units, t1.amountWithUnits,
- t1.amountAndVolume, t1.dosage, t1.dosage_units, t1.frequency.meaning + ' (' + t1.frequency.times + ')' as frequency, t1.route,
- t1.reason, t1.performedby, t1.remark, t1.qcstate.label as TreatmentStatus
-
- FROM ehr_lookups.dateRange dr
-
- Join study."Treatment Orders" t1
- ON (dr.dateOnly >= t1.dateOnly and dr.dateOnly <= t1.enddateCoalesced AND
- mod(CAST(timestampdiff('SQL_TSI_DAY', CAST(t1.dateOnly as timestamp), dr.dateOnly) as integer), t1.frequency.intervalindays) = 0
- )
-
- LEFT JOIN ehr.treatment_times tt ON (tt.treatmentid = t1.objectid)
- LEFT JOIN ehr_lookups.treatment_frequency_times ft ON (ft.frequency = t1.frequency.meaning AND tt.rowid IS NULL)
-
- INNER JOIN (
- SELECT
- sc.code
- FROM ehr_lookups.snomed_subset_codes sc
- WHERE sc.primaryCategory = 'Post Op Meds'
- /* Added this clause by Kollil on 10/4/2023 to exclude the MPA injection from the list.
- This change is made according to the new request by Cassie Tkt# 9939. The MPA med is part of the post op meds category
- so, excluding the other post op meds from this alert list. This list produces only the MPA injection entires.
- */
- AND sc.code IN ('E-85760')
- GROUP BY sc.code
- ) snomed ON snomed.code = t1.code
-
---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
- ) s
-
-) s ON (s.animalid = h.id)
-WHERE h.calculated_status = 'Alive'
- --account for date/time in schedule
- and s.date >= s.startDate and s.date <= s.enddate
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/vetAssignment_demographics.sql b/onprc_ehr/resources/queries/study/vetAssignment_demographics.sql
deleted file mode 100644
index 0adf50eb4..000000000
--- a/onprc_ehr/resources/queries/study/vetAssignment_demographics.sql
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-study.vetAssignment_demographics
-
-Replaces: study.vetAssignmentDemographics
-
-Returns at least one record for all living NHPs at the center.
-Notes:
- * Multiple open cases and multiple assignments for a single animal
- result in open cases * assignments for that animal
- * Left joins are needed for CMUcases and assignedProject as those tables
- might not have records for an animal ID. Left joins are used for all
- other joins to be resiliant against missing data.
- * enddate.TimeCoalesced is never in the future
-
-Future modifications:
- * Limit open cases to those that are not inactive after confirming w/ Heather
- */
-
-SELECT demographics.id
- , CMUcases.assignedVet.displayName AS caseVet
- , CMUcases.date AS caseDate
- , housing.room
- , housing.room.area
- , assignedProject.project AS project
- , assignedProject.Protocol AS protocol
- , assignedProject.PI AS protocolPI
- , assignedProject.projectType AS assignmentType
- , demographics.calculated_status
- , demographics.gender
- , demographics.species
- , demographics.history
-FROM Site.{ substitutePath moduleProperty('EHR', 'EHRStudyContainer') }.study.animal AS nhp
-LEFT JOIN Site.{ substitutePath moduleProperty('EHR', 'EHRStudyContainer') }.study.ClinicalCases_Open AS CMUcases
-ON CMUcases.id = nhp.id
- LEFT JOIN Site.{ substitutePath moduleProperty('EHR', 'EHRStudyContainer') }.study.housing AS housing
- ON housing.id = nhp.id
- LEFT JOIN Site.{ substitutePath moduleProperty('EHR', 'EHRStudyContainer') }.study.demographics AS demographics
- ON demographics.id = nhp.id
- LEFT JOIN Site.{ substitutePath moduleProperty('EHR', 'EHRStudyContainer') }.study.vetAssignment_projects AS assignedProject
- ON assignedProject.id = nhp.id
-WHERE demographics.Calculated_Status = 'Alive'
- AND nhp.id NOT LIKE '[A-Z]%'
- AND housing.enddate IS NULL
-
-
-/*
-study.vetAssignment_demographics.sql
-
-Replaces: study.vetAssignmentDemographics
-
-Returns at least one record for all living NHPs at the center.
-Notes:
- * Multiple open cases and multiple assignments for a single animal
- result in open cases * assignments for that animal
- * Left joins are needed for CMUcases and assignedProject as those tables
- might not have records for an animal ID. Left joins are used for all
- other joins to be resiliant against missing data.
-
-Future modifications:
- * Limit open cases to those that are not inactive
- */
-/*
-SELECT demographics.id
- , CMUcases.assignedVet.displayName AS caseVet
- , CMUcases.DATE AS caseDate
- , housing.room
- , housing.room.area
- , assignedProject.project AS project
- , assignedProject.Protocol AS protocol
- , assignedProject.PI AS protocolPI
- , assignedProject.projectType AS assignmentType
- , demographics.calculated_status
- , demographics.gender
- , demographics.species
- , demographics.history
-FROM Site.{ substitutePath moduleProperty('EHR', 'EHRStudyContainer') }.study.animal AS nhp
-LEFT JOIN Site.{ substitutePath moduleProperty('EHR', 'EHRStudyContainer') }.study.ClinicalCases_Open AS CMUcases
-ON CMUcases.id = nhp.id
- LEFT JOIN Site.{ substitutePath moduleProperty('EHR', 'EHRStudyContainer') }.study.housing AS housing
- ON housing.id = nhp.id
- LEFT JOIN Site.{ substitutePath moduleProperty('EHR', 'EHRStudyContainer') }.study.demographics AS demographics
- ON demographics.id = nhp.id
- LEFT JOIN Site.{ substitutePath moduleProperty('EHR', 'EHRStudyContainer') }.study.vetAssignment_projects AS assignedProject
- ON assignedProject.id = nhp.id
-WHERE demographics.Calculated_Status = 'Alive'
- AND nhp.id NOT LIKE '[A-Z]%'
- AND (
- housing.enddateTimeCoalesced >= Curdate()
- OR housing.enddateTimeCoalesced IS NULL
- )
-
-*/
diff --git a/onprc_ehr/resources/queries/study/vetAssignment_projects.sql b/onprc_ehr/resources/queries/study/vetAssignment_projects.sql
deleted file mode 100644
index e03256a34..000000000
--- a/onprc_ehr/resources/queries/study/vetAssignment_projects.sql
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-study.vetAssignment_projects
-
-Replaces:
- * study.vetAssignedResearch
- * study.vetAssignedResearch_project
- * study.vetAssignedResource
- * study.vetAssignedResource_project
-
-Returns a record for each active assignment of an animal ID to a project.
-Notes:
- * Animals assigned to multiple projects results in multiple records
- * Animals solely on the P51 are not considered "assigned" in PRIMe
- and won't have records returned by this query
- * Uses Curdate() to avoid issues where an assignment ends on the day this
- query is run
- * Returns the actual use category instead of "Project Resource Assigned"
- or "Project Research Assigned"
- */
-
-SELECT Id
- , project
- , project.protocol.external_id AS Protocol
- , project.protocol.investigatorID.lastname AS PI
- , date
- , enddate
- , project.use_category AS projectType
-FROM study.assignment
-WHERE date <= Curdate()
- AND (
- enddate IS NULL
- OR enddate >= Curdate()
- )
-
-/*
-study.vetAssignment_projects.sql
-
-Replaces:
- * study.vetAssignedResearch
- * study.vetAssignedResearch_project
- * study.vetAssignedResource
- * study.vetAssignedResource_project
-
-Returns a record for each active assignment of an animal ID to a project.
-Notes:
- * Animals assigned to multiple projects results in multiple records
- * Animals solely on the P51 are not considered "assigned" in PRIMe
- and won't have records returned by this query
- * Uses Curdate() to avoid issues where an assignment ends on the day this
- query is run
- * Returns the actual use category instead of "Project Resource Assigned"
- or "Project Research Assigned"
- */
-
-/*
-SELECT Id
- , project
- , project.protocol.external_id AS Protocol
- , project.protocol.investigatorID.lastname AS PI
- , date
- , enddate
- , project.use_category AS projectType
-FROM study.assignment
-WHERE date <= Curdate()
- AND (
- enddate IS NULL
- OR enddate >= Curdate()
- )
-
- */
\ No newline at end of file
diff --git a/onprc_ehr/resources/queries/study/vetassignment_filter.sql b/onprc_ehr/resources/queries/study/vetassignment_filter.sql
deleted file mode 100644
index b0d1ce126..000000000
--- a/onprc_ehr/resources/queries/study/vetassignment_filter.sql
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
-study.vetAssignment_filter
-
-Partially replaces: study.demographicsAssignedVet, which still exists
-
-Returns a record for each input record from study.vetAssignment_demographics
-using vet assignment rules defined in onprc_ehr.vet_assignment
-
-Notes:
- * This can result in multiple assignments per animal
- * Comparisons against rules check for both matches against rule requirements and
- no additional rule requirements to ensure no false positives
- * Comparisons rely on empty data to be NULL, not ""
- * The code prioritizes research projects over non-research projects *for
- the same rule*
- * Unassigned animals can be found by filtering for "unassigned" in
- the AssignedVet column
- */
-
-SELECT *
-FROM (
- SELECT d.Id
- , CASE
- WHEN d.CaseVet IS NOT NULL THEN d.CaseVet
- WHEN R01.UserID IS NOT NULL THEN R01.UserID.DisplayName
- WHEN R02.UserID IS NOT NULL THEN R02.UserID.DisplayName
- WHEN R03.UserID IS NOT NULL THEN R03.UserID.DisplayName
- WHEN R04.UserID IS NOT NULL THEN R04.UserID.DisplayName
- WHEN R05.UserID IS NOT NULL THEN R05.UserID.DisplayName
- WHEN R06.UserID IS NOT NULL THEN R06.UserID.DisplayName
- WHEN R07.UserID IS NOT NULL THEN R07.UserID.DisplayName
- WHEN R08.UserID IS NOT NULL THEN R08.UserID.DisplayName
- WHEN R09.UserID IS NOT NULL THEN R09.UserID.DisplayName
- WHEN R10.UserID IS NOT NULL THEN R10.UserID.DisplayName
- WHEN R11.UserID IS NOT NULL THEN R11.UserID.DisplayName
- WHEN R12.UserID IS NOT NULL THEN R12.UserID.DisplayName
- WHEN R13.UserID IS NOT NULL THEN R13.UserID.DisplayName
- WHEN R14.UserID IS NOT NULL THEN R14.UserID.DisplayName
- WHEN R15.UserID IS NOT NULL THEN R15.UserID.DisplayName
- WHEN R16.UserID IS NOT NULL THEN R16.UserID.DisplayName
- WHEN R17.UserID IS NOT NULL THEN R17.UserID.DisplayName
- WHEN R18.UserID IS NOT NULL THEN R18.UserID.DisplayName
- WHEN R19.UserID IS NOT NULL THEN R19.UserID.DisplayName
- WHEN R20.UserID IS NOT NULL THEN R20.UserID.DisplayName
- WHEN R21.UserID IS NOT NULL THEN R21.UserID.DisplayName
- WHEN R22.UserID IS NOT NULL THEN R22.UserID.DisplayName
- ELSE 'Unassigned'
- END AS AssignedVet
- , CASE
- WHEN d.CaseVet IS NOT NULL THEN 'Open Case'
- WHEN R01.UserID IS NOT NULL THEN 'Room Priority'
- WHEN R02.UserID IS NOT NULL THEN 'Area Priority'
- WHEN R03.UserID IS NOT NULL THEN 'Project Room Research Priority'
- WHEN R04.UserID IS NOT NULL THEN 'Project Room Resource Priority'
- WHEN R05.UserID IS NOT NULL THEN 'Project Room Research'
- WHEN R06.UserID IS NOT NULL THEN 'Project Room Resource'
- WHEN R07.UserID IS NOT NULL THEN 'Project Area Research Priority'
- WHEN R08.UserID IS NOT NULL THEN 'Project Area Resource Priority'
- WHEN R09.UserID IS NOT NULL THEN 'Project Area Research'
- WHEN R10.UserID IS NOT NULL THEN 'Project Area Resource'
- WHEN R11.UserID IS NOT NULL THEN 'Project Research Priority'
- WHEN R12.UserID IS NOT NULL THEN 'Project Resource Priority'
- WHEN R13.UserID IS NOT NULL THEN 'Project Research'
- WHEN R14.UserID IS NOT NULL THEN 'Project Resource'
- WHEN R15.UserID IS NOT NULL THEN 'Protocol Room Priority'
- WHEN R16.UserID IS NOT NULL THEN 'Protocol Area Priority'
- WHEN R17.UserID IS NOT NULL THEN 'Protocol Room'
- WHEN R18.UserID IS NOT NULL THEN 'Protocol Area'
- WHEN R19.UserID IS NOT NULL THEN 'Protocol Priority'
- WHEN R20.UserID IS NOT NULL THEN 'Protocol'
- WHEN R21.UserID IS NOT NULL THEN 'Room'
- WHEN R22.UserID IS NOT NULL THEN 'Area'
- ELSE 'No Matching Rule'
- END AS AssignmentType
- , d.CaseVet
- , d.CaseDate
- , d.Project
- , d.AssignmentType AS ProjectType
- , d.Protocol
- , d.ProtocolPI
- , d.Room
- , d.Area
- , d.Calculated_status
- , CASE
- WHEN d.CaseVet IS NOT NULL THEN 0
- WHEN R01.UserID IS NOT NULL THEN 1
- WHEN R02.UserID IS NOT NULL THEN 2
- WHEN R03.UserID IS NOT NULL THEN 3
- WHEN R04.UserID IS NOT NULL THEN 4
- WHEN R05.UserID IS NOT NULL THEN 5
- WHEN R06.UserID IS NOT NULL THEN 6
- WHEN R07.UserID IS NOT NULL THEN 7
- WHEN R08.UserID IS NOT NULL THEN 8
- WHEN R09.UserID IS NOT NULL THEN 9
- WHEN R10.UserID IS NOT NULL THEN 10
- WHEN R11.UserID IS NOT NULL THEN 11
- WHEN R12.UserID IS NOT NULL THEN 12
- WHEN R13.UserID IS NOT NULL THEN 13
- WHEN R14.UserID IS NOT NULL THEN 14
- WHEN R15.UserID IS NOT NULL THEN 15
- WHEN R16.UserID IS NOT NULL THEN 16
- WHEN R17.UserID IS NOT NULL THEN 17
- WHEN R18.UserID IS NOT NULL THEN 18
- WHEN R19.UserID IS NOT NULL THEN 19
- WHEN R20.UserID IS NOT NULL THEN 20
- WHEN R21.UserID IS NOT NULL THEN 21
- WHEN R22.UserID IS NOT NULL THEN 22
- ELSE 99
- END AS MatchedRule
- FROM study.vetAssignment_demographics AS d
-/* R01 Room Priority */ LEFT JOIN onprc_ehr.vet_assignment R01 ON (R01.Room = d.Room AND R01.Area IS NULL AND R01.Project IS NULL AND R01.Protocol IS NULL AND R01.Priority = true)
-/* R02 Area Priority */ LEFT JOIN onprc_ehr.vet_assignment R02 ON (R02.Area = d.Area AND R02.Room IS NULL AND R02.Project IS NULL AND R02.Protocol IS NULL AND R02.Priority = true)
-
-/* R03 Project Room Research Priority */ LEFT JOIN onprc_ehr.vet_assignment R03 ON (R03.Project = d.Project AND R03.Room = d.Room AND R03.Area IS NULL AND R03.Protocol IS NULL AND R03.Priority = true AND d.AssignmentType = 'Research')
-/* R04 Project Room Resource Priority */ LEFT JOIN onprc_ehr.vet_assignment R04 ON (R04.Project = d.Project AND R04.Room = d.Room AND R04.Area IS NULL AND R04.Protocol IS NULL AND R04.Priority = true AND d.AssignmentType <> 'Research')
-
-/* R05 Project Room Research */ LEFT JOIN onprc_ehr.vet_assignment R05 ON (R05.Project = d.Project AND R05.Room = d.Room AND R05.Area IS NULL AND R05.Protocol IS NULL AND R05.Priority = false AND d.AssignmentType = 'Research')
-/* R06 Project Room Resource */ LEFT JOIN onprc_ehr.vet_assignment R06 ON (R06.Project = d.Project AND R06.Room = d.Room AND R06.Area IS NULL AND R06.Protocol IS NULL AND R06.Priority = false AND d.AssignmentType <> 'Research')
-
-/* R07 Project Area Research Priority */ LEFT JOIN onprc_ehr.vet_assignment R07 ON (R07.Project = d.Project AND R07.Area = d.Area AND R07.Room IS NULL AND R07.Protocol IS NULL AND R07.Priority = true AND d.AssignmentType = 'Research')
-/* R08 Project Area Resource Priority */ LEFT JOIN onprc_ehr.vet_assignment R08 ON (R08.Project = d.Project AND R08.Area = d.Area AND R08.Room IS NULL AND R08.Protocol IS NULL AND R08.Priority = true AND d.AssignmentType <> 'Research')
-
-/* R09 Project Area Research */ LEFT JOIN onprc_ehr.vet_assignment R09 ON (R09.Project = d.Project AND R09.Area = d.Area AND R09.Room IS NULL AND R09.Protocol IS NULL AND R09.Priority = false AND d.AssignmentType = 'Research')
-/* R10 Project Area Resource */ LEFT JOIN onprc_ehr.vet_assignment R10 ON (R10.Project = d.Project AND R10.Area = d.Area AND R10.Room IS NULL AND R10.Protocol IS NULL AND R10.Priority = false AND d.AssignmentType <> 'Research')
-
-/* R11 Project Research Priority */ LEFT JOIN onprc_ehr.vet_assignment R11 ON (R11.Project = d.Project AND R11.Area IS NULL AND R11.Room IS NULL AND R11.Protocol IS NULL AND R11.Priority = true AND d.AssignmentType = 'Research')
-/* R12 Project Resource Priority */ LEFT JOIN onprc_ehr.vet_assignment R12 ON (R12.Project = d.Project AND R12.Area IS NULL AND R12.Room IS NULL AND R12.Protocol IS NULL AND R12.Priority = true AND d.AssignmentType <> 'Research')
-
-/* R13 Project Research */ LEFT JOIN onprc_ehr.vet_assignment R13 ON (R13.Project = d.Project AND R13.Area IS NULL AND R13.Room IS NULL AND R13.Protocol IS NULL AND R13.Priority = false AND d.AssignmentType = 'Research')
-/* R14 Project Resource */ LEFT JOIN onprc_ehr.vet_assignment R14 ON (R14.Project = d.Project AND R14.Area IS NULL AND R14.Room IS NULL AND R14.Protocol IS NULL AND R14.Priority = false AND d.AssignmentType <> 'Research')
-
-/* R15 Protocol Room Priority */ LEFT JOIN onprc_ehr.vet_assignment R15 ON (R15.Protocol.DisplayName = d.Protocol AND R15.Room = d.Room AND R15.Area IS NULL AND R15.Project IS NULL AND R15.Priority = true)
-/* R16 Protocol Area Priority */ LEFT JOIN onprc_ehr.vet_assignment R16 ON (R16.Protocol.DisplayName = d.Protocol AND R16.Area = d.Area AND R16.Room IS NULL AND R16.Project IS NULL AND R16.Priority = true)
-
-/* R17 Protocol Room */ LEFT JOIN onprc_ehr.vet_assignment R17 ON (R17.Protocol.DisplayName = d.Protocol AND R17.Room = d.Room AND R17.Area IS NULL AND R17.Project IS NULL AND R17.Priority = false)
-/* R18 Protocol Area */ LEFT JOIN onprc_ehr.vet_assignment R18 ON (R18.Protocol.DisplayName = d.Protocol AND R18.Area = d.Area AND R18.Room IS NULL AND R18.Project IS NULL AND R18.Priority = false)
-
-/* R19 Protocol Priority */ LEFT JOIN onprc_ehr.vet_assignment R19 ON (R19.Protocol.DisplayName = d.Protocol AND R19.Area IS NULL AND R19.Room IS NULL AND R19.Project IS NULL AND R19.Priority = true)
-/* R20 Protocol */ LEFT JOIN onprc_ehr.vet_assignment R20 ON (R20.Protocol.DisplayName = d.Protocol AND R20.Area IS NULL AND R20.Room IS NULL AND R20.Project IS NULL AND R20.Priority = false)
-
-/* R21 Room */ LEFT JOIN onprc_ehr.vet_assignment R21 ON (R21.Room = d.Room AND R21.Area IS NULL AND R21.Protocol IS NULL AND R21.Project IS NULL AND R21.Priority = false)
-/* R22 Area */ LEFT JOIN onprc_ehr.vet_assignment R22 ON (R22.Area = d.Area AND R22.Room IS NULL AND R22.Protocol IS NULL AND R22.Project IS NULL AND R22.Priority = false)
- ) placeholderAlias
-
diff --git a/onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-20.418-20.419.sql b/onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-20.418-20.419.sql
new file mode 100644
index 000000000..5889279c9
--- /dev/null
+++ b/onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-20.418-20.419.sql
@@ -0,0 +1,17 @@
+EXEC core.fn_dropifexists 'IPC_Reference_Data','onprc_ehr','TABLE';
+GO
+
+/****** Object: Table [onprc_ehr].[IPC_Reference_Data] Script Date: 4/27/2020 ******/
+CREATE TABLE [onprc_ehr].[IPC_Reference_Data](
+ [rowId] INT IDENTITY(1,1)NOT NULL,
+ [value] [nvarchar](1000) NULL,
+ [name] [nvarchar](1000) NULL,
+ [remark] [nvarchar](4000) NULL,
+ [dateDisabled] [datetime] NULL,
+ [created] [datetime] NULL,
+ [createdBy] [int] NULL,
+ [modified] [datetime] NULL,
+ [modifiedBy] [int] NULL
+
+ CONSTRAINT pk_IPC_Reference_Data PRIMARY KEY (rowId)
+ )
\ No newline at end of file
diff --git a/onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-23.007-23.008.sql b/onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-23.007-23.008.sql
new file mode 100644
index 000000000..ad07d4cfc
--- /dev/null
+++ b/onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-23.007-23.008.sql
@@ -0,0 +1,17 @@
+EXEC core.fn_dropifexists 'IPC_Reference_Data','onprc_ehr','TABLE';
+GO
+
+/****** Object: Table [onprc_ehr].[IPC_Reference_Data] Script Date: 4/27/2020 ******/
+CREATE TABLE [onprc_ehr].[IPC_Reference_Data](
+ [rowId] INT IDENTITY(1,1)NOT NULL,
+ [value] [nvarchar](1000) NULL,
+ [name] [nvarchar](1000) NULL,
+ [remark] [nvarchar](4000) NULL,
+ [dateDisabled] [datetime] NULL,
+ [created] [datetime] NULL,
+ [createdBy] [int] NULL,
+ [modified] [datetime] NULL,
+ [modifiedBy] [int] NULL
+
+ CONSTRAINT pk_IPC_Reference_Data PRIMARY KEY (rowId)
+ )
diff --git a/onprc_ehr/resources/schemas/onprc_ehr.xml b/onprc_ehr/resources/schemas/onprc_ehr.xml
index 858275b36..8f9f18715 100644
--- a/onprc_ehr/resources/schemas/onprc_ehr.xml
+++ b/onprc_ehr/resources/schemas/onprc_ehr.xml
@@ -867,6 +867,40 @@
+
+
+ IPC_Reference_Data
+
+ DETAILED
+
+
+ true
+
+
+
+ Value
+
+
+
+ Name
+
+
+
+
+ End Date
+
+
+
+ true
+
+
+
+ true
+
+
+
+
+
diff --git a/onprc_ehr/resources/web/onprc_ehr/data/IPCClientStore.js b/onprc_ehr/resources/web/onprc_ehr/data/IPCClientStore.js
new file mode 100644
index 000000000..91eda9bce
--- /dev/null
+++ b/onprc_ehr/resources/web/onprc_ehr/data/IPCClientStore.js
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2013-2015 LabKey Corporation
+ *
+ * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
+ */
+Ext4.define('EHR.data.IPCClientStore', {
+ extend: 'EHR.data.DataEntryClientStore',
+
+ constructor: function(){
+ this.callParent(arguments);
+
+ this.on('add', this.onAddRecord, this);
+ },
+
+ onAddRecord: function(store, records){
+ Ext4.each(records, function(record){
+ this.onRecordUpdate(record, ['procedureid']);
+ }, this);
+ },
+
+ afterEdit: function(record, modifiedFieldNames){
+ this.onRecordUpdate(record, modifiedFieldNames);
+
+ this.callParent(arguments);
+ },
+
+ onRecordUpdate: function(record, modifiedFieldNames){
+ if (record.get('procedureid')){
+ modifiedFieldNames = modifiedFieldNames || [];
+
+ var lookupRec = this.getProcedureRecord(record.get('procedureid'));
+ if (!lookupRec)
+ return;
+
+ if (lookupRec.get('remark')&& record.get('remark')== null){
+ record.beginEdit();
+ record.set('remark', lookupRec.get('remark'));
+ record.endEdit(true);
+ }
+ }
+
+ if (modifiedFieldNames && (modifiedFieldNames.indexOf('Id') > -1 || modifiedFieldNames.indexOf('project') > -1 )){ //} modifiedFieldNames.indexOf('chargetype') > -1)){
+ if (record.get('objectid')){
+ var toApply = {
+ Id: record.get('Id'),
+ project: record.get('project'),
+ //chargetype: record.get('chargetype')
+ };
+
+ this.storeCollection.clientStores.each(function(cs){
+ if (cs.storeId === this.storeCollection.collectionId + '-' + 'IPC_ServiceRequestDetails'){
+ return;
+ }
+
+ var projectField = cs.getFields().get('project');
+ // var chargeTypeField = cs.getFields().get('chargetype');
+ var hasChanges = false;
+
+ if (cs.getFields().get('parentid')){
+ if (cs.getFields().get('Id') || cs.getFields().get('project')){
+ cs.each(function(r){
+ if (r.get('parentid') === record.get('objectid')){
+ var obj = {};
+
+ if (projectField){
+ if (!r.get('project') || (projectField.inheritFromParent && r.get('project') !== record.get('project'))){
+ obj.project = record.get('project');
+ }
+ }
+ //
+ // if (chargeTypeField){
+ // if (!r.get('chargetype') || (chargeTypeField.inheritFromParent && r.get('chargetype') !== record.get('chargetype'))){
+ // obj.chargetype = record.get('chargetype');
+ // }
+ // }
+
+ if (r.get('Id') !== record.get('Id')){
+ obj.Id = record.get('Id');
+ }
+
+ if (!Ext4.Object.isEmpty(obj)){
+ r.beginEdit();
+ r.set(obj);
+ r.endEdit(true);
+ hasChanges = true;
+ }
+ }
+ }, this);
+ }
+ }
+
+ if (hasChanges){
+ cs.fireEvent('datachanged', cs);
+ }
+ }, this);
+ }
+ }
+ },
+
+ getProcedureRecord: function(procedureId) {
+ var procedureStore = EHR.DataEntryUtils.getProceduresStore();
+ LDK.Assert.assertNotEmpty('Unable to find procedureStore from IPCClientStore', procedureStore);
+
+ var procRecIdx = procedureStore.findExact('rowid', procedureId);
+ LDK.Assert.assertTrue('Unable to find procedure record in IPCClientStore for procedureId: [' + procedureId + ']', procRecIdx > -1);
+
+ var procedureRec = procedureStore.getAt(procRecIdx);
+ LDK.Assert.assertNotEmpty('Unable to find procedure record from IPCClientStore. ProcedureId was: [' + procedureId + ']', procedureRec);
+
+ return procedureRec;
+ }
+
+});
diff --git a/onprc_ehr/resources/web/onprc_ehr/data/IPCStoreCollection.js b/onprc_ehr/resources/web/onprc_ehr/data/IPCStoreCollection.js
new file mode 100644
index 000000000..5b387f01d
--- /dev/null
+++ b/onprc_ehr/resources/web/onprc_ehr/data/IPCStoreCollection.js
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2013-2014 LabKey Corporation
+ *
+ * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
+ */
+Ext4.define('EHR.data.IPCStoreCollection', {
+ extend: 'EHR.data.TaskStoreCollection',
+
+ getIPCStore: function(){
+ if (this.IPCStore){
+ return this.IPCStore;
+ }
+
+ this.IPCStore = this.getClientStoreByName('IPC_ServiceRequestDetails');
+ LDK.Assert.assertNotEmpty('Unable to find IPC store in IPCStoreCollection', this.IPCStore);
+
+ return this.IPCStore;
+ },
+
+ getIPCRecord: function(parentid){
+ if (!parentid){
+ return null;
+ }
+
+ var IPCStore = this.getIPCStore();
+ var er;
+ IPCStore.each(function(r){
+ if (r.get('objectid') == parentid){
+ er = r;
+ return false;
+ }
+ }, this);
+
+ return er;
+ },
+
+ onClientStoreUpdate: function(){
+ this.doUpdateRecords();
+ this.callParent(arguments);
+ },
+
+ setClientModelDefaults: function(model){
+ this.callParent(arguments);
+
+ var IPCStore = this.getIPCStore();
+ if (model.store && model.store.storeId == IPCStore.storeId){
+ console.log('is IPC service request, skipping');
+ return;
+ }
+
+ if (IPCStore.getCount() == 1){
+ if (model.fields.get('parentid') && model.get('parentid') == null){
+ model.data.parentid = IPCStore.getAt(0).get('objectid');
+ }
+ }
+
+ if (model.fields.get('parentid') && model.get('parentid')){
+ //find matching IPC record and update fields if needed
+ var parentRec = this.getIPCRecord(model.get('parentid'));
+ if (parentRec){
+ model.beginEdit();
+ if (parentRec.get('Id') !== model.get('Id')){
+ model.set('Id', parentRec.get('Id'));
+ }
+
+ if (model.fields.get('date') && !model.get('date') && parentRec.get('date')){
+ model.set('date', parentRec.get('date'));
+ }
+
+ if (model.fields.get('project') && !model.get('project') && parentRec.get('project')){
+ model.set('project', parentRec.get('project'));
+ }
+
+ // if (model.fields.get('chargetype') && !model.get('chargetype') && parentRec.get('chargetype')){
+ // model.set('chargetype', parentRec.get('chargetype'));
+ // }
+
+ model.endEdit(true);
+ }
+ }
+ },
+
+ doUpdateRecords: function(){
+ var IPCStore = this.getIPCStore();
+ this.clientStores.each(function(cs){
+ if (cs.storeId == IPCStore.storeId){
+ return;
+ }
+
+ if (cs.getFields().get('Id') == null || cs.getFields().get('parentid') == null){
+ return;
+ }
+
+ var isIPCChild = cs.model.prototype.sectionCfg.configSources && cs.model.prototype.sectionCfg.configSources.indexOf('IPCChild') > -1;
+ cs.each(function(rec){
+ var IPCRec = this.getIPCRecord(rec.get('parentid'));
+ if (IPCRec != null){
+ var obj = {};
+ if (rec.get('Id') !== IPCRec.get('Id')){
+ //the goal of this is to allow specific sections to avoid inheriting the Id of the parent
+ if (isIPCChild || !IPCRec.get('Id'))
+ obj.Id = IPCRec.get('Id');
+
+ //if the ID doesnt match, clear parentid
+ if (!isIPCChild){
+ obj.parentid = null;
+ }
+ }
+
+ var pf = rec.fields.get('project');
+ if (pf && IPCRec.get('project')){
+ if (!rec.get('project')){
+ obj.project = IPCRec.get('project');
+ }
+ else if (pf.inheritFromParent && IPCRec.get('project') !== rec.get('project')){
+ obj.project = IPCRec.get('project');
+ }
+ }
+
+ // var cf = rec.fields.get('chargetype');
+ // if (cf && IPCRec.get('chargetype')){
+ // if (!rec.get('chargetype') || cf.inheritDateFromParent){
+ // obj.chargetype = IPCRec.get('chargetype');
+ // }
+ // }
+
+ var df = rec.fields.get('date');
+ if (df && IPCRec.get('date')){
+ if (!rec.get('date') || df.inheritDateFromParent){
+ if (!Ext4.Date.isEqual(rec.get('date'), IPCRec.get('date')))
+ obj.date = IPCRec.get('date');
+ }
+ }
+
+ if (!Ext4.Object.isEmpty(obj)){
+ rec.beginEdit();
+ rec.set(obj);
+ rec.endEdit(true);
+
+ // this is a slight misuse of this event. validation will queue and batch changes, rather than immediately updating each row
+ // individually. this is better than doing them one-by-one in large grids
+ if (rec.store){
+ rec.store.fireEvent('validation', rec.store, rec);
+ }
+ }
+ }
+
+ }, this);
+ }, this);
+ }
+});
\ No newline at end of file
diff --git a/onprc_ehr/resources/web/onprc_ehr/data/sources/TreatmentOrdersClientStore.js b/onprc_ehr/resources/web/onprc_ehr/data/sources/TreatmentOrdersClientStore.js
deleted file mode 100644
index 67d973567..000000000
--- a/onprc_ehr/resources/web/onprc_ehr/data/sources/TreatmentOrdersClientStore.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2013-2015 LabKey Corporation
- *
- * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
- */
-//Created: 7-29-2020 R.Blasa
-
-Ext4.define('ONPRC_EHR.data.TreatmentOrdersClientStore', {
- extend: 'EHR.data.DrugAdministrationRunsClientStore',
-
- constructor: function(){
- this.callParent(arguments);
-
- this.on('add', this.onAddRecord, this);
- },
-
- onAddRecord: function(store, records){
- Ext4.each(records, function(record){
- this.onRecordUpdate(record, ['objectid', 'code']);
- }, this);
- },
-
- afterEdit: function(record, modifiedFieldNames){
- this.onRecordUpdate(record, modifiedFieldNames);
-
- this.callParent(arguments);
- },
-
- onRecordUpdate: function(record, modifiedFieldNames){
- if (record.get('code')){
- modifiedFieldNames = modifiedFieldNames || [];
-
- if (modifiedFieldNames.indexOf('code') == -1){
- return;
- }
-
- /* Changed by Kollil on 10/11/2023,
- Requested by Cassie to remove the verbiage in the remark field for the MPA medication. Refer to tkt # 9939
- The default setting for this medication in DB schema browser is updated too.
- */
- if (record.get('code') == 'E-85760'){
- record.beginEdit();
- record.set('remark', '');
- record.endEdit(true);
- }
- // if (record.get('code') == 'E-85760' && record.get('remark') == null){
- // record.beginEdit();
- // record.set('remark', 'Please make a clinical prime entry at each administration once the administration is complete.');
- // record.endEdit(true);
- // }
-
- if (!this.formularyStore){
- LDK.Utils.logToServer({
- message: 'Unable to find formulary store in DrugAdministrationRunsClientStore'
- });
- console.error('Unable to find formulary store in DrugAdministrationRunsClientStore');
-
- return;
- }
-
- var values = this.formularyStore.getFormularyValues(record.get('code'));
- if (!Ext4.Object.isEmpty(values)){
- var params = {};
-
- for (var fieldName in this.fieldMap){
- if (!this.getFields().get(fieldName)){
- continue;
- }
-
- if (modifiedFieldNames.indexOf(this.fieldMap[fieldName]) != -1){
- //console.log('field already set: ' + fieldName);
- continue;
- }
-
- var def = values[fieldName];
- if (Ext4.isDefined(def)){
- params[this.fieldMap[fieldName]] = def;
- }
- }
-
- if (!LABKEY.Utils.isEmptyObj(params)){
- record.beginEdit();
- record.set(params);
- record.endEdit(true);
- }
- }
- }
- }
-
-
-});
diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_CassettePrinting.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_CassettePrinting.js
new file mode 100644
index 000000000..2afe146a5
--- /dev/null
+++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_CassettePrinting.js
@@ -0,0 +1,58 @@
+/**
+ * User: Kolli
+ * Date: 4/10/2020
+ * Time: 10:36 AM
+ */
+EHR.model.DataModelManager.registerMetadata('CassettePrinting', {
+ allQueries: {
+ },
+
+ byQuery: {
+ 'study.IPC_CassettePrinting': {
+
+ tissueType: {
+ columnConfig: {
+ width: 250
+ }
+ },
+
+ PILabel: {
+ header:"Additional text on cassette",
+ columnConfig: {
+ width: 200
+ }
+ },
+
+ cassetteColor: {
+ header:"Cassette Color",
+ columnConfig: {
+ width: 200
+ }
+ },
+
+ remark: {
+ header:"Remark",
+ hidden: false,
+ columnConfig: {
+ width: 250
+ }
+ },
+
+ performedBy: {
+ defaultValue: LABKEY.Security.currentUser.displayName,
+ columnConfig: {
+ width: 150
+ }
+ }
+ // ,
+ //
+ // qcstate: {
+ // hidden: true,
+ // defaultValue: 21
+ // }
+
+ }
+
+ }
+
+});
diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_Child.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_Child.js
new file mode 100644
index 000000000..b481aa490
--- /dev/null
+++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_Child.js
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2013-2014 LabKey Corporation
+ *
+ * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
+ */
+EHR.model.DataModelManager.registerMetadata('IPC_Child', {
+ allQueries: {
+ Id: {
+ editable: false,
+ columnConfig: {
+ editable: false
+ }
+ },
+ date: {
+ inheritDateFromParent: true
+ }
+
+ }
+
+
+});
\ No newline at end of file
diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_Other.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_Other.js
new file mode 100644
index 000000000..6fee8a8b6
--- /dev/null
+++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_Other.js
@@ -0,0 +1,39 @@
+/**
+ * User: Kolli
+ * Date: 4/10/2020
+ * Time: 10:36 AM
+ */
+
+EHR.model.DataModelManager.registerMetadata('IPC_Other', {
+ allQueries: {
+ },
+
+ byQuery: {
+ 'study.IPC_Other': {
+
+ tissueType: {
+ columnConfig: {
+ width: 250
+ }
+ },
+
+ serviceAndProducts: {
+ header:"Service & Products",
+ hidden: false,
+ columnConfig: {
+ width: 250
+ }
+ },
+
+ performedBy: {
+ defaultValue: LABKEY.Security.currentUser.displayName,
+ columnConfig: {
+ width: 150
+ }
+ }
+
+ }
+
+ }
+
+});
diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_ProcessingEmbedding.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_ProcessingEmbedding.js
new file mode 100644
index 000000000..3c00ead12
--- /dev/null
+++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_ProcessingEmbedding.js
@@ -0,0 +1,71 @@
+/**
+ * User: Kolli
+ * Date: 4/10/2020
+ * Time: 10:36 AM
+ */
+EHR.model.DataModelManager.registerMetadata('ProcessingEmbedding', {
+ allQueries: {
+ },
+ byQuery: {
+ 'study.IPC_ProcessingEmbedding': {
+
+ tissueType: {
+ columnConfig: {
+ width: 250
+ }
+ },
+
+ embedding: {
+ columnConfig: {
+ width: 200
+ }
+ },
+
+ fixationMethod: {
+ header:"Initial Fixative",
+ columnConfig: {
+ width: 200
+ }
+ },
+
+ fixationDuration: {
+ header:"Fixation Duration",
+ columnConfig: {
+ width: 150
+ }
+ },
+
+ currentFixative: {
+ header:"Current Fixative",
+ columnConfig: {
+ width: 150
+ }
+ },
+
+ processingType: {
+ header:"Processing Type",
+ columnConfig: {
+ width: 250
+ }
+ },
+
+ embeddingIns: {
+ header:"Embedding Instructions",
+ hidden: false,
+ columnConfig: {
+ width: 250
+ }
+ },
+
+ performedBy: {
+ defaultValue: LABKEY.Security.currentUser.displayName,
+ columnConfig: {
+ width: 150
+ }
+ }
+
+ }
+
+ }
+
+});
diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_Sectioning.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_Sectioning.js
new file mode 100644
index 000000000..983f0a496
--- /dev/null
+++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_Sectioning.js
@@ -0,0 +1,58 @@
+/**
+ * User: Kolli
+ * Date: 4/10/2020
+ * Time: 10:36 AM
+ */
+EHR.model.DataModelManager.registerMetadata('Sectioning', {
+ allQueries: {
+ },
+ byQuery: {
+ 'study.IPC_Sectioning': {
+
+ tissueType: {
+ columnConfig: {
+ width: 250
+ }
+ },
+
+ paraffinSectioning: {
+ header:"Paraffin Sectioning",
+ columnConfig: {
+ width: 200
+ }
+ },
+
+ sectionThickness: {
+ header:"Paraffin Section Thickness",
+ columnConfig: {
+ width: 200
+ }
+ },
+
+ frozenSectioning: {
+ header:"Frozen Section Thickness",
+ columnConfig: {
+ width: 200
+ }
+ },
+
+ specialIns: {
+ header:"Special Instructions",
+ hidden: false,
+ columnConfig: {
+ width: 250
+ }
+ },
+
+ performedBy: {
+ defaultValue: LABKEY.Security.currentUser.displayName,
+ columnConfig: {
+ width: 150
+ }
+ }
+
+ }
+
+ }
+
+});
diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_ServiceRequestDetails.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_ServiceRequestDetails.js
new file mode 100644
index 000000000..6e8c1b2fa
--- /dev/null
+++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_ServiceRequestDetails.js
@@ -0,0 +1,102 @@
+/**
+ * User: Kolli
+ * Date: 4/10/2020
+ * Time: 10:36 AM
+ */
+EHR.model.DataModelManager.registerMetadata('ServiceRequestDetails', {
+ allQueries: {
+ },
+ byQuery: {
+ 'study.IPC_ServiceRequestDetails': {
+
+ project: {
+ header:"Center Project",
+ columnConfig: {
+ width: 150
+ }
+ },
+
+ requestedBy: {
+ header:"Requested By",
+ columnConfig: {
+ width: 150
+ }
+ },
+
+ email: {
+ header:"Email",
+ columnConfig: {
+ width: 150
+ }
+ },
+
+ department: {
+ header:"Department",
+ columnConfig: {
+ width: 150
+ }
+ },
+
+ pathologist: {
+ xtype: 'combo',
+ header:'Pathologist',
+ hidden: false,
+ lookup: {schemaName: 'study', queryName: 'IPC_Pathologist', displayColumn:'name' },
+
+ editorConfig: {
+ listConfig: {
+ //innerTpl: '{[values.lastName + (values.firstName ? ", " + values.firstName : "")]}',
+ innerTpl: '{[(values.name)]}',
+ getInnerTpl: function(){
+ return this.innerTpl;
+ }
+ }
+ },
+ columnConfig: {
+ width: 200
+ }
+ },
+
+ investigator: {
+ xtype: 'combo',
+ header: 'Investigator',
+ hidden: false,
+ lookup: {schemaName: 'study', queryName: 'IPC_Investigators', displayColumn: 'name'},
+ editorConfig: {
+ listConfig: {
+ // innerTpl: '{[values.lastName + (values.firstName ? ", " + values.firstName : "")]}',
+ innerTpl: '{[(values.name)]}',
+ getInnerTpl: function(){
+ return this.innerTpl;
+ }
+ }
+ },
+ columnConfig: {
+ width: 200
+ }
+ },
+
+ sampleLocation: {
+ xtype: 'combo',
+ header: 'Sample DropOff/PickUp Location',
+ hidden: true,
+ lookup: {schemaName: 'study', queryName: 'IPC_Locations', displayColumn: 'room'},
+
+ editorConfig: {
+ listConfig: {
+ innerTpl: '{[(values.room)]}',
+ getInnerTpl: function(){
+ return this.innerTpl;
+ }
+ }
+ },
+ columnConfig: {
+ width: 200
+ }
+ }
+
+ }
+
+ }
+
+});
diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_SlidePrinting.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_SlidePrinting.js
new file mode 100644
index 000000000..fdac82072
--- /dev/null
+++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_SlidePrinting.js
@@ -0,0 +1,45 @@
+/**
+ * User: Kolli
+ * Date: 4/10/2020
+ * Time: 10:36 AM
+ */
+EHR.model.DataModelManager.registerMetadata('SlidePrinting', {
+ allQueries: {
+ },
+ byQuery: {
+ 'study.IPC_SlidePrinting': {
+
+ tissueType: {
+ columnConfig: {
+ width: 250
+ }
+ },
+
+ projectNotes: {
+ header:"Project Notes",
+ hidden: false,
+ columnConfig: {
+ width: 250
+ }
+ },
+
+ additionalText: {
+ header:"Additional text on slide",
+ hidden: false,
+ columnConfig: {
+ width: 250
+ }
+ },
+
+ performedBy: {
+ defaultValue: LABKEY.Security.currentUser.displayName,
+ columnConfig: {
+ width: 150
+ }
+ }
+
+ }
+
+ }
+
+});
diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_Staining.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_Staining.js
new file mode 100644
index 000000000..78c5f0d8b
--- /dev/null
+++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/IPC_Staining.js
@@ -0,0 +1,83 @@
+/**
+ * User: Kolli
+ * Date: 4/10/2020
+ * Time: 10:36 AM
+ */
+EHR.model.DataModelManager.registerMetadata('Staining', {
+ allQueries: {
+ },
+
+ byQuery: {
+ 'study.IPC_Staining': {
+
+ tissueType: {
+ columnConfig: {
+ width: 250
+ }
+ },
+
+ HAndE: {
+ header:"H&E",
+ columnConfig: {
+ width: 150
+ }
+ },
+
+ specialStain: {
+ header:"Special Stain",
+ columnConfig: {
+ width: 150
+ }
+ },
+
+ IHC: {
+ header:"IHC",
+ columnConfig: {
+ width: 150
+ }
+ },
+
+ IHCPrimaryAntibody: {
+ header:"IHC Primary Antibody",
+ hidden: false,
+ columnConfig: {
+ width: 200
+ }
+ },
+
+ irrelevantAntibody: {
+ header:"Irrelevant Antibody",
+ hidden: false,
+ columnConfig: {
+ width: 200
+ }
+ },
+
+ RNAScope: {
+ header:"RNA Scope",
+ hidden: false,
+ columnConfig: {
+ width: 150
+ }
+ },
+
+ other: {
+ header:"Other",
+ hidden: false,
+ columnConfig: {
+ width: 150
+ }
+ },
+
+ performedBy: {
+ defaultValue: LABKEY.Security.currentUser.displayName,
+ columnConfig: {
+ width: 150
+ }
+ }
+
+ }
+
+ }
+
+});
diff --git a/onprc_ehr/resources/web/onprc_ehr/window/IPC_CopyFromSectionWindow.js b/onprc_ehr/resources/web/onprc_ehr/window/IPC_CopyFromSectionWindow.js
new file mode 100644
index 000000000..889a8cbcb
--- /dev/null
+++ b/onprc_ehr/resources/web/onprc_ehr/window/IPC_CopyFromSectionWindow.js
@@ -0,0 +1,398 @@
+/*
+ * Copyright (c) 2013-2017 LabKey Corporation
+ *
+ * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
+ */
+/**
+ * @cfg targetGrid
+ * @cfg parentStore
+ * @cfg sourceLabel
+ * Created: Kollil, 5/19/2020
+ */
+Ext4.define('ONPRC_EHR.window.IPC_CopyFromSectionWindow', {
+ extend: 'Ext.window.Window',
+
+ initComponent: function(){
+ this.getParentRecords();
+
+ Ext4.applyIf(this, {
+ modal: true,
+ width: 1000,
+ closeAction: 'destroy',
+ title: 'Copy From ' + this.sourceLabel,
+ bodyStyle: 'padding: 5px;',
+ defaults: {
+ border: false
+ },
+ items: [{
+ html: 'This helper allows you to populate 1 row for each animal from the ' + this.sourceLabel + ' section. Choose which IDs to add from the list below.',
+ style: 'margin-bottom: 10px;'
+ },{
+ xtype: 'checkbox',
+ fieldLabel: 'Bulk Edit Values',
+ labelWidth: 150,
+ helpPopup: 'If checked, you will be prompted with a screen that lets you bulk edit the records that will be created. This is often very useful when adding many similar records.',
+ itemId: 'chooseValues',
+ style: 'margin-bottom: 10px;'
+ },{
+ itemId: 'animalIds',
+ items: this.getInitialItems()
+ }],
+ buttons: [{
+ text: 'Submit',
+ itemId: 'submitBtn',
+ scope: this,
+ handler: this.onSubmit
+ },{
+ text: 'Close',
+ handler: function(btn){
+ btn.up('window').close();
+ }
+ }]
+ });
+
+ this.callParent();
+
+ this.on('beforeshow', function(window){
+ if (!this.parentRecords.length){
+ Ext4.Msg.alert('No Records', 'There are no records to copy. Note: only records with an Id/Date can be copied.');
+ return false;
+ }
+ }, this);
+ },
+
+ getParentRecords: function(){
+ var records = [];
+ this.parentStore.each(function(r){
+ if (r.get('Id') && r.get('date')){
+ records.push(r);
+ }
+ }, this);
+
+ this.parentRecords = records;
+
+ return records;
+ },
+
+ getExistingIds: function(keyFields){
+ var map = {};
+ this.targetGrid.store.each(function(r){
+ var key = this.getKeyValue(r, keyFields);
+ if (r.get('Id'))
+ map[key] = true;
+ }, this);
+
+ return map;
+ },
+
+ getKeyValue: function(record, keyFields){
+ var key = [];
+ Ext4.Array.forEach(keyFields, function(kf){
+ if (record.get(kf))
+ key.push(record.get(kf));
+ }, this);
+
+ return key.join ('||');
+ },
+
+ getInitialItems: function(){
+ var items = [{
+ html: 'Animal'
+ },{
+ html: 'Date'
+ },{
+ html: 'Project'
+ }]
+
+ if (this.targetGrid.store.getFields().get('chargetype'))
+ {
+ items.push({
+ html: 'Charge Unit'
+ });
+ }
+
+ if (this.targetGrid.store.getFields().get('tissueType'))
+ {
+ items.push({
+ html: 'Tissue Type'
+ });
+ }
+
+ items = items.concat([{
+ html: 'Performed By'
+ },{
+ html: 'Skip?'
+ }]);
+
+ var keys = {}, key;
+ var keyFields = ['Id', 'date', 'tissueType'];
+// if (this.targetGrid.store.getFields().get('parentid')){
+// keyFields.push('parentid');
+// }
+// if (this.targetGrid.store.getFields().get('runid')){
+// keyFields.push('runid');
+// }
+
+ //console.log(keyFields);
+ var orderedKeys = [];
+ Ext4.Array.forEach(this.parentRecords, function(record){
+ key = this.getKeyValue(record, keyFields);
+ if (orderedKeys.indexOf(key) == -1){
+ orderedKeys.push(key);
+ }
+
+ keys[key] = keys[key] || {
+ Id: record.get('Id'),
+// parentid: keyFields.indexOf('parentid') > -1 ? record.get('parentid') : null,
+// runid: keyFields.indexOf('runid') > -1 ? record.get('runid') : null,
+ performedby: [],
+ projects: [],
+ chargeUnits: [],
+ tissueTypes: [],
+ dates: [],
+ total: 0
+ };
+
+ keys[key].total++;
+ if (record.get('performedby'))
+ keys[key].performedby.push(record.get('performedby'));
+ if (record.get('project'))
+ keys[key].projects.push(record.get('project'));
+ if (record.fields.get('chargetype') && record.get('chargetype'))
+ keys[key].chargeUnits.push(record.get('chargetype'));
+
+ if (record.fields.get('tissueType') && record.get('tissueType'))
+ keys[key].tissueTypes.push(record.get('tissueType'));
+
+ keys[key].dates.push(record.get('date'))
+ }, this);
+
+ var existingIds = this.getExistingIds(keyFields);
+ Ext4.Array.forEach(orderedKeys, function(key){
+ var o = keys[key];
+
+ items.push({
+ xtype: 'displayfield',
+ key: key,
+ value: o.Id,
+ fieldName: 'Id'
+ });
+
+ var dates = [];
+ var minDate;
+ Ext4.Array.forEach(o.dates, function(date){
+ if (!minDate || date < minDate)
+ minDate = date;
+
+ dates.push(date.format(LABKEY.extDefaultDateTimeFormat));
+ }, this);
+
+ o.performedby = Ext4.unique(o.performedby);
+ var performedby = o.performedby.length == 1 ? o.performedby[0] : null;
+
+ o.projects = Ext4.unique(o.projects);
+ var project = o.projects.length == 1 ? o.projects[0] : null;
+
+ o.chargeUnits = Ext4.unique(o.chargeUnits);
+ var chargeUnit = o.chargeUnits.length == 1 ? o.chargeUnits[0] : null;
+
+ o.tissueTypes = Ext4.unique(o.tissueTypes);
+ var tissueType = o.tissueTypes.length == 1 ? o.tissueTypes[0] : null;
+
+
+ items.push({
+ xtype: 'xdatetime',
+ width: 300,
+ format: LABKEY.extDefaultDateTimeFormat,
+ timeFormat: 'H:i',
+ fieldName: 'date',
+ key: key,
+ value: minDate
+ });
+
+ items.push({
+ xtype: 'ehr-projectfield',
+ matchFieldWidth: false,
+ showInactive: true,
+ fieldLabel: null,
+ width: 100,
+ fieldName: 'project',
+ key: key,
+ value: project
+ });
+
+ if (this.targetGrid.store.getFields().get('chargetype')){
+ var cfg = LABKEY.ext4.Util.getDefaultEditorConfig(this.targetGrid.store.getFields().get('chargetype'));
+
+ items.push(Ext4.apply(cfg, {
+ matchFieldWidth: false,
+ showInactive: true,
+ fieldLabel: null,
+ width: 160,
+ fieldName: 'chargetype',
+ key: key,
+ value: chargeUnit
+ }));
+ }
+
+ if (this.targetGrid.store.getFields().get('tissueType')){
+ var cfg = LABKEY.ext4.Util.getDefaultEditorConfig(this.targetGrid.store.getFields().get('tissueType'));
+
+ items.push(Ext4.apply(cfg, {
+ matchFieldWidth: false,
+ showInactive: true,
+ fieldLabel: null,
+ width: 160,
+ fieldName: 'tissueType',
+ key: key,
+ value: tissueType
+ }));
+ }
+
+ items.push({
+ xtype: 'textfield',
+ width: 200,
+ fieldName: 'performedby',
+ key: key,
+ value: performedby
+ });
+
+ items.push({
+ xtype: 'checkbox',
+ key: key,
+ fieldName: 'exclude',
+ checked: existingIds[key]
+ });
+ }, this);
+
+ return [{
+ itemId: 'theTable',
+ border: false,
+ layout: {
+ type: 'table',
+ //columns: this.targetGrid.store.getFields().get('chargetype') ? 6 : 5,
+ columns: this.targetGrid.store.getFields().get('tissueType') ? 6 : 5
+ },
+ defaults: {
+ border: false,
+ style: 'margin: 5px;'
+ },
+ items: items
+ }]
+ },
+
+ getRows: function(){
+ var table = this.down('#theTable');
+ var orderedKeys = [];
+ var rowMap = {};
+ table.items.each(function(item){
+ if (item.fieldName){
+ if (orderedKeys.indexOf(item.key) == -1)
+ orderedKeys.push(item.key);
+
+ rowMap[item.key] = rowMap[item.key] || {};
+ rowMap[item.key][item.fieldName] = item.getValue ? item.getValue() : item.value;
+ }
+ }, this);
+
+ var ret = [];
+ Ext4.Array.forEach(orderedKeys, function(key){
+ ret.push(rowMap[key]);
+ }, this);
+
+ return ret;
+ },
+
+ onSubmit: function(btn){
+ var toAdd = [];
+ Ext4.Array.forEach(this.getRows(), function(data){
+ if (!data.exclude){
+ toAdd.push(this.targetGrid.store.createModel(data));
+ }
+ }, this);
+
+ if (toAdd.length){
+ var choose = this.down('#chooseValues').getValue();
+ if (choose){
+ Ext4.create('EHR.window.BulkEditWindow', {
+ suppressConfirmMsg: true,
+ records: toAdd,
+ targetStore: this.targetGrid.store,
+ formConfig: this.targetGrid.formConfig
+ }).show();
+ this.close();
+ }
+ else {
+ this.targetGrid.store.add(toAdd);
+ }
+ }
+
+ this.close();
+ }
+});
+
+
+EHR.DataEntryUtils.registerGridButton('IPC_COPYFROMSECTION', function(config){
+ return Ext4.Object.merge({
+ text: 'IPC Copy From Section',
+ xtype: 'button',
+ tooltip: 'Click to copy records from one of the other sections',
+ listeners: {
+ beforerender: function(btn){
+ var grid = btn.up('gridpanel');
+ LDK.Assert.assertNotEmpty('Unable to find gridpanel in COPYFROMSECTION button', grid);
+
+ btn.grid = grid;
+
+ btn.appendButtons.call(btn);
+ }
+ },
+ menu: {
+ xtype: 'menu',
+ items: [{
+ text: 'Loading...'
+ }]
+ },
+ appendButtons: function(){
+ this.dataEntryPanel = this.grid.up('ehr-dataentrypanel');
+ LDK.Assert.assertNotEmpty('Unable to find dataEntryPanel in COPYFROMSECTION button', this.dataEntryPanel);
+
+ var toAdd = [];
+ Ext4.Array.forEach(this.dataEntryPanel.formConfig.sections, function(section){
+ if (section.name == this.grid.formConfig.name){
+ return;
+ }
+
+ var store = this.dataEntryPanel.storeCollection.getClientStoreByName(section.name);
+ if (store){
+ //only allow copying from sections with an ID field
+ if (!store.getFields().get('Id')){
+ return;
+ }
+
+ toAdd.push({
+ text: section.label,
+ scope: this,
+ handler: function(menu){
+ Ext4.create('ONPRC_EHR.window.IPC_CopyFromSectionWindow', {
+ targetGrid: this.grid,
+ sourceLabel: section.label,
+ parentStore: store
+ }).show();
+ }
+ });
+ }
+ }, this);
+
+ this.menu.removeAll();
+ if (toAdd.length){
+ this.menu.add(toAdd);
+ }
+ else {
+ this.menu.add({
+ text: 'There are no other sections'
+ })
+ }
+ }
+ });
+});
\ No newline at end of file
diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java b/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java
index edbb6bde0..0c12e543c 100644
--- a/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java
+++ b/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java
@@ -123,7 +123,7 @@ public String getName()
@Override
public @Nullable Double getSchemaVersion()
{
- return 23.007;
+ return 23.008;
}
@Override
@@ -550,13 +550,11 @@ public String toString()
//Added: 7/10/2019 by Kolli
EHRService.get().registerFormType(new DefaultDataEntryFormFactory(PMICDataEntryFormType.class, this));
- //Added: 1/13/2021 Kolli
-// EHRService.get().registerFormType(new DefaultDataEntryFormFactory(ARTCoreRequestFormType.class, this));
-
- //Added: 8/10/2019 Kolli
-// EHRService.get().registerFormType(new DefaultDataEntryFormFactory(IPCRequestFormType.class, this));
+ //Created: 8/10/2019 Kolli
+ //Modified: 10/20/2023 Kolli
+ EHRService.get().registerFormType(new DefaultDataEntryFormFactory(IPCRequestFormType.class, this));
-// Added: 11-21-2017 R.Blasa
+ //Added: 11-21-2017 R.Blasa
EHRService.get().registerFormType(new DefaultDataEntryFormFactory(ProcedureRequestBulkEditFormType.class, this));
EHRService.get().registerFormType(new DefaultDataEntryFormFactory(RecordAmendmentFormType.class, this));
@@ -576,8 +574,6 @@ public String toString()
//Added: 6-6-2022 R.Blasa
EHRService.get().registerFormType(new DefaultDataEntryFormFactory(NecropsyRequestForm.class, this));
-
-
//single section forms
EHRService.get().registerSingleFormOverride(new SingleQueryFormProvider(this, "study", "treatment_order", new MedicationsQueryFormSection("study", "Treatment Orders", "Medication/Treatment Orders")));
EHRService.get().registerSingleFormOverride(new SingleQueryFormProvider(this, "study", "drug", new MedicationsQueryFormSection("study", "Drug Administration", "Medication/Treatments Given")));
diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPCRequestFormType.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPCRequestFormType.java
new file mode 100644
index 000000000..2b3767048
--- /dev/null
+++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPCRequestFormType.java
@@ -0,0 +1,40 @@
+package org.labkey.onprc_ehr.dataentry;
+
+import org.labkey.api.ehr.dataentry.DataEntryFormContext;
+import org.labkey.api.ehr.dataentry.TaskForm;
+import org.labkey.api.ehr.dataentry.TaskFormSection;
+import org.labkey.api.module.Module;
+import org.labkey.api.view.template.ClientDependency;
+
+import java.util.Arrays;
+
+/**
+ * User: Kolli
+ * Date: 7/7/19
+ * Time: 10:36 AM
+ */
+public class IPCRequestFormType extends TaskForm
+{
+ public static final String NAME = "IPC SERVICE REQUEST";
+
+ public IPCRequestFormType(DataEntryFormContext ctx, Module owner)
+ {
+ super(ctx, owner, NAME, "Histology Service Request", "Imaging", Arrays.asList(
+ new TaskFormSection(),
+ new IPC_ServiceRequestDetailsFormSection("Service Request Details"),
+ new AnimalDetailssFormSection(),
+ new IPC_CassettePrintingFormSection(),
+ new IPC_ProcessingEmbeddingFormSection(),
+ new IPC_SectioningFormSection(),
+ new IPC_StainingFormSection(),
+ new IPC_SlidePrintingFormSection(),
+ new IPC_OtherFormSection()
+ ));
+
+ setStoreCollectionClass("EHR.data.IPCStoreCollection");
+ addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/data/IPCStoreCollection.js"));
+ }
+
+}
+
+
diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPC_CassettePrintingFormSection.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPC_CassettePrintingFormSection.java
new file mode 100644
index 000000000..fc08a4d65
--- /dev/null
+++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPC_CassettePrintingFormSection.java
@@ -0,0 +1,50 @@
+package org.labkey.onprc_ehr.dataentry;
+
+import org.labkey.api.ehr.EHRService;
+import org.labkey.api.ehr.dataentry.SimpleGridPanel;
+import org.labkey.api.view.template.ClientDependency;
+import java.util.List;
+
+
+/**
+ * User: Kollil
+ * Date: 4/01/2020
+ * Time: 10:36 AM
+ */
+public class IPC_CassettePrintingFormSection extends SimpleGridPanel
+{
+ public IPC_CassettePrintingFormSection()
+ {
+ this(EHRService.FORM_SECTION_LOCATION.Body);
+ }
+
+ public IPC_CassettePrintingFormSection(EHRService.FORM_SECTION_LOCATION location)
+ {
+ super("study", "IPC_CassettePrinting", "Cassette Printing", location);
+ addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/IPC_CassettePrinting.js"));
+
+ addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/IPC_Child.js"));
+ addConfigSource("IPC_Child");
+
+ addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/window/IPC_CopyFromSectionWindow.js"));
+
+ addConfigSource("CassettePrinting");
+ }
+
+ @Override
+ public List getTbarButtons()
+ {
+ List defaultButtons = super.getTbarButtons();
+
+ if (defaultButtons.contains("COPYFROMSECTION"))
+ {
+ int idx = defaultButtons.indexOf("COPYFROMSECTION");
+ defaultButtons.remove("COPYFROMSECTION");
+ defaultButtons.add(idx, "IPC_COPYFROMSECTION");
+ }
+
+ return defaultButtons;
+ }
+
+}
+
diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPC_OtherFormSection.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPC_OtherFormSection.java
new file mode 100644
index 000000000..597ddcebf
--- /dev/null
+++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPC_OtherFormSection.java
@@ -0,0 +1,44 @@
+package org.labkey.onprc_ehr.dataentry;
+
+import org.labkey.api.ehr.EHRService;
+import org.labkey.api.ehr.dataentry.SimpleGridPanel;
+import org.labkey.api.view.template.ClientDependency;
+import java.util.List;
+
+/**
+ * User: Kolli
+ * Date: 4/01/2020
+ * Time: 10:36 AM
+ */
+public class IPC_OtherFormSection extends SimpleGridPanel
+{
+ public IPC_OtherFormSection()
+ {
+ this(EHRService.FORM_SECTION_LOCATION.Body);
+ }
+
+ public IPC_OtherFormSection(EHRService.FORM_SECTION_LOCATION location)
+ {
+ super("study", "IPC_Other", "Other", location);
+ addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/IPC_Other.js"));
+ addConfigSource("IPC_Other");
+
+ addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/window/IPC_CopyFromSectionWindow.js"));
+ }
+
+ @Override
+ public List getTbarButtons()
+ {
+ List defaultButtons = super.getTbarButtons();
+
+ if (defaultButtons.contains("COPYFROMSECTION"))
+ {
+ int idx = defaultButtons.indexOf("COPYFROMSECTION");
+ defaultButtons.remove("COPYFROMSECTION");
+ defaultButtons.add(idx, "IPC_COPYFROMSECTION");
+ }
+
+ return defaultButtons;
+ }
+
+}
\ No newline at end of file
diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPC_ProcessingEmbeddingFormSection.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPC_ProcessingEmbeddingFormSection.java
new file mode 100644
index 000000000..dd147b6f6
--- /dev/null
+++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPC_ProcessingEmbeddingFormSection.java
@@ -0,0 +1,48 @@
+package org.labkey.onprc_ehr.dataentry;
+
+import org.labkey.api.ehr.EHRService;
+import org.labkey.api.ehr.dataentry.SimpleGridPanel;
+import org.labkey.api.view.template.ClientDependency;
+import java.util.List;
+
+/**
+ * User: Kolli
+ * Date: 4/01/2020
+ * Time: 10:36 AM
+ */
+public class IPC_ProcessingEmbeddingFormSection extends SimpleGridPanel
+{
+ public IPC_ProcessingEmbeddingFormSection()
+ {
+ this(EHRService.FORM_SECTION_LOCATION.Body);
+ }
+
+ public IPC_ProcessingEmbeddingFormSection(EHRService.FORM_SECTION_LOCATION location)
+ {
+ super("study", "IPC_ProcessingEmbedding", "Tissue Processing / Embedding", location);
+ addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/IPC_ProcessingEmbedding.js"));
+
+ addConfigSource("ProcessingEmbedding");
+
+ addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/IPC_Child.js"));
+ addConfigSource("IPC_Child");
+
+ addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/window/IPC_CopyFromSectionWindow.js"));
+ }
+
+ @Override
+ public List getTbarButtons()
+ {
+ List defaultButtons = super.getTbarButtons();
+
+ if (defaultButtons.contains("COPYFROMSECTION"))
+ {
+ int idx = defaultButtons.indexOf("COPYFROMSECTION");
+ defaultButtons.remove("COPYFROMSECTION");
+ defaultButtons.add(idx, "IPC_COPYFROMSECTION");
+ }
+
+ return defaultButtons;
+ }
+
+}
\ No newline at end of file
diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPC_SectioningFormSection.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPC_SectioningFormSection.java
new file mode 100644
index 000000000..9e1bd4cdd
--- /dev/null
+++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPC_SectioningFormSection.java
@@ -0,0 +1,47 @@
+package org.labkey.onprc_ehr.dataentry;
+
+import org.labkey.api.ehr.EHRService;
+import org.labkey.api.ehr.dataentry.SimpleGridPanel;
+import org.labkey.api.view.template.ClientDependency;
+import java.util.List;
+
+/**
+ * User: Kolli
+ * Date: 4/01/2020
+ * Time: 10:36 AM
+ */
+public class IPC_SectioningFormSection extends SimpleGridPanel
+{
+ public IPC_SectioningFormSection()
+ {
+ this(EHRService.FORM_SECTION_LOCATION.Body);
+ }
+
+ public IPC_SectioningFormSection(EHRService.FORM_SECTION_LOCATION location)
+ {
+ super("study", "IPC_Sectioning", "Sectioning", location);
+ addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/IPC_Sectioning.js"));
+ addConfigSource("Sectioning");
+
+ addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/IPC_Child.js"));
+ addConfigSource("IPC_Child");
+
+ addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/window/IPC_CopyFromSectionWindow.js"));
+ }
+
+ @Override
+ public List getTbarButtons()
+ {
+ List defaultButtons = super.getTbarButtons();
+
+ if (defaultButtons.contains("COPYFROMSECTION"))
+ {
+ int idx = defaultButtons.indexOf("COPYFROMSECTION");
+ defaultButtons.remove("COPYFROMSECTION");
+ defaultButtons.add(idx, "IPC_COPYFROMSECTION");
+ }
+
+ return defaultButtons;
+ }
+
+}
\ No newline at end of file
diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPC_ServiceRequestDetailsFormSection.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPC_ServiceRequestDetailsFormSection.java
new file mode 100644
index 000000000..c623a20bf
--- /dev/null
+++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPC_ServiceRequestDetailsFormSection.java
@@ -0,0 +1,22 @@
+/*
+// * User: Kolli
+// * Date: 4/01/2020
+// * Time: 10:36 AM
+ */
+
+package org.labkey.onprc_ehr.dataentry;
+
+import org.labkey.api.ehr.dataentry.SimpleFormPanelSection;
+import org.labkey.api.view.template.ClientDependency;
+
+public class IPC_ServiceRequestDetailsFormSection extends SimpleFormPanelSection
+{
+ public IPC_ServiceRequestDetailsFormSection(String label)
+ {
+ super("study", "IPC_ServiceRequestDetails", label);
+ setTemplateMode(TEMPLATE_MODE.NONE);
+ addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/IPC_ServiceRequestDetails.js"));
+ addConfigSource("ServiceRequestDetails");
+ }
+}
+
diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPC_SlidePrintingFormSection.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPC_SlidePrintingFormSection.java
new file mode 100644
index 000000000..e07b9d149
--- /dev/null
+++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPC_SlidePrintingFormSection.java
@@ -0,0 +1,46 @@
+package org.labkey.onprc_ehr.dataentry;
+
+import org.labkey.api.ehr.EHRService;
+import org.labkey.api.ehr.dataentry.SimpleGridPanel;
+import org.labkey.api.view.template.ClientDependency;
+import java.util.List;
+
+/**
+ * User: Kolli
+ * Date: 4/01/2020
+ * Time: 10:36 AM
+ */
+public class IPC_SlidePrintingFormSection extends SimpleGridPanel
+{
+ public IPC_SlidePrintingFormSection()
+ {
+ this(EHRService.FORM_SECTION_LOCATION.Body);
+ }
+
+ public IPC_SlidePrintingFormSection(EHRService.FORM_SECTION_LOCATION location)
+ {
+ super("study", "IPC_SlidePrinting", "Slide Printing (No Sectioning)", location);
+ addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/IPC_SlidePrinting.js"));
+ addConfigSource("SlidePrinting");
+ addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/IPC_Child.js"));
+ addConfigSource("IPC_Child");
+
+ addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/window/IPC_CopyFromSectionWindow.js"));
+ }
+
+ @Override
+ public List getTbarButtons()
+ {
+ List defaultButtons = super.getTbarButtons();
+
+ if (defaultButtons.contains("COPYFROMSECTION"))
+ {
+ int idx = defaultButtons.indexOf("COPYFROMSECTION");
+ defaultButtons.remove("COPYFROMSECTION");
+ defaultButtons.add(idx, "IPC_COPYFROMSECTION");
+ }
+
+ return defaultButtons;
+ }
+
+}
\ No newline at end of file
diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPC_StainingFormSection.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPC_StainingFormSection.java
new file mode 100644
index 000000000..28120b2ea
--- /dev/null
+++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/IPC_StainingFormSection.java
@@ -0,0 +1,45 @@
+package org.labkey.onprc_ehr.dataentry;
+import org.labkey.api.ehr.EHRService;
+import org.labkey.api.ehr.dataentry.SimpleGridPanel;
+import org.labkey.api.view.template.ClientDependency;
+import java.util.List;
+
+/**
+ * User: Kolli
+ * Date: 4/01/2020
+ * Time: 10:36 AM
+ */
+public class IPC_StainingFormSection extends SimpleGridPanel
+{
+ public IPC_StainingFormSection()
+ {
+ this(EHRService.FORM_SECTION_LOCATION.Body);
+ }
+
+ public IPC_StainingFormSection(EHRService.FORM_SECTION_LOCATION location)
+ {
+ super("study", "IPC_Staining", "Staining", location);
+ addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/IPC_Staining.js"));
+ addConfigSource("Staining");
+ addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/IPC_Child.js"));
+ addConfigSource("IPC_Child");
+
+ addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/window/IPC_CopyFromSectionWindow.js"));
+ }
+
+ @Override
+ public List getTbarButtons()
+ {
+ List defaultButtons = super.getTbarButtons();
+
+ if (defaultButtons.contains("COPYFROMSECTION"))
+ {
+ int idx = defaultButtons.indexOf("COPYFROMSECTION");
+ defaultButtons.remove("COPYFROMSECTION");
+ defaultButtons.add(idx, "IPC_COPYFROMSECTION");
+ }
+
+ return defaultButtons;
+ }
+
+}
\ No newline at end of file
diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/MedSignoffFormType.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/MedSignoffFormType.java
deleted file mode 100644
index a9c8fbfef..000000000
--- a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/MedSignoffFormType.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2013-2018 LabKey Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.labkey.onprc_ehr.dataentry;
-
-import org.labkey.api.ehr.EHRService;
-import org.labkey.api.ehr.dataentry.AnimalDetailsFormSection;
-import org.labkey.api.ehr.dataentry.DataEntryFormContext;
-import org.labkey.api.ehr.dataentry.NonStoreFormSection;
-import org.labkey.api.ehr.dataentry.TaskForm;
-import org.labkey.api.ehr.dataentry.TaskFormSection;
-import org.labkey.api.ehr.dataentry.DrugAdministrationFormSection;
-import org.labkey.api.ehr.security.EHRClinicalEntryPermission;
-import org.labkey.api.module.Module;
-import org.labkey.api.module.ModuleLoader;
-import org.labkey.api.security.Group;
-import org.labkey.api.security.GroupManager;
-import org.labkey.api.security.permissions.AdminPermission;
-import org.labkey.api.view.template.ClientDependency;
-import org.labkey.security.xml.GroupEnumType;
-
-import java.util.Arrays;
-
-/**
- * User: bimber
- * Date: 7/29/13
- * Time: 5:03 PM
- */
-public class MedSignoffFormType extends TaskForm
-{
- public static final String NAME = "medsignoff";
- public static final String LABEL = "Post-administration Med Verification"; //Changed by Kollil on 10/11/23, Refer to tkt #9939
-
- public MedSignoffFormType(DataEntryFormContext ctx, Module owner)
- {
- super(ctx, owner, NAME, LABEL, "Clinical", Arrays.asList(
- new TaskFormSection(),
- //Added 2-19-2016 Blasa
- new NonStoreFormSection("Treatment Template Helper", "Treatment Template Helper", "onprc_AddScheduledTreatmentPanel", Arrays.asList(ClientDependency.supplierFromPath("/onprc_ehr/panel/AddScheduledTreatmentPanel.js"))),
-
- new AnimalDetailsFormSection(),
- new DrugAdministrationFormSection(ClientDependency.supplierFromPath("onprc_ehr/window/ONPRC_AddScheduledTreatmentWindow.js"))
- /* new TreatmentOrdersFormSection()*/
- ));
-
- if (ctx.getContainer().getActiveModules().contains(ModuleLoader.getInstance().getModule("onprc_billing")))
- {
- addSection(new MiscChargesFormSection(EHRService.FORM_SECTION_LOCATION.Body));
- }
-
- }
-
- @Override
- protected boolean canInsert()
- {
- if (!getCtx().getContainer().hasPermission(getCtx().getUser(), EHRClinicalEntryPermission.class))
- return false;
-
- return super.canInsert();
- }
-
- //Modified: 12-5-2019 R.Blasa
- @Override
- public boolean isVisible()
- {
- Group g = GroupManager.getGroup(getCtx().getContainer(), "ASB Support", GroupEnumType.SITE);
- if (g != null && getCtx().getUser().isInGroup(g.getUserId()) && !getCtx().getContainer().hasPermission(getCtx().getUser(), AdminPermission.class))
- {
- return false;
- }
-
- return super.isVisible();
- }
-}
diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/BehaviorNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/BehaviorNotification.java
deleted file mode 100644
index fe06dda55..000000000
--- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/BehaviorNotification.java
+++ /dev/null
@@ -1,385 +0,0 @@
-/*
- * Copyright (c) 2013-2016 LabKey Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.labkey.onprc_ehr.notification;
-
-import org.apache.commons.lang3.time.DateUtils;
-import org.json.JSONObject;
-import org.labkey.api.data.CompareType;
-import org.labkey.api.data.Container;
-import org.labkey.api.data.ContainerFilter;
-import org.labkey.api.data.SQLFragment;
-import org.labkey.api.data.SimpleFilter;
-import org.labkey.api.data.Sort;
-import org.labkey.api.data.SqlSelector;
-import org.labkey.api.data.TableInfo;
-import org.labkey.api.data.TableSelector;
-import org.labkey.api.module.Module;
-import org.labkey.api.query.FieldKey;
-import org.labkey.api.query.QueryDefinition;
-import org.labkey.api.query.QueryException;
-import org.labkey.api.query.QueryService;
-import org.labkey.api.query.UserSchema;
-import org.labkey.api.security.User;
-import org.labkey.api.util.PageFlowUtil;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * User: bimber
- * Date: 4/5/13
- * Time: 2:25 PM
- */
-public class BehaviorNotification extends ColonyAlertsNotification
-{
- public BehaviorNotification(Module owner)
- {
- super(owner);
- }
-
- @Override
- public String getName()
- {
- return "Behavior Notification";
- }
-
- @Override
- public String getEmailSubject(Container c)
- {
- return "Behavior Alerts: " + getDateTimeFormat(c).format(new Date());
- }
-
- @Override
- public String getCronString()
- {
- return "0 0 5 * * ?";
- }
-
- @Override
- public String getScheduleDescription()
- {
- return "every day at 5:00AM";
- }
-
- @Override
- public String getDescription()
- {
- return "The report is designed to provide a daily summary of issues related to behavior management, such as housing, pairing, and behavior cases";
- }
-
- @Override
- public String getMessageBodyHTML(Container c, User u)
- {
- Map saved = getSavedValues(c);
- Map toSave = new HashMap();
-
- StringBuilder msg = new StringBuilder();
-
- msg.append(getDescription()).append("
");
-
- colonyHousingSummary(c, u, msg, saved, toSave);
- behaviorCaseSummary(c, u, msg);
- getFlaggedPairs(c, u, msg);
- changedPairs(c, u, msg);
- singleHousedAnimals(c, u, msg);
- transfersYesterday(c, u, msg);
- surgeryCasesRecentlyClosed(c, u, msg);
- pairIdConflicts(c, u , msg);
- NHPTraining_BehaviorAlert(c, u , msg);
- dcmNotesAlert(c, u , msg);
-
- notesEndingToday(c, u, msg, Arrays.asList("BSU Notes"), null);
- saveValues(c, toSave);
-
- return msg.toString();
- }
-
- // Added by Kollil 11/04/2020
- private void NHPTraining_BehaviorAlert(final Container c, User u, final StringBuilder msg)
- {
- if (QueryService.get().getUserSchema(u, c, "onprc_ehr") == null) {
- msg.append("Warning: The onprc_ehr schema has not been enabled in this folder, so the alert cannot run!
");
- return;
- }
- TableInfo ti = QueryService.get().getUserSchema(u, c, "onprc_ehr").getTable("NHP_Training_BehaviorAlert",ContainerFilter.Type.AllFolders.create(c, u));
-// ((ContainerFilterable) ti).setContainerFilter(ContainerFilter.Type.AllFolders.create(u);
- TableSelector ts = new TableSelector(ti, null, null);
-
- long total = ts.getRowCount();
- msg.append("NHP_Training entries where \"Training Result = In-Progress\" for over 60 days:");
- if (total > 0)
- {
- msg.append("There are " + total + " entries found. ");
- msg.append("
Click here to view them
\n");
- msg.append("
\n\n");
- }
- else
- {
- msg.append("WARNING: There are no NHP_Training entries where \"Training Result = In Progress\" for over 60 days!
\n");
- }
-
- }
-
- /*
- Kollil, Created: 11/18/20, Modified: 04/07/2021
- 1. New alert for DCM notes (category = notes pertaining to DAR) added the previous day.
- 2. New alert for DCM notes (category = notes pertaining to DAR) removed the previous day.
- 3. New alert for Flags added the previous day.
- 4. New alert for Flags removed the previous day.
- */
- /**
- * Modified: 12-9-2021 R.Blasa using Lakshmi's original code
- */
- protected void dcmNotesAlert(final Container c, User u, final StringBuilder msg)
- {
- SimpleFilter filter = new SimpleFilter(FieldKey.fromString("actiondate"), new Date(), CompareType.DATE_EQUAL);
- filter.addCondition(FieldKey.fromString("category"), "Notes Pertaining to DAR", CompareType.EQUAL);
- TableSelector ts = new TableSelector(getStudySchema(c, u).getTable("Notes_WithLocation"), filter, null);
- long count = ts.getRowCount();
- if (count > 0)
- {
- msg.append("WARNING: There are " + count + " DCM action items.
\n");
- msg.append("Click here to view them
\n\n");
- msg.append("
");
- }
- else
- {
- msg.append("WARNING: There are no DCM action items!
");
- }
-
- //Added by Kollil on 11/04/2020
- //New alert for DCM notes (category = notes pertaining to DAR) added the previous day.
-
- //Get yesterday date
- Calendar cal = Calendar.getInstance();
- cal.setTime(new Date());
- cal.add(Calendar.DATE, -1);
- String formatted = getDateFormat(c).format(cal.getTime());
-
- SimpleFilter filter1 = new SimpleFilter(FieldKey.fromString("date"), cal.getTime(), CompareType.DATE_EQUAL);
- filter1.addCondition(FieldKey.fromString("category"), "Notes Pertaining to DAR", CompareType.EQUAL);
- TableSelector ts1 = new TableSelector(getStudySchema(c, u).getTable("Notes_WithLocation"), filter1, null);
- long count1 = ts1.getRowCount();
- msg.append("DCM Alerts:
");
- if (count1 > 0) {
- msg.append("" + count1 + " DCM notes entries added yesterday where \"Category = Notes pertaining to DAR\".
\n");
- msg.append("Click here to view them
\n\n");
- msg.append("
\n\n");
- }
- else
- {
- msg.append("WARNING: No DCM notes added yesterday where \"Category = Notes pertaining to DAR\"!
");
- }
-
- /* Added by Kollil on 10/12/2023
- New alert for DCM notes (category = notes pertaining to DAR) removed the previous day.
- Refer to tkt #9977
- */
- SimpleFilter filter4 = new SimpleFilter(FieldKey.fromString("enddate"), cal.getTime(), CompareType.DATE_EQUAL);
- TableSelector ts4 = new TableSelector(getStudySchema(c, u).getTable("Notes_WithLocation"), filter4, null);
- long count4 = ts4.getRowCount();
-
- if (count4 > 0) {
- msg.append("" + count4 + " DCM notes entries removed yesterday where \"Category = Notes pertaining to DAR\".
\n");
- msg.append("Click here to view them
\n\n");
- msg.append("
\n\n");
- }
- else {
- msg.append("WARNING: No DCM notes ended yesterday where \"Category = Notes pertaining to DAR\"!
");
- }
-
- //Added by Kollil on 11/04/2020
- //New alert for Flags added the previous day.
- SimpleFilter filter2 = new SimpleFilter(FieldKey.fromString("date"), cal.getTime(), CompareType.DATE_EQUAL);
- TableSelector ts2 = new TableSelector(getStudySchema(c, u).getTable("Flags_WithLocation"), filter2, null);
- long count2 = ts2.getRowCount();
- if (count2 > 0)
- {
- msg.append("There are " + count2 + " flag(s) added yesterday.
\n");
- msg.append("Click here to view them
\n\n");
- msg.append("
");
- }
- else
- {
- msg.append("WARNING: There are no flags added yesterday!
");
- }
-
- //Added by Kollil on 1/04/2021
- //New alert for Flags removed the previous day.
- SimpleFilter filter3 = new SimpleFilter(FieldKey.fromString("enddate"), cal.getTime(), CompareType.DATE_EQUAL);
- TableSelector ts3 = new TableSelector(getStudySchema(c, u).getTable("Flags_WithLocation"), filter3, null);
- long count3 = ts3.getRowCount();
- if (count3 > 0) {
- msg.append("" + count3 + " flag(s) removed yesterday.
\n");
- msg.append("Click here to view them
\n\n");
- msg.append("
");
- }
- else {
- msg.append("WARNING: There are no flags removed yesterday!
");
- }
-
- }
-
- // Modified: 9-7-2018 R.Blasa
- private void behaviorCaseSummary(Container c, User u, final StringBuilder msg)
- {
- TableInfo ti = getStudySchema(c, u).getTable("mostRecentObservationsBehavior");
- SimpleFilter filter = new SimpleFilter(FieldKey.fromString("isActive"), true);
-
- TableSelector ts = new TableSelector(ti, PageFlowUtil.set("Id"), filter, null);
- long total = ts.getRowCount();
- msg.append("Behavior Cases:");
- msg.append("There are " + total + " active behavior cases (this does not include cases closed for review). ");
- String url = getExecuteQueryUrl(c, "study", "mostRecentObservationsBehavior", "Open Behavior Case") + "&query.isActive~eq=true";
- msg.append("Click here to view them");
- msg.append("
");
- }
-
- private void pairIdConflicts(Container c, User u, final StringBuilder msg)
- {
- TableInfo ti = getStudySchema(c, u).getTable("pairingIdConflicts");
- TableSelector ts = new TableSelector(ti);
- long total = ts.getRowCount();
- if (total > 0)
- {
- msg.append("Conflicting Pair IDs:");
- msg.append("There are " + total + " pairing records with conflicting pairIds. If this occurs, there is a bug in data entry which could cause unusual results when viewing the data. If you see this, please contact the site administrator. ");
- String url = getExecuteQueryUrl(c, "study", "pairingIdConflicts", null);
- msg.append("Click here to view them");
- msg.append("
");
- }
- }
-
- private void singleHousedAnimals(Container c, User u, final StringBuilder msg)
- {
- TableInfo ti = getStudySchema(c, u).getTable("demographicsDaysAlone");
- SimpleFilter filter = new SimpleFilter(FieldKey.fromString("cagemates"), 0, CompareType.EQUAL);
- filter.addCondition(FieldKey.fromString("daysAlone"), 30, CompareType.GT);
-
- TableSelector ts = new TableSelector(ti, PageFlowUtil.set("Id"), filter, null);
- long total = ts.getRowCount();
- msg.append("Single Housed Animals:");
- msg.append("There are " + total + " animals that have been single housed for at least 30 days. ");
- String url = getExecuteQueryUrl(c, "study", "demographicsDaysAlone", null, filter) + "&query.sort=-DaysAlone";
- msg.append("Click here to view them");
- msg.append("
");
- }
-
- private void getFlaggedPairs(Container c, User u, final StringBuilder msg)
- {
- TableInfo ti = getStudySchema(c, u).getTable("pairingSeparations");
- TableSelector ts = new TableSelector(ti, PageFlowUtil.set("Id"));
- long total = ts.getRowCount();
- if (total > 0)
- {
- msg.append("There are " + total + " animals with temporary separations, but there is no subsequent pairing observation to indicate a reunite, permanent separation, new pair formation, etc. These may need attention.");
- String url = getExecuteQueryUrl(c, "study", "pairingSeparations", null);
- msg.append("Click here to view them");
- msg.append("
");
- }
- }
-
- private void changedPairs(Container c, User u, final StringBuilder msg)
- {
- Calendar date1 = Calendar.getInstance();
- date1.setTime(new Date());
- date1 = DateUtils.truncate(date1, Calendar.DATE);
-
- Calendar date2 = Calendar.getInstance();
- date2.setTime(new Date());
- date2 = DateUtils.truncate(date2, Calendar.DATE);
- date2.add(Calendar.DATE, -1);
-
- UserSchema us = getStudySchema(c, u);
- QueryDefinition qd = us.getQueryDefForTable("pairDifferences");
- List errors = new ArrayList<>();
- TableInfo ti = qd.getTable(us, errors, true);
- Map params = new HashMap<>();
- params.put("Date1", date1.getTime());
- params.put("Date2", date2.getTime());
-
- SQLFragment sql = ti.getFromSQL("t");
- QueryService.get().bindNamedParameters(sql, params);
-
- sql = new SQLFragment("SELECT * FROM " + sql.getSQL() + " WHERE (t.changeType IS NOT NULL AND t.changeType != 'Group Members Changed') ORDER BY ldk.naturalize(t.room1), ldk.naturalize(t.cage1)", sql.getParams());
- QueryService.get().bindNamedParameters(sql, params);
- SqlSelector ss = new SqlSelector(ti.getSchema(), sql);
- Collection