diff --git a/onprc_ehr/resources/data/lookup_sets.tsv b/onprc_ehr/resources/data/lookup_sets.tsv index 92e287400..546cfbeaf 100644 --- a/onprc_ehr/resources/data/lookup_sets.tsv +++ b/onprc_ehr/resources/data/lookup_sets.tsv @@ -1,82 +1,85 @@ setname label keyfield titleColumn -PregnancyConfirm Pregnancy Confirmation Types -housingDefinition Housing Definition -housingTypes Housing Types -AcquistionType Acquistion Types value -RearingType Rearing Types -MatingType Mating Types -pairingEventType Pairing Event Types value -tb_method TB Test Methods value -microbiologyQuantity Microbiology Quantity value -blood_sample_type Blood Sample Types value -pairingHousingType Pairing Housing Types value -pairingOutcome Pairing Outcomes value -pairingGoal Pairing Goal value -pairingObservation Pairing Observations value -antibioticSensitivityResult Antibiotic Sensitivity Result value -pairingSeparationReason Pairing Separation Reason value -tissue_preparation Tissue Preparation value -tissue_condition Tissue Condition value -drugReason Drug Reason value -serologyMethod Serology Methods value -TransferReason Transfer Reasons -assignmentReleaseType Assignment Release Types value -animalGroupReleaseType Animal Group Release Types value -observation_areas Observation Areas value -drugOutcome Drug Administration Outcomes value -encounterSummaryCategory Encounter Summary Category value -labworkChargeType Labwork Charge Types value -notes_category DCM Notes Category value -blood_draw_reason Blood Draw Reason value -encounter_roles Encounter Roles value -parentageRelationship Parentage Relationship value -parentageMethod Parentage Determination Methods value -serologyResultQualifier Serology Result Qualifier value -app_score Appetite Score value -att_score Attitude Score value -turgor_score Turgor Score value -hyd_score Hyd Score value -stool_score Stool Score value -sib_score SIB Score value -incision_score Incision Score value -alopecia_type Alopecia Type value -alopecia_score Alopecia Type value -alopecia_regrowth Alopecia Regrowth value -mens_score Mens Score value -vomit Vomit value -tissue_sample_type Tissue Distribution Sample Type value -tissue_distribution_category Tissue Distribution Request Category value -cage_status Cage Status value -project_use_category Center Project Use Categories value -project_type Center Project Types value -procedure_drug_templates Procedure Drug Templates value -behavior_types Behavior Types value -fecal_smear_score Fecal Smear Scores value -problem_list_subcategory Problem List Subcategory value -customer_affiliation Customer Affiliation value -birth_date_type Birth Date Type value -birth_type Birth Type Field Values value -chemistry_method Chemistry Method Field Values value -clinpath_sampletype Clinpath Sample Type Field Values value -clinpath_types Clinpath Type Field Values value -clinremarks_category Clinremarks Category Field Values value -drug_categories Drug Category Field Values value -hematology_method Hematology Method Field Values value -problem_list_category Problem List Category Field Values value -parasitology_method Parasitology Method Field Values value -urinalysis_method Urinalysis Method Field Values value -urinalysis_qualitative_results Urinalysis Qualitative Result Field Values value -bcs_score BCS Score Field Values value -avail_codes Availability Code Field Values value -status_codes Status Code Field Values value -snomed_qualifiers SNOMED Code Qualifiers value -housing_reason Housing Reason Field Values value -housing_condition_codes Housing Condition Field Values value -histology_stain Histology Stain Field Values value -encounter_types Encounter Types value -DeliveryMode Delivery Mode Field Values value -DeliveryType Delivery Type Field Values value -death_manner Death Manner value -death_cause Death Cause value -ConfirmationType Pregnancy Confirmation Type value -clinpath_collection_method Clinpath Collection Method value \ No newline at end of file +PregnancyConfirm Pregnancy Confirmation Types +housingDefinition Housing Definition +housingTypes Housing Types +AcquistionType Acquistion Types value +RearingType Rearing Types +MatingType Mating Types +pairingEventType Pairing Event Types value +tb_method TB Test Methods value +microbiologyQuantity Microbiology Quantity value +blood_sample_type Blood Sample Types value +pairingHousingType Pairing Housing Types value +pairingpriorgroups Pairing Prior groups value +pairingendtypes Pairing End Types value +pairingstarttype Pairing Start Type value +pairingOutcome Pairing Outcomes value +pairingGoal Pairing Goal value +pairingObservation Pairing Observations value +antibioticSensitivityResult Antibiotic Sensitivity Result value +pairingSeparationReason Pairing Separation Reason value +tissue_preparation Tissue Preparation value +tissue_condition Tissue Condition value +drugReason Drug Reason value +serologyMethod Serology Methods value +TransferReason Transfer Reasons +assignmentReleaseType Assignment Release Types value +animalGroupReleaseType Animal Group Release Types value +observation_areas Observation Areas value +drugOutcome Drug Administration Outcomes value +encounterSummaryCategory Encounter Summary Category value +labworkChargeType Labwork Charge Types value +notes_category DCM Notes Category value +blood_draw_reason Blood Draw Reason value +encounter_roles Encounter Roles value +parentageRelationship Parentage Relationship value +parentageMethod Parentage Determination Methods value +serologyResultQualifier Serology Result Qualifier value +app_score Appetite Score value +att_score Attitude Score value +turgor_score Turgor Score value +hyd_score Hyd Score value +stool_score Stool Score value +sib_score SIB Score value +incision_score Incision Score value +alopecia_type Alopecia Type value +alopecia_score Alopecia Type value +alopecia_regrowth Alopecia Regrowth value +mens_score Mens Score value +vomit Vomit value +tissue_sample_type Tissue Distribution Sample Type value +tissue_distribution_category Tissue Distribution Request Category value +cage_status Cage Status value +project_use_category Center Project Use Categories value +project_type Center Project Types value +procedure_drug_templates Procedure Drug Templates value +behavior_types Behavior Types value +fecal_smear_score Fecal Smear Scores value +problem_list_subcategory Problem List Subcategory value +customer_affiliation Customer Affiliation value +birth_date_type Birth Date Type value +birth_type Birth Type Field Values value +chemistry_method Chemistry Method Field Values value +clinpath_sampletype Clinpath Sample Type Field Values value +clinpath_types Clinpath Type Field Values value +clinremarks_category Clinremarks Category Field Values value +drug_categories Drug Category Field Values value +hematology_method Hematology Method Field Values value +problem_list_category Problem List Category Field Values value +parasitology_method Parasitology Method Field Values value +urinalysis_method Urinalysis Method Field Values value +urinalysis_qualitative_results Urinalysis Qualitative Result Field Values value +bcs_score BCS Score Field Values value +avail_codes Availability Code Field Values value +status_codes Status Code Field Values value +snomed_qualifiers SNOMED Code Qualifiers value +housing_reason Housing Reason Field Values value +housing_condition_codes Housing Condition Field Values value +histology_stain Histology Stain Field Values value +encounter_types Encounter Types value +DeliveryMode Delivery Mode Field Values value +DeliveryType Delivery Type Field Values value +death_manner Death Manner value +death_cause Death Cause value +ConfirmationType Pregnancy Confirmation Type value +clinpath_collection_method Clinpath Collection Method value diff --git a/onprc_ehr/resources/data/pairing_observation_types.tsv b/onprc_ehr/resources/data/pairing_observation_types.tsv new file mode 100644 index 000000000..291834aad --- /dev/null +++ b/onprc_ehr/resources/data/pairing_observation_types.tsv @@ -0,0 +1,6 @@ +value +Divider Change +Event +Infant Related +STF Beh +STF Clinical diff --git a/onprc_ehr/resources/data/pairingendtypes.tsv b/onprc_ehr/resources/data/pairingendtypes.tsv new file mode 100644 index 000000000..eea46c577 --- /dev/null +++ b/onprc_ehr/resources/data/pairingendtypes.tsv @@ -0,0 +1,25 @@ +value +All to group +Contact decrease +Contact increase +Decrease contact +Decrease partners +End All Contact +End clear +End full contact +End GC +End group +End large mesh +Extended temporary separation. +Increase contact +Increase partners +N/A +Pair change-decrease. +Pair change-increase. +Pair to trio/group. +Permanent Separation. +Reunite from GC +Temporary separation. +TO with GC +Unsuccessful attempt +Unsuccessful set-up diff --git a/onprc_ehr/resources/data/pairingpriorgroups.tsv b/onprc_ehr/resources/data/pairingpriorgroups.tsv new file mode 100644 index 000000000..b96f5c988 --- /dev/null +++ b/onprc_ehr/resources/data/pairingpriorgroups.tsv @@ -0,0 +1,3 @@ +value +Not recent +Recent diff --git a/onprc_ehr/resources/data/pairingstarttype.tsv b/onprc_ehr/resources/data/pairingstarttype.tsv new file mode 100644 index 000000000..3bf4025df --- /dev/null +++ b/onprc_ehr/resources/data/pairingstarttype.tsv @@ -0,0 +1,47 @@ +value +Bio dam reunite +C-sx reunite +Contact decrease +Contact Increase +Contact increase first attempt +Decrease partners +Extended temporary separation +Feeder Box +General Comment +Increase partners +Increase partners first attempt +Infant socialization +Lactating foster +Non BSU pair +Nonlactating foster +Pair attempt +Pair change +Pair change-decrease +Pair change-increase +Pair monitor +Pair to trio/group +Permanent separation +Porch +remote monitoring +Reunite +Reunite after procedure +Reunite after TO +Same social group pair +Set up +STE +STF +STF DNPC +STF/E +STF/E DNPC +Temporary separation +TMB +TMB pair +TO as GC +trial contact +trial contact first attempt +Sep for Diet +STE. +STF. +STF DNPC. +STF/E. +STF/E DNPC. diff --git a/onprc_ehr/resources/queries/onprc_ehr/PairingStartType.sql b/onprc_ehr/resources/queries/onprc_ehr/PairingStartType.sql deleted file mode 100644 index 5aa0add81..000000000 --- a/onprc_ehr/resources/queries/onprc_ehr/PairingStartType.sql +++ /dev/null @@ -1,5 +0,0 @@ --- Created: 6-20-2018 R.Blasa - -select value, sort_order from sla.Reference_Data -where columnName = 'PairingStarttype' -And endDate is null \ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/CageMateAdults.sql b/onprc_ehr/resources/queries/study/CageMateAdults.sql new file mode 100644 index 000000000..eb844cc81 --- /dev/null +++ b/onprc_ehr/resources/queries/study/CageMateAdults.sql @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2017 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. + */ + +SELECT + + h1.Id, + group_concat(h2.Id, ' ') as adultcagemate, + group_Concat(distinct h2.room) as room, + group_concat(distinct h1.cage) as cage + +FROM study.demographicsCurrentLocation h1 + JOIN study.demographicsCurrentLocation h2 ON ( + h1.room = h2.room AND + h1.cage = h2.cage + + ) + +WHERE + h1.room.housingType.value = 'Cage Location' AND + h2.Id.age.ageInyears > 1 + + +GROUP BY h1.Id + + diff --git a/onprc_ehr/resources/queries/study/CageMateAdults/.qview.xml b/onprc_ehr/resources/queries/study/CageMateAdults/.qview.xml new file mode 100644 index 000000000..0f45185ae --- /dev/null +++ b/onprc_ehr/resources/queries/study/CageMateAdults/.qview.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/CageMateAll.sql b/onprc_ehr/resources/queries/study/CageMateAll.sql new file mode 100644 index 000000000..14758b5c7 --- /dev/null +++ b/onprc_ehr/resources/queries/study/CageMateAll.sql @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2017 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. + */ + +SELECT + + h1.Id, + group_concat(h2.Id, '-') as adultcagemate, + group_Concat(distinct h2.room) as room, + group_concat(distinct h1.cage) as cage + +FROM study.demographicsCurrentLocation h1 + JOIN study.demographicsCurrentLocation h2 ON ( + h1.room = h2.room AND + h1.cage = h2.cage + + ) + +WHERE + h1.room.housingType.value = 'Cage Location' + + +GROUP BY h1.Id + + diff --git a/onprc_ehr/resources/queries/study/CageMateAll/.qview.xml b/onprc_ehr/resources/queries/study/CageMateAll/.qview.xml new file mode 100644 index 000000000..0f45185ae --- /dev/null +++ b/onprc_ehr/resources/queries/study/CageMateAll/.qview.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/CageMateInfantpairings.sql b/onprc_ehr/resources/queries/study/CageMateInfantpairings.sql new file mode 100644 index 000000000..8cb02e73d --- /dev/null +++ b/onprc_ehr/resources/queries/study/CageMateInfantpairings.sql @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2017 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. + */ + +SELECT + + h1.Id, + group_concat(h2.Id, '-') as infantcagemate, + group_Concat(distinct h2.room) as room, + group_concat(distinct h1.cage) as cage + +FROM study.demographicsCurrentLocation h1 + JOIN study.demographicsCurrentLocation h2 ON ( + h1.room = h2.room AND + h1.cage = h2.cage + + ) + +WHERE + h1.room.housingType.value = 'Cage Location' AND + h2.Id.age.ageInyears < 1 + +GROUP BY h1.Id \ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/CageMateInfantpairings/.qview.xml b/onprc_ehr/resources/queries/study/CageMateInfantpairings/.qview.xml new file mode 100644 index 000000000..0f45185ae --- /dev/null +++ b/onprc_ehr/resources/queries/study/CageMateInfantpairings/.qview.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/Pairings.query.xml b/onprc_ehr/resources/queries/study/Pairings.query.xml index cff5930aa..cf4e8704d 100644 --- a/onprc_ehr/resources/queries/study/Pairings.query.xml +++ b/onprc_ehr/resources/queries/study/Pairings.query.xml @@ -10,9 +10,13 @@ + + false + Infant ID + Pair Id - This is used to identify the lowest cage number of the pair. It is used to determine which animals in the group are considered part of the pair. + Redesigned to generate cagemates Room @@ -20,18 +24,46 @@ Cage + + false + Other IDs + + + false + Other Infant + Start Date + + false + Category + + onprc_ehr + pairing_observation_types + value + + Start Type - onprc_ehr - PairingStartType + ehr_lookups + pairingstarttype value + + + + false + Prior Group Housing + 200 + + ehr_lookups + pairingpriorgroups + value + Start Remark 300 @@ -60,8 +92,8 @@ End Type - onprc_ehr - PairingEndType + ehr_lookups + pairingendtypes value @@ -74,7 +106,6 @@ value - Observation @@ -89,26 +120,18 @@ 300 - - true - Housing Type - - ehr_lookups - pairingHousingType - value - - Pair ID true - This field is used to differentiate pairs. By convention is should usually be the lowest cage number in the group; however, it does not need to match this + Performed By true + diff --git a/onprc_ehr/resources/queries/study/pairingSummary.query.xml b/onprc_ehr/resources/queries/study/pairingSummary.query.xml index 36e844f38..cdc2aa115 100644 --- a/onprc_ehr/resources/queries/study/pairingSummary.query.xml +++ b/onprc_ehr/resources/queries/study/pairingSummary.query.xml @@ -12,6 +12,8 @@ + + @@ -22,15 +24,21 @@ - - Other Ids + + Other IDs + + + + + + diff --git a/onprc_ehr/resources/queries/study/pairingSummary.sql b/onprc_ehr/resources/queries/study/pairingSummary.sql index 37d20a178..27e856f10 100644 --- a/onprc_ehr/resources/queries/study/pairingSummary.sql +++ b/onprc_ehr/resources/queries/study/pairingSummary.sql @@ -18,10 +18,12 @@ SELECT (SELECT group_concat(distinct p2.Id, chr(10)) AS Ids FROM study.pairings p2 WHERE p.Id != p2.id AND p.pairId = p2.pairId) as otherIds, p.pairid, p.date, + (Select j.gender from study.demographics j where j.Id = p.Id) as sex, p.lowestCage, p.room, p.cage, p.eventType, + p.category, p.goal, p.observation, p.outcome, @@ -34,7 +36,11 @@ SELECT p.taskid, TIMESTAMPDIFF('SQL_TSI_DAY', p.date, coalesce(p.enddate,curdate())) as duration, p.qcstate, - p.lsid + p.lsid, + p.other_IDs, + p.other_infant, + p.infant_id, + p.housingtype FROM study.pairings p diff --git a/onprc_ehr/resources/queries/study/pairingSummary/.qview.xml b/onprc_ehr/resources/queries/study/pairingSummary/.qview.xml index ed72dc87c..c981d488f 100644 --- a/onprc_ehr/resources/queries/study/pairingSummary/.qview.xml +++ b/onprc_ehr/resources/queries/study/pairingSummary/.qview.xml @@ -1,21 +1,23 @@ + - + + + - - + diff --git a/onprc_ehr/resources/queries/study/pairingSummary/Dam Infant Pairing.qview.xml b/onprc_ehr/resources/queries/study/pairingSummary/Dam Infant Pairing.qview.xml index 094b33467..ea7a4b92a 100644 --- a/onprc_ehr/resources/queries/study/pairingSummary/Dam Infant Pairing.qview.xml +++ b/onprc_ehr/resources/queries/study/pairingSummary/Dam Infant Pairing.qview.xml @@ -1,19 +1,21 @@ + - + + - + - + diff --git a/onprc_ehr/resources/queries/study/pairingSummary/Pairing Events with Comments.qview.xml b/onprc_ehr/resources/queries/study/pairingSummary/Pairing Events with Comments.qview.xml index 2976275e9..e41aaa7d5 100644 --- a/onprc_ehr/resources/queries/study/pairingSummary/Pairing Events with Comments.qview.xml +++ b/onprc_ehr/resources/queries/study/pairingSummary/Pairing Events with Comments.qview.xml @@ -1,11 +1,13 @@ + - + + - + @@ -13,6 +15,7 @@ + diff --git a/onprc_ehr/resources/queries/study/pairingSummary/Pairing Events.qview.xml b/onprc_ehr/resources/queries/study/pairingSummary/Pairing Events.qview.xml index af1f40542..d4242ae8e 100644 --- a/onprc_ehr/resources/queries/study/pairingSummary/Pairing Events.qview.xml +++ b/onprc_ehr/resources/queries/study/pairingSummary/Pairing Events.qview.xml @@ -1,18 +1,22 @@ + - + + - + + + diff --git a/onprc_ehr/resources/queries/study/pairingSummaryComments.query.xml b/onprc_ehr/resources/queries/study/pairingSummaryComments.query.xml index bd47f064e..4243a01d8 100644 --- a/onprc_ehr/resources/queries/study/pairingSummaryComments.query.xml +++ b/onprc_ehr/resources/queries/study/pairingSummaryComments.query.xml @@ -20,17 +20,25 @@ + + - - Other Ids + + Other IDs + + + + + + diff --git a/onprc_ehr/resources/queries/study/pairingSummaryComments.sql b/onprc_ehr/resources/queries/study/pairingSummaryComments.sql index 4e2204fea..b919e01a6 100644 --- a/onprc_ehr/resources/queries/study/pairingSummaryComments.sql +++ b/onprc_ehr/resources/queries/study/pairingSummaryComments.sql @@ -3,10 +3,12 @@ SELECT (SELECT group_concat(distinct p2.Id, chr(10)) AS Ids FROM study.pairings p2 WHERE p.Id != p2.id AND p.pairId = p2.pairId) as otherIds, p.pairid, p.date, + (Select j.gender from study.demographics j where j.Id = p.Id) as sex, p.lowestCage, p.room, p.cage, p.eventType, + p.category, p.goal, p.observation, p.outcome, @@ -19,7 +21,11 @@ SELECT p.taskid, TIMESTAMPDIFF('SQL_TSI_DAY', p.date, coalesce(p.enddate,curdate())) as duration, p.qcstate, - p.lsid + p.lsid, + p.other_IDs, + p.other_infant, + p.infant_id, + p.housingtype FROM study.pairings p where p.eventtype in ('General Comment', 'Pair monitor') \ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/pairingSummaryComments/.qview.xml b/onprc_ehr/resources/queries/study/pairingSummaryComments/.qview.xml index f19f9408f..e56c7ee9a 100644 --- a/onprc_ehr/resources/queries/study/pairingSummaryComments/.qview.xml +++ b/onprc_ehr/resources/queries/study/pairingSummaryComments/.qview.xml @@ -1,17 +1,19 @@ + + + - - + diff --git a/onprc_ehr/resources/referenceStudy/study/datasets/datasets_metadata.xml b/onprc_ehr/resources/referenceStudy/study/datasets/datasets_metadata.xml index 207115969..b15d94dde 100644 --- a/onprc_ehr/resources/referenceStudy/study/datasets/datasets_metadata.xml +++ b/onprc_ehr/resources/referenceStudy/study/datasets/datasets_metadata.xml @@ -2338,6 +2338,18 @@ varchar + + varchar + + + varchar + + + varchar + + + varchar + integer urn:ehr.labkey.org/#Project diff --git a/onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-24.012-24.013.sql b/onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-24.012-24.013.sql new file mode 100644 index 000000000..3fcc21300 --- /dev/null +++ b/onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-24.012-24.013.sql @@ -0,0 +1,18 @@ +CREATE TABLE onprc_ehr.pairing_observation_types ( + rowid [int] IDENTITY(100,1) NOT NULL, + value nvarchar(200), + category nvarchar(200), + editorconfig NVARCHAR(MAX), + schemaname nvarchar(200), + queryname nvarchar(200), + valuecolumn nvarchar(200), + Created datetime, + CreatedBy USERID, + Modified datetime, + ModifiedBy USERID, + Container entityId NOT NULL, + + CONSTRAINT PK_ONPRC_EHR_PAIRING_OBSERVATION_TYPES PRIMARY KEY (rowid), + +); +GO diff --git a/onprc_ehr/resources/schemas/onprc_ehr.xml b/onprc_ehr/resources/schemas/onprc_ehr.xml index e229bcf9b..875814163 100644 --- a/onprc_ehr/resources/schemas/onprc_ehr.xml +++ b/onprc_ehr/resources/schemas/onprc_ehr.xml @@ -1454,4 +1454,21 @@ + + + + + + + + + + + + + + + +
+ diff --git a/onprc_ehr/resources/views/populateData.html b/onprc_ehr/resources/views/populateData.html index be85c72de..8f4d4e57f 100644 --- a/onprc_ehr/resources/views/populateData.html +++ b/onprc_ehr/resources/views/populateData.html @@ -643,7 +643,7 @@ label: 'Pairing Housing Type', populateFn: 'populateFromFile', schemaName: 'ehr_lookups', - queryName: 'pairingHousingType', + queryName: 'pairingpriorgroups', pk: 'rowid' },{ label: 'Pairing Goal', @@ -657,6 +657,24 @@ schemaName: 'ehr_lookups', queryName: 'pairingOutcome', pk: 'rowid' + },{ + label: 'Pairing Category', + populateFn: 'populateFromFile', + schemaName: 'onprc_ehr', + queryName: 'pairing_observation_types', + pk: 'rowid' + },{ + label: 'Pairing Start Type', + populateFn: 'populateFromFile', + schemaName: 'ehr_lookups', + queryName: 'pairingstarttype', + pk: 'rowid' + },{ + label: 'Pairing End Types', + populateFn: 'populateFromFile', + schemaName: 'ehr_lookups', + queryName: 'pairingendtypes', + pk: 'rowid' },{ label: 'Blood Draw Services', populateFn: 'populateFromFile', diff --git a/onprc_ehr/resources/web/onprc_ehr/Utils.js b/onprc_ehr/resources/web/onprc_ehr/Utils.js index c708e0d58..d89813870 100644 --- a/onprc_ehr/resources/web/onprc_ehr/Utils.js +++ b/onprc_ehr/resources/web/onprc_ehr/Utils.js @@ -23,8 +23,46 @@ ONPRC.Utils = new function(){ success: LABKEY.Utils.getCallbackWrapper(LABKEY.Utils.getOnSuccess(config), config.scope) }); }, + getpairingStore: function(){ + if (ONPRC_EHR._pairingStore) + return ONPRC_EHR._pairingStore; - preloadSession: function() { + var storeId = ['onprc_ehr', 'Pairingmenus', 'value', 'category'].join('||'); + + ONPRC_EHR._pairingStore = Ext4.StoreMgr.get(storeId) || Ext4.create('LABKEY.ext4.data.Store', { + type: 'labkey-store', + schemaName: 'onprc_ehr', + queryName: 'Pairingmenus', + columns: 'value, category', + filterArray: [LABKEY.Filter.create('date_disabled', null, LABKEY.Filter.Types.ISBLANK)], + sort: 'value', + storeId: storeId, + autoLoad: true, + getRecordForCode: function(value){ + var recIdx = this.findExact('value', value); + if (recIdx != -1){ + return this.getAt(recIdx); + } + } + }); + + return ONPRC_EHR._pairingStore; + }, + + getpairingObservationTypesStore: function() { + if (ONPRC_EHR._pairingobservationTypesStore) + return ONPRC_EHR._pairingobservationTypesStore; + + ONPRC_EHR._pairingobservationTypesStore = Ext4.create('LABKEY.ext4.data.Store', { + type: 'labkey-store', + schemaName: 'onprc_ehr', + queryName: 'observation_types', + columns: 'value,editorconfig', + autoLoad: true + }); + }, + + preloadSession: function() { LABKEY.Ajax.request({ url: LABKEY.ActionURL.buildURL('onprc_ehr', 'getSessionId'), method: 'POST', diff --git a/onprc_ehr/resources/web/onprc_ehr/form/field/DurationEntryField.js b/onprc_ehr/resources/web/onprc_ehr/form/field/DurationEntryField.js new file mode 100644 index 000000000..c646a7ee4 --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/form/field/DurationEntryField.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2013-2019 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 + */ +Ext4.define('ONPRC_EHR.form.field.DurationEntryField', { + extend: 'Ext.form.field.Trigger', + alias: 'widget.onprc_ehr-durationentryfield', + + triggerCls: 'x4-form-search-trigger', + triggerToolTip: 'Click to set this to match the current cage', + + initComponent: function(){ + this.callParent(arguments); + }, + + onTriggerClick: function(e){ + var rec = EHR.DataEntryUtils.getBoundRecord(this); + var interval = ''; + if (rec){ + var d2 = Ext4.Date.clearTime(new Date(), true); + var d1 = Ext4.Date.clearTime(rec.get('date'), true); + interval = Ext4.Date.getElapsed(d1, d2); + interval = interval / (1000 * 60 * 60 * 24); + interval = Math.floor(interval); + + if (interval) + this.setValue(interval); + } + } +}); \ No newline at end of file diff --git a/onprc_ehr/resources/web/onprc_ehr/form/field/PairedAdultsEntryField.js b/onprc_ehr/resources/web/onprc_ehr/form/field/PairedAdultsEntryField.js new file mode 100644 index 000000000..ac76c5625 --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/form/field/PairedAdultsEntryField.js @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2013-2019 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 + */ + +Ext4.define('ONPRC_EHR.form.field.PairedAdultsEntryField', { + extend: 'LABKEY.ext4.ComboBox', + alias: 'widget.onprc_ehr-pairedadultsentryfield', + + + trigger1Cls: 'x4-form-search-trigger', + + initComponent: function(){ + this.callParent(arguments); + }, + + onTrigger1Click: function(){ + var rec = EHR.DataEntryUtils.getBoundRecord(this); + if (!rec){ + Ext4.Msg.alert('Error', 'Unable to locate associated animal Id'); + return; + } + + if (!rec || !rec.get('room')){ + Ext4.Msg.alert('Error', 'No room Entered'); + return; + } + if (!rec || !rec.get('cage')){ + Ext4.Msg.alert('Error', 'No cage Entered'); + return; + } + Ext4.Msg.wait('Loading...'); + + + this.queryValue(rec, function(ret){ + Ext4.Msg.hide(); + + if (ret && ret.adultcagemate){ + this.setValue(ret.adultcagemate); + } + + + }, true); + }, + + queryValue: function(rec, cb, alwaysUseCallback){ + var roomt = rec.get('room'); + var caget = rec.get('cage'); + + LABKEY.Query.selectRows({ + schemaName: 'study', + queryName: 'CageMateAdults', + columns: 'adultcagemate', + sort:'Id', + filterArray: [ + LABKEY.Filter.create('room', roomt , LABKEY.Filter.Types.EQUAL), + LABKEY.Filter.create('cage', caget , LABKEY.Filter.Types.EQUAL) + ], + failure: LDK.Utils.getErrorCallback(), + scope: this, + success: function(results){ + if (!alwaysUseCallback && id != this.pendingIdRequest){ + console.log('more recent request, aborting'); + return; + } + + if (results && results.rows && results.rows.length){ + cb.call(this, results.rows[0], results.rows[0].Id); + } + else { + cb.call(this, null, id); + } + } + }); + } + +}); \ No newline at end of file diff --git a/onprc_ehr/resources/web/onprc_ehr/form/field/PairedIDEntryField.js b/onprc_ehr/resources/web/onprc_ehr/form/field/PairedIDEntryField.js new file mode 100644 index 000000000..45099d380 --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/form/field/PairedIDEntryField.js @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2013-2019 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 + */ + +Ext4.define('ONPRC_EHR.form.field.PairedIDEntryField', { + extend: 'LABKEY.ext4.ComboBox', + alias: 'widget.onprc_ehr-pairedidentryfield', + + + trigger1Cls: 'x4-form-search-trigger', + + initComponent: function(){ + this.callParent(arguments); + }, + + onTrigger1Click: function(){ + var rec = EHR.DataEntryUtils.getBoundRecord(this); + if (!rec){ + Ext4.Msg.alert('Error', 'Unable to locate associated animal Id'); + return; + } + + + if (!rec || !rec.get('room')){ + Ext4.Msg.alert('Error', 'No room Entered'); + return; + } + if (!rec || !rec.get('cage')){ + Ext4.Msg.alert('Error', 'No cage Entered'); + return; + } + + Ext4.Msg.wait('Loading...'); + + + this.queryValue(rec, function(ret){ + Ext4.Msg.hide(); + + if (ret && ret.adultcagemate){ + this.setValue(ret.adultcagemate); + } + }, true); + }, + + queryValue: function(rec, cb, alwaysUseCallback){ + var roomt = rec.get('room'); + var caget = rec.get('cage'); + + LABKEY.Query.selectRows({ + schemaName: 'study', + queryName: 'CageMateAll', + columns: 'adultcagemate', + sort:'Id', + filterArray: [ + LABKEY.Filter.create('room', roomt , LABKEY.Filter.Types.EQUAL), + LABKEY.Filter.create('cage', caget , LABKEY.Filter.Types.EQUAL) + ], + failure: LDK.Utils.getErrorCallback(), + scope: this, + success: function(results){ + if (!alwaysUseCallback && id != this.pendingIdRequest){ + console.log('more recent request, aborting'); + return; + } + + if (results && results.rows && results.rows.length){ + cb.call(this, results.rows[0], results.rows[0].Id); + } + else { + cb.call(this, null, id); + } + } + }); + } + +}); \ No newline at end of file diff --git a/onprc_ehr/resources/web/onprc_ehr/form/field/PairedInfantEntryField.js b/onprc_ehr/resources/web/onprc_ehr/form/field/PairedInfantEntryField.js new file mode 100644 index 000000000..613906cec --- /dev/null +++ b/onprc_ehr/resources/web/onprc_ehr/form/field/PairedInfantEntryField.js @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2013-2019 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 + */ + +Ext4.define('ONPRC_EHR.form.field.PairedInfantEntryField', { + extend: 'LABKEY.ext4.ComboBox', + alias: 'widget.onprc_ehr-pairedinfantentryfield', + + + trigger1Cls: 'x4-form-search-trigger', + + initComponent: function(){ + this.callParent(arguments); + }, + + onTrigger1Click: function(){ + var rec = EHR.DataEntryUtils.getBoundRecord(this); + if (!rec){ + Ext4.Msg.alert('Error', 'Unable to locate associated animal Id'); + return; + } + + + if (!rec || !rec.get('room')){ + Ext4.Msg.alert('Error', 'No room Entered'); + return; + } + if (!rec || !rec.get('cage')){ + Ext4.Msg.alert('Error', 'No cage Entered'); + return; + } + + + Ext4.Msg.wait('Loading...'); + + + this.queryValue(rec, function(ret){ + Ext4.Msg.hide(); + + if (ret && ret.infantcagemate){ + this.setValue(ret.infantcagemate); + } + }, true); + }, + + queryValue: function(rec, cb, alwaysUseCallback){ + var roomt = rec.get('room'); + var caget = rec.get('cage'); + + + LABKEY.Query.selectRows({ + schemaName: 'study', + queryName: 'CageMateInfantpairings', + columns: 'infantcagemate', + sort:'Id', + filterArray: [ + LABKEY.Filter.create('room', roomt , LABKEY.Filter.Types.EQUAL), + LABKEY.Filter.create('cage', caget , LABKEY.Filter.Types.EQUAL) + ], + failure: LDK.Utils.getErrorCallback(), + scope: this, + success: function(results){ + if (!alwaysUseCallback && id != this.pendingIdRequest){ + console.log('more recent request, aborting'); + return; + } + + if (results && results.rows && results.rows.length){ + cb.call(this, results.rows[0], results.rows[0].Id); + } + else { + cb.call(this, null, id); + } + } + }); + } + +}); \ No newline at end of file diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/Pairing_Properties.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/Pairing_Properties.js index 86f14a441..d2d151938 100644 --- a/onprc_ehr/resources/web/onprc_ehr/model/sources/Pairing_Properties.js +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/Pairing_Properties.js @@ -14,22 +14,65 @@ EHR.model.DataModelManager.registerMetadata('Pairing_Properties', { 'study.pairings': { outcome: { - allowBlank: false, + allowBlank: true, + columnConfig: { + width: 160 + }, lookup: { filterArray: [ LABKEY.Filter.create('date_disabled', null, LABKEY.Filter.Types.ISBLANK) ] } }, + Id: { + allowBlank: false, + columnConfig: { + width: 100 + } + }, + infant_id: { + xtype: 'onprc_ehr-pairedinfantentryfield', + allowBlank: true, + columnConfig: { + width: 120 + } + }, eventtype: { - allowBlank: false, + columnConfig: { + width: 250 + }, + editorConfig: { + caseSensitive: false, + anyMatch: true, + listConfig: { + innerTpl: '{[(values.category ? "" + LABKEY.Utils.encodeHtml(values.category) + ": " : "") + LABKEY.Utils.encodeHtml(values.value)]}', + getInnerTpl: function () { + return this.innerTpl; + } + } + }, lookup: { - sort: 'sort_order' + xtype: 'combobox', + schemaName: 'ehr_Lookups', + queryName: 'pairingstarttype', + columns: 'value,category,sort_order,date_disabled', + keyColumn: 'value', + displayColumn: 'value', + sort: 'category,value,sort_order', + filterArray: [ + LABKEY.Filter.create('date_disabled', null, LABKEY.Filter.Types.ISBLANK) + ] } }, + + goal: { - allowBlank: false, + allowBlank: true, + header: 'Divider Goal', + columnConfig: { + width: 170 + }, lookup: { filterArray: [ LABKEY.Filter.create('date_disabled', null, LABKEY.Filter.Types.ISBLANK) @@ -38,8 +81,13 @@ EHR.model.DataModelManager.registerMetadata('Pairing_Properties', { }, endeventType: { + columnConfig: { + width: 180 + }, lookup: { - sort: 'sort_order' + filterArray: [ + LABKEY.Filter.create('date_disabled', null, LABKEY.Filter.Types.ISBLANK) + ] } }, @@ -49,7 +97,9 @@ EHR.model.DataModelManager.registerMetadata('Pairing_Properties', { separationreason: { allowBlank: true, - + columnConfig: { + width: 160 + }, lookup: { filterArray: [ LABKEY.Filter.create('date_disabled', null, LABKEY.Filter.Types.ISBLANK) @@ -60,29 +110,75 @@ EHR.model.DataModelManager.registerMetadata('Pairing_Properties', { observation: { allowBlank: true, columnConfig: { - width: 200 + width: 250 }, lookup: { filterArray: [ LABKEY.Filter.create('date_disabled', null, LABKEY.Filter.Types.ISBLANK) ] } - }, - + lowestcage: { + xtype: 'onprc_ehr-pairedidentryfield', + header:'Pair ID', + columnConfig: { + width: 250 + } + }, + other_IDs: { + xtype: 'onprc_ehr-pairedadultsentryfield', + allowBlank: true, + header:'Other IDs', // should display just adults, and not infants + columnConfig: { + width: 200 + } + }, remark2: { - xtype: 'textareafield', - width: 400, - - }, + xtype: 'textareafield', + columnConfig: { + width: 200 + } + }, room: { allowBlank: false, - }, + columnConfig: { + width: 130 + } + }, + cage: { + allowBlank: false, + columnConfig: { + width: 100 + } + }, + housingtype: { + allowBlank: true, + columnConfig: { + width: 180 + } + }, + category: { + allowBlank: false, + columnConfig: { + width: 200 + } + }, + other_infant: { + xtype: 'onprc_ehr-pairedinfantentryfield', + allowBlank: true, + header: 'Other Infant ID', // should display the infant + columnConfig: { + width: 160 + } + }, remark: { - width: 400 - }, - + xtype: 'textareafield', + columnConfig: { + width: 200 + } } + } + } }); \ 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 e7e481bf8..ef99b9f4c 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java @@ -129,7 +129,7 @@ public String getName() @Override public @Nullable Double getSchemaVersion() { - return 24.012; + return 24.013; } @Override diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PairingFormSection.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PairingFormSection.java index 8178240c9..3649a9c8c 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PairingFormSection.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PairingFormSection.java @@ -16,6 +16,7 @@ package org.labkey.onprc_ehr.dataentry; import org.labkey.api.ehr.dataentry.SimpleFormSection; +import org.labkey.api.ehr.dataentry.SimpleGridPanel; import org.labkey.api.view.template.ClientDependency; import java.util.Collections; @@ -25,14 +26,12 @@ * Date: 7/7/13 * Time: 10:36 AM */ -public class PairingFormSection extends SimpleFormSection +public class PairingFormSection extends SimpleGridPanel { public PairingFormSection() { - super("study", "pairings", "Pairing Observations", "ehr-gridpanel"); + super("study", "pairings", "Pairing Observations"); setConfigSources(Collections.singletonList("Task")); - addClientDependency(ClientDependency.supplierFromPath("ehr/form/field/LowestCageField.js")); - addClientDependency(ClientDependency.supplierFromPath("ehr/data/PairingClientStore.js")); - setClientStoreClass("EHR.data.PairingClientStore"); + } } diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PairingFormType.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PairingFormType.java index 735ae7b29..19b877428 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PairingFormType.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PairingFormType.java @@ -50,6 +50,27 @@ public PairingFormType(DataEntryFormContext ctx, Module owner) //Added 6-7-2016 R.Blasa addClientDependency(ClientDependency.supplierFromPath("/onprc_ehr/model/sources/Pairing_Properties.js")); + + + //Added 6-25-2025 R.Blasa + addClientDependency(ClientDependency.supplierFromPath("/onprc_ehr/form/field/PairedInfantEntryField.js")); + + + //Added 6-25-2025 R.Blasa + addClientDependency(ClientDependency.supplierFromPath("/onprc_ehr/form/field/DurationEntryField.js")); + + //Added 7-1-2025 R.Blasa + addClientDependency(ClientDependency.supplierFromPath("/onprc_ehr/form/field/PairedIDEntryField.js")); + + //Added 8-29-2025 R.Blasa + addClientDependency(ClientDependency.supplierFromPath("/onprc_ehr/form/field/PairedAdultsEntryField.js")); + + + + + + + } @Override diff --git a/onprc_ehr/test/src/org/labkey/test/tests/onprc_ehr/AbstractGenericONPRC_EHRTest.java b/onprc_ehr/test/src/org/labkey/test/tests/onprc_ehr/AbstractGenericONPRC_EHRTest.java index 55daedca3..6a72c96f7 100644 --- a/onprc_ehr/test/src/org/labkey/test/tests/onprc_ehr/AbstractGenericONPRC_EHRTest.java +++ b/onprc_ehr/test/src/org/labkey/test/tests/onprc_ehr/AbstractGenericONPRC_EHRTest.java @@ -76,6 +76,7 @@ public abstract class AbstractGenericONPRC_EHRTest extends AbstractGenericEHRTes protected static String[] SUBJECTS = {"12345", "23456", "34567", "45678", "56789"}; protected static String[] ROOMS = {"Room1", "Room2", "Room3"}; protected static String[] CAGES = {"A1", "B2", "A3"}; + protected static String[] CATEGORY = {"Divider Change", "Event", "STP_Beh"}; @Override public List getAssociatedModules() diff --git a/onprc_ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java b/onprc_ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java index f460fb88a..1d547ed76 100644 --- a/onprc_ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java +++ b/onprc_ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java @@ -808,7 +808,7 @@ public void testPairingObservations() throws Exception _helper.goToTaskForm("Pairing Observations"); ensureRoomExists(ROOMS[0]); ensureRoomExists(ROOMS[2]); - + Date today = new Date(); //test whether pairid properly assigned, including when room/cage changed Ext4GridRef grid = _helper.getExt4GridForFormSection("Pairing Observations"); _helper.addRecordToGrid(grid); @@ -816,6 +816,8 @@ public void testPairingObservations() throws Exception grid.setGridCell(1, "lowestcage", "A1"); grid.setGridCell(1, "room", ROOMS[0]); grid.setGridCell(1, "cage", "A1"); + grid.setGridCellJS(1, "date", TIME_FORMAT.format(today)); + grid.setGridCell(1, "category", CATEGORY[0]); _helper.addRecordToGrid(grid); sleep(200); @@ -823,13 +825,9 @@ public void testPairingObservations() throws Exception grid.setGridCell(2, "lowestcage", "A1"); grid.setGridCell(2, "room", ROOMS[0]); grid.setGridCell(2, "cage", "A1"); + grid.setGridCellJS(2, "date", TIME_FORMAT.format(today)); + grid.setGridCell(2, "category", CATEGORY[0]); - Assert.assertEquals(grid.getFieldValue(1, "pairid"), grid.getFieldValue(2, "pairid")); - - //should update pairId - grid.setGridCell(2, "room", ROOMS[2]); - sleep(200); - Assert.assertNotEquals("Pair ID doesn't match, 1: " + grid.getFieldValue(1, "pairid") + ", 2: " + grid.getFieldValue(2, "pairid"), grid.getFieldValue(1, "pairid"), grid.getFieldValue(2, "pairid")); _helper.addRecordToGrid(grid); sleep(200); @@ -837,13 +835,10 @@ public void testPairingObservations() throws Exception grid.setGridCell(3, "lowestcage", "A2"); grid.setGridCell(3, "room", ROOMS[0]); grid.setGridCell(3, "cage", "A2"); - sleep(100); - Assert.assertNotEquals(grid.getFieldValue(1, "pairid"), grid.getFieldValue(3, "pairid")); + grid.setGridCellJS(3, "date", TIME_FORMAT.format(today)); + grid.setGridCell(3, "category", CATEGORY[0]); + - grid.setGridCell(3, "lowestcage", "A1"); - sleep(100); - Assert.assertEquals(grid.getFieldValue(1, "pairid"), grid.getFieldValue(3, "pairid")); - sleep(200); _helper.discardForm(); }