Skip to content

Commit 685f02f

Browse files
Animals are treated as "Alive" when the data is in Draft or Review Requested status. (#675)
* Add a new status code 'Alive - In Progress' to be set for qcstates that are 'In Progress' or 'Review Requested' for Birth and Arrivals * Update 'aliases' query
1 parent ea5e5fb commit 685f02f

File tree

8 files changed

+19
-4
lines changed

8 files changed

+19
-4
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
code
2+
Alive
3+
Alive - In Progress
4+
Dead
5+
ERROR
6+
No Record
7+
Shipped

nirc_ehr/resources/data/editable_lookups.tsv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ ehr_lookups blood_draw_tube_type Clinical Blood Draw Tube Type Used in blood dra
2323
ehr_lookups blood_sample_type Clinical Blood Sample Types Used in blood draw datasets.
2424
ehr_lookups blood_tube_volumes Clinical Blood Tube Volumes Used in blood draw datasets.
2525
ehr_lookups cage_type Colony Management Cage Type Used in cage details.
26+
ehr_lookups calculated_status_codes Colony Management Calculated Status Animal status values.
2627
ehr_lookups capillary_refill_time Clinical Capillary Refill Times Used clinical observations.
2728
ehr_lookups card_format Colony Management Card Format
2829
ehr_lookups census_activity_status Colony Management Census Activity Status

nirc_ehr/resources/data/lookup_sets.tsv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ behavior_mgmt_codes Behavior Management Codes value
1818
behavior_types Behavior Types value
1919
blood_draw_reason Blood Draw Reason value
2020
blood_sample_type Blood Sample Types value
21-
card_format Card Format value title
2221
cage_type Cage Type value title
2322
capillary_refill_time Capillary Refill Time value
23+
card_format Card Format value title
2424
census_activity_status Census Activity Status value title
2525
clinremarks_category Clinremarks Category value title
2626
congenital_abnormalities Congenital Abnormalities value title

nirc_ehr/resources/data/lookupsManifest.tsv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ blood_draw_tube_type
2323
blood_sample_type
2424
blood_tube_volumes
2525
cage_type
26+
calculated_status_codes
2627
capillary_refill_time
2728
card_format
2829
census_activity_status

nirc_ehr/resources/data/lookupsManifestTest.tsv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ blood_draw_tube_type
2222
blood_sample_type
2323
blood_tube_volumes
2424
cage_type
25+
calculated_status_codes
2526
capillary_refill_time
2627
card_format
2728
census_activity_status

nirc_ehr/resources/queries/study/aliases.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
SELECT Id,
44
Id as alias
5-
FROM study.Animal
5+
FROM study.Animal where Dataset.Demographics.calculated_status != 'Alive - In Progress'
66
UNION
77
SELECT Id,
88
Name as alias
99
FROM nirc_ehr.IdHistory
1010
UNION
1111
SELECT Id,
1212
Alias as alias
13-
FROM study.alias
13+
FROM study.alias where Id.demographics.calculated_status != 'Alive - In Progress'
14+
'

nirc_ehr/resources/queries/study/arrival.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Even
9696
}
9797
}
9898

99+
row.calculated_status = (row.QCStateLabel.toUpperCase() === 'IN PROGRESS' || row.QCStateLabel.toUpperCase() === 'REVIEW REQUIRED') ? 'Alive - In Progress' : 'Alive';
100+
99101
if(!oldRow) {
100102
//if not already present, insert into demographics
101103
helper.getJavaHelper().createDemographicsRecord(row.Id, row, extraDemographicsFieldMappings);

nirc_ehr/resources/queries/study/birth.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,12 @@ EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Even
7878
'qcstate': helper.getJavaHelper().getQCStateForLabel(row.QCStateLabel).getRowId()
7979
}
8080

81+
var calc_status = (row.QCStateLabel.toUpperCase() === 'IN PROGRESS' || row.QCStateLabel.toUpperCase() === 'REVIEW REQUIRED') ? 'Alive - In Progress' : 'Alive';
82+
8183
var obj = {
8284
Id: row.Id,
8385
date: row.date,
84-
calculated_status: 'Alive',
86+
calculated_status: calc_status,
8587
dam: row['Id/demographics/dam'] || null,
8688
sire: row['Id/demographics/sire'] || null,
8789
species: row['Id/demographics/species'] || null,

0 commit comments

Comments
 (0)