diff --git a/nirc_ehr/resources/data/editable_lookups.tsv b/nirc_ehr/resources/data/editable_lookups.tsv
index 23c7d2ac..7f3ba907 100644
--- a/nirc_ehr/resources/data/editable_lookups.tsv
+++ b/nirc_ehr/resources/data/editable_lookups.tsv
@@ -73,8 +73,7 @@ ehr_lookups mens_score Clinical Menses Types Clinical observation fixed values.
ehr_lookups mucous_membranes Clinical Mucous Membranes Used in clinical observations.
ehr_lookups musculoskeletal_observations Clinical Musculoskeletal Observations Used in clinical observations.
ehr_lookups necropsy_disposition_codes Colony Management Necropsy Disposition Codes
-ehr_lookups necropsy_exam_reason Colony Management Necropsy Exam Reason
-ehr_lookups necropsy_organ_appearance Colony Management Necropsy Organ Appearance
+ehr_lookups necropsy_organ_appearance Colony Management Necropsy Organ Appearance
ehr_lookups necropsy_organ_systems Colony Management Necropsy Organ Systems
ehr_lookups necropsy_physical_condition Colony Management Necropsy Physical Condition
ehr_lookups necropsy_specimen_condition Colony Management Necropsy Specimen Condition
diff --git a/nirc_ehr/resources/data/lookup_sets.tsv b/nirc_ehr/resources/data/lookup_sets.tsv
index 749d16c0..cea86af6 100644
--- a/nirc_ehr/resources/data/lookup_sets.tsv
+++ b/nirc_ehr/resources/data/lookup_sets.tsv
@@ -61,7 +61,6 @@ mens_score Menses value
mucous_membranes Mucous Membranes value
musculoskeletal_observations Musculoskeletal Observations value
necropsy_disposition_codes Tissue Disposition Codes value title
-necropsy_exam_reason Necropsy Reason value title
necropsy_organ_appearance Appearance value title
necropsy_organ_systems Organ Systems value title
necropsy_physical_condition Physical Condition value title
diff --git a/nirc_ehr/resources/data/lookupsManifest.tsv b/nirc_ehr/resources/data/lookupsManifest.tsv
index ebf0d0c3..936ec52a 100644
--- a/nirc_ehr/resources/data/lookupsManifest.tsv
+++ b/nirc_ehr/resources/data/lookupsManifest.tsv
@@ -68,7 +68,6 @@ mens_score
mucous_membranes
musculoskeletal_observations
necropsy_disposition_codes
-necropsy_exam_reason
necropsy_organ_appearance
necropsy_organ_systems
necropsy_physical_condition
diff --git a/nirc_ehr/resources/data/lookupsManifestTest.tsv b/nirc_ehr/resources/data/lookupsManifestTest.tsv
index 8784b08b..fde39961 100644
--- a/nirc_ehr/resources/data/lookupsManifestTest.tsv
+++ b/nirc_ehr/resources/data/lookupsManifestTest.tsv
@@ -67,7 +67,6 @@ mens_score
mucous_membranes
musculoskeletal_observations
necropsy_disposition_codes
-necropsy_exam_reason
necropsy_organ_appearance
necropsy_organ_systems
necropsy_physical_condition
diff --git a/nirc_ehr/resources/queries/study/cases.js b/nirc_ehr/resources/queries/study/cases.js
index 02dc3b8b..a8e3b6c3 100644
--- a/nirc_ehr/resources/queries/study/cases.js
+++ b/nirc_ehr/resources/queries/study/cases.js
@@ -33,7 +33,7 @@ EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Even
error = true;
}
- if (!helper.isValidateOnly() && row.caseid && row.enddate && (row.enddate != oldRow.enddate)) {
+ if (!helper.isValidateOnly() && row.caseid && row.enddate && oldRow && (row.enddate != oldRow.enddate)) {
triggerHelper.closeDailyClinicalObs(row.caseid, row.enddate);
}
@@ -57,7 +57,7 @@ EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Even
if (oldQc.Label != 'In Progress') {
EHR.Server.Utils.addError(errors, null, 'Cannot save a draft copy of a case already opened or in review.', 'ERROR');
}
- } else if (row.category == 'Clinical' && (qc.Label == 'Completed' || qc.Label == 'Review Required') && row.caseid && row.Id && row.performedby && row.taskid) {
+ } else if (row.category == 'Clinical' && (qc.Label == 'Completed' || qc.Label == 'Review Required') && row.caseid && row.Id && row.performedby && row.taskid && !row.enddate) {
var ordersInTransaction = helper.getProperty('ordersInTransaction');
var oit = [];
if (ordersInTransaction && ordersInTransaction.length) {
diff --git a/nirc_ehr/resources/queries/study/deaths.js b/nirc_ehr/resources/queries/study/deaths.js
index c6a89eea..03b9d2df 100644
--- a/nirc_ehr/resources/queries/study/deaths.js
+++ b/nirc_ehr/resources/queries/study/deaths.js
@@ -122,6 +122,21 @@ function onUpsert(helper, scriptErrors, row, oldRow) {
console.log(row.id + " is not a valid animal id");
}
}
+
+ if(row.QCStateLabel && EHR.Server.Security.getQCStateByLabel(row.QCStateLabel).PublicData) {
+ var qcstate = helper.getJavaHelper().getQCStateForLabel(row.QCStateLabel).getRowId();
+
+ //add/update weight record
+ var weightRecord = {
+ Id: row.Id,
+ date: row.date,
+ weight: row.deathWeight,
+ taskid: row.taskid,
+ qcstate: qcstate,
+ performedby: row.performedby
+ };
+ triggerHelper.upsertWeightRecord(weightRecord);
+ }
}
}
}
diff --git a/nirc_ehr/resources/queries/study/deaths.query.xml b/nirc_ehr/resources/queries/study/deaths.query.xml
index f16eebcd..35c2e6ae 100644
--- a/nirc_ehr/resources/queries/study/deaths.query.xml
+++ b/nirc_ehr/resources/queries/study/deaths.query.xml
@@ -7,7 +7,6 @@
Death Date
-
Disposition
@@ -17,6 +16,9 @@
title
+
+ Death Weight (kg)
+
diff --git a/nirc_ehr/resources/queries/study/deaths/.qview.xml b/nirc_ehr/resources/queries/study/deaths/.qview.xml
index d04d768b..fdc063c2 100644
--- a/nirc_ehr/resources/queries/study/deaths/.qview.xml
+++ b/nirc_ehr/resources/queries/study/deaths/.qview.xml
@@ -7,6 +7,7 @@
+
diff --git a/nirc_ehr/resources/queries/study/necropsy.js b/nirc_ehr/resources/queries/study/necropsy.js
index 05522f36..bbfa3878 100644
--- a/nirc_ehr/resources/queries/study/necropsy.js
+++ b/nirc_ehr/resources/queries/study/necropsy.js
@@ -35,29 +35,16 @@ function onUpsert(helper, scriptErrors, row, oldRow) {
(deathIdMap[row.Id].QCStateLabel.toUpperCase() === 'REQUEST: PENDING' ||
deathIdMap[row.Id].QCStateLabel.toUpperCase() === 'REVIEW REQUIRED')) {
- if (!row.examReason)
- EHR.Server.Utils.addError(scriptErrors, 'examReason', "'Reason for Examination' is required", 'ERROR');
if (!row.specimenCondition)
EHR.Server.Utils.addError(scriptErrors, 'specimenCondition', "'Condition of Specimen' is required", 'ERROR');
if (!row.physicalCondition)
EHR.Server.Utils.addError(scriptErrors, 'physicalCondition', "'Physical Condition' is required", 'ERROR');
if (!row.diagnosis)
EHR.Server.Utils.addError(scriptErrors, 'diagnosis', "'Diagnosis' is required", 'ERROR');
- }
-
- if(row.QCStateLabel && EHR.Server.Security.getQCStateByLabel(row.QCStateLabel).PublicData) {
- var qcstate = helper.getJavaHelper().getQCStateForLabel(row.QCStateLabel).getRowId();
-
- //add/update weight record
- var weightRecord = {
- Id: row.Id,
- date: row.date,
- weight: row.necropsyWeight,
- taskid: row.taskid,
- qcstate: qcstate,
- performedby: row.performedby
- };
- triggerHelper.upsertWeightRecord(weightRecord);
+ if (!row.grossAbnormalities)
+ EHR.Server.Utils.addError(scriptErrors, 'grossAbnormalities', "'Gross Abnormalities' is required", 'ERROR');
+ if (!row.accessionNumber)
+ EHR.Server.Utils.addError(scriptErrors, 'accessionNumber', "'Accession Number' is required", 'ERROR');
}
}
}
diff --git a/nirc_ehr/resources/queries/study/necropsy.query.xml b/nirc_ehr/resources/queries/study/necropsy.query.xml
index 73cd38fd..35290a87 100644
--- a/nirc_ehr/resources/queries/study/necropsy.query.xml
+++ b/nirc_ehr/resources/queries/study/necropsy.query.xml
@@ -6,20 +6,12 @@
Exam Date
-
Category
Diagnosis
-
-
- ehr_lookups
- necropsy_exam_reason
- value
-
-
ehr_lookups
@@ -34,9 +26,6 @@
value
-
- Weight
-
true
diff --git a/nirc_ehr/resources/queries/study/necropsy/.qview.xml b/nirc_ehr/resources/queries/study/necropsy/.qview.xml
index b1af3175..2a4be61a 100644
--- a/nirc_ehr/resources/queries/study/necropsy/.qview.xml
+++ b/nirc_ehr/resources/queries/study/necropsy/.qview.xml
@@ -7,10 +7,8 @@
-
-
diff --git a/nirc_ehr/resources/referenceStudy/study/datasets/datasets_metadata.xml b/nirc_ehr/resources/referenceStudy/study/datasets/datasets_metadata.xml
index 91ac8907..bc4e8f73 100644
--- a/nirc_ehr/resources/referenceStudy/study/datasets/datasets_metadata.xml
+++ b/nirc_ehr/resources/referenceStudy/study/datasets/datasets_metadata.xml
@@ -33,6 +33,7 @@
Alias
+ Records alternative identifiers and aliases assigned to individual primates within the facility.
varchar
@@ -59,6 +60,7 @@
Arrival
+ Tracks the arrival of primates into the research facility, including source, acquisition type, and associated documentation.
entityid
@@ -110,6 +112,7 @@
Project Assignments
+ Records project assignments for individual primates, linking animals to specific research projects with start and end dates.
varchar
@@ -134,6 +137,7 @@
Biopsy
+ Documents biopsy procedures performed on primates, including tissue type and associated pathology reports.
varchar
@@ -160,6 +164,7 @@
Protocol Assignments
+ Tracks the assignment of primates to IACUC-approved research protocols with effective date ranges.
varchar
@@ -183,6 +188,7 @@
Birth
+ Records birth events for primates born within the facility, including location and associated protocols.
entityid
@@ -216,6 +222,7 @@
Blood Draws
+ Tracks blood draw procedures performed on primates, including volume, sample type, tube type, and purpose.
varchar
@@ -262,6 +269,7 @@
Breeder
+ Records breeding evaluations and reproductive assessments for primates in the colony breeding program.
varchar
@@ -292,6 +300,7 @@
Clinical/Behavior Observations
+ Documents clinical and behavioral observations recorded during routine monitoring and veterinary assessments of primates.
varchar
@@ -332,6 +341,7 @@
Clinical Remarks
+ Stores veterinary clinical remarks and SOAP notes associated with primate health assessments and case management.
varchar
@@ -388,6 +398,7 @@
Demographics
+ Contains core demographic information for each primate, including species, sex, parentage, birth and death dates, and colony status.
entityid
@@ -462,6 +473,7 @@
Departure
+ Records the departure of primates from the research facility, including destination information.
entityid
@@ -487,6 +499,7 @@
Deaths
+ Documents primate deaths, including date, cause of death, and terminal body weight.
entityid
@@ -508,10 +521,14 @@
varchar
+
+ double
+
Exemptions
+ Tracks approved exemptions from standard care or procedural requirements for individual primates.
varchar
@@ -560,9 +577,11 @@
Animal Record Flags
+ Stores active record flags and status indicators applied to individual primates for colony management purposes.
Histopathology
+ Records histopathology findings from tissue examinations performed on primates, including diagnoses and associated reports.
varchar
@@ -614,9 +633,11 @@
Historical Other
+ Captures miscellaneous historical health and research records for primates that do not fit other specific categories.
Housing
+ Tracks housing assignments and location transfers for primates within the research facility.
varchar
@@ -677,9 +698,11 @@
Inbreeding Coefficients
+ Records calculated inbreeding coefficients for primates to support genetic management of the colony.
Necropsy
+ Documents necropsy (postmortem) examination findings for primates, including gross and histological observations, diagnoses, and reports.
varchar
@@ -693,9 +716,6 @@
http://cpas.labkey.com/Study#VisitDate
http://cpas.labkey.com/Study#VisitDate
-
- double
-
Category
varchar
@@ -704,10 +724,6 @@
Accession Number
varchar
-
- Reason for Examination
- varchar
-
Condition of Specimen
varchar
@@ -744,6 +760,7 @@
Gross Pathology
+ Records gross pathology findings observed during necropsy examinations of primates.
varchar
@@ -768,6 +785,7 @@
Tissue Disposition
+ Tracks the disposition of tissue samples collected during necropsy of primates.
varchar
@@ -791,6 +809,7 @@
Pairings
+ Records social pairing and group housing arrangements for primates, including formation type, compatibility observations, and separation details.
varchar
@@ -843,6 +862,7 @@
Physical Exam
+ Documents physical examination findings and measurements recorded during veterinary assessments of primates.
varchar
@@ -878,6 +898,7 @@
Procedures
+ Records research and veterinary procedures performed on primates, including procedure type, category, and associated case information.
varchar
@@ -918,6 +939,7 @@
Procedure Orders
+ Tracks scheduled procedure orders for primates, including ordering veterinarian and scheduling windows.
varchar
@@ -957,6 +979,7 @@
Serology
+ Records serological test results for primates, used for infectious disease screening and colony health monitoring.
varchar
@@ -980,6 +1003,7 @@
Problem List
+ Maintains the active and historical problem list for individual primates, supporting ongoing veterinary case management.
varchar
@@ -1006,6 +1030,7 @@
Drug Administration
+ Records drug and medication administrations for primates, including dosage, route, concentration, and ordering clinician.
varchar
@@ -1080,6 +1105,7 @@
Treatment Cases
+ Tracks veterinary treatment cases for primates, supporting clinical case management from opening through resolution.
varchar
@@ -1145,6 +1171,7 @@
Treatment Orders
+ Stores standing treatment orders for primates, including medication details, dosing frequency, and prescribing veterinarian.
varchar
@@ -1268,9 +1295,11 @@
Vital Signs
+ Records vital sign measurements for primates, including temperature, heart rate, respiration rate, blood pressure, and pulse oximetry.
Weight
+ Tracks body weight measurements for primates, used for health monitoring and drug dosage calculations.
varchar
diff --git a/nirc_ehr/resources/views/necropsy.html b/nirc_ehr/resources/views/necropsy.html
index 5b51a70d..2d62d51b 100644
--- a/nirc_ehr/resources/views/necropsy.html
+++ b/nirc_ehr/resources/views/necropsy.html
@@ -59,7 +59,7 @@
schemaName: 'study',
queryName: 'deaths',
filterArray: filterArray,
- columns: 'Id,Id/demographics/species,date,reason,Id/lastProtocol/protocol,Id/lastProject/project',
+ columns: 'Id,Id/demographics/species,date,reason,deathWeight,Id/lastProtocol/protocol,Id/lastProject/project',
},
title: 'Death',
renderTo: 'animalDeath',
diff --git a/nirc_ehr/resources/web/nirc_ehr/model/sources/DeathNecropsy.js b/nirc_ehr/resources/web/nirc_ehr/model/sources/DeathNecropsy.js
index 4be79f4c..1db8b70c 100644
--- a/nirc_ehr/resources/web/nirc_ehr/model/sources/DeathNecropsy.js
+++ b/nirc_ehr/resources/web/nirc_ehr/model/sources/DeathNecropsy.js
@@ -12,12 +12,18 @@ EHR.model.DataModelManager.registerMetadata('DeathNecropsy', {
dateFormat: 'Y-m-d',
timeFormat: 'H:i'
},
+ },
+ deathWeight: {
+ label: 'Weight (kg)',
+ allowBlank: false,
+ nullable: false,
+ },
+ reason: {
+ allowBlank: false,
+ nullable: false,
}
},
'study.necropsy': {
- necropsyWeight: {
- label: 'Weight (kg)'
- },
date: {
label: 'Exam Date',
xtype: 'xdatetime',
diff --git a/nirc_ehr/resources/web/nirc_ehr/panel/SnapshotPanel.js b/nirc_ehr/resources/web/nirc_ehr/panel/SnapshotPanel.js
index 708d6b57..16bc553c 100644
--- a/nirc_ehr/resources/web/nirc_ehr/panel/SnapshotPanel.js
+++ b/nirc_ehr/resources/web/nirc_ehr/panel/SnapshotPanel.js
@@ -291,7 +291,7 @@ Ext4.define('NIRC_EHR.panel.SnapshotPanel', {
var html = '';
var sep = '';
Ext4.each(animals, function(id) {
- html += sep + '' + LABKEY.Utils.encodeHtml(id) + '';
+ html += sep + '' + encodeURIComponent(id) + '';
sep = ', ';
});
toSet['cagemates'] = html;
@@ -346,4 +346,44 @@ Ext4.define('NIRC_EHR.panel.SnapshotPanel', {
}
}]);
},
+
+ appendParentageResults: function(toSet, results){
+ if (results){
+ var parentMap = {};
+ Ext4.each(results, function(row){
+ var parent = row.parent;
+ var relationship = row.relationship;
+
+ if (parent && relationship){
+ var text = LABKEY.Utils.encodeHtml(relationship + ' - ' + parent);
+
+ if (!parentMap[text])
+ parentMap[text] = [];
+
+ var method = row.method;
+ if (method){
+ parentMap[text].push(LABKEY.Utils.encodeHtml(method));
+ }
+ }
+ }, this);
+
+ var values = [];
+ Ext4.Array.forEach(Ext4.Object.getKeys(parentMap).sort(), function(text){
+ parentMap[text] = Ext4.unique(parentMap[text]);
+ var subject = text;
+ var textParts = text.split(' - ');
+ if (textParts.length > 1){
+ subject = textParts[1];
+ }
+
+ values.push('' + encodeURIComponent(subject) + '');
+ }, this);
+
+ if (values.length)
+ toSet['parents'] = values.join('
');
+ }
+ else {
+ toSet['parents'] = 'No data';
+ }
+ },
});
\ No newline at end of file
diff --git a/nirc_ehr/test/src/org.labkey.test/tests.nirc_ehr/NIRC_EHRTest.java b/nirc_ehr/test/src/org.labkey.test/tests.nirc_ehr/NIRC_EHRTest.java
index 8e57226e..68e770dd 100644
--- a/nirc_ehr/test/src/org.labkey.test/tests.nirc_ehr/NIRC_EHRTest.java
+++ b/nirc_ehr/test/src/org.labkey.test/tests.nirc_ehr/NIRC_EHRTest.java
@@ -837,7 +837,8 @@ public void testDeathNecropsyForm() throws IOException, CommandException
setFormElement(Locator.name("Id"), aliveAnimalId);
_ext4Helper.selectComboBoxItem("Disposition:", "Euthaniasia (project)");
-
+ waitForElement(Locator.name("deathWeight"));
+ setFormElement(Locator.name("deathWeight"), "23");
Assert.assertFalse(isElementPresent(Locator.linkWithText("Submit Necropsy for Review")));
Assert.assertFalse(isElementPresent(Locator.linkWithText("Submit Final")));
submitForm("Submit Death", "Confirm");
@@ -861,13 +862,11 @@ public void testDeathNecropsyForm() throws IOException, CommandException
beginAt(url);
Ext4GridRef necropsy = _helper.getExt4GridForFormSection("Necropsy");
necropsy.expand();
- waitForElement(Locator.name("necropsyWeight"));
- setFormElement(Locator.name("necropsyWeight"), "23");
scrollIntoView(Locator.linkContainingText("More Actions"));
_ext4Helper.selectComboBoxItem("Physical Condition:", "Excellent");
- _ext4Helper.selectComboBoxItem("Reason for Examination:", "Natural Death");
_ext4Helper.selectComboBoxItem("Condition of Specimen:", "Fresh");
scrollIntoView(Locator.name("diagnosis"));
+ _helper.setDataEntryField("accessionNumber", "123");
_helper.setDataEntryField("identification", "Extra information");
_helper.setDataEntryField("grossAbnormalities", "Extra leg");
_helper.setDataEntryField("diagnosis", "Dead");