Skip to content

Commit c8260e3

Browse files
Merge 22.3 to develop
2 parents 6147ef6 + 2151510 commit c8260e3

6 files changed

Lines changed: 86 additions & 3 deletions

File tree

snprc_ehr/resources/queries/snprc_ehr/MhcData.query.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@
88
<updateUrl />
99
<deleteUrl />
1010
<columns>
11-
<column columnName="Id"/>
11+
<column columnName="Id">
12+
<fk>
13+
<fkDbSchema>study</fkDbSchema>
14+
<fkTable>Animal</fkTable>
15+
<fkColumnName>Id</fkColumnName>
16+
</fk>
17+
</column>
1218
<column columnName="OcId">
1319
<columnTitle>OC ID</columnTitle>
1420
<isHidden>true</isHidden>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<customView xmlns="http://labkey.org/data/xml/queryCustomView">
2+
<columns>
3+
<column name="Id"/>
4+
<column name="MHCValue"/>
5+
<column name="Haplotype"/>
6+
<column name="DataFileSource"/>
7+
<column name="OcId"/>
8+
<column name="Modified"/>
9+
<column name="id/parents/dam"/>
10+
<column name="id/parents/sire"/>
11+
<column name="id/age/birth"/>
12+
<column name="Id/age/ageInYears"/>
13+
<column name="Id/AgeClass/Label"/>
14+
<column name="Id/ActiveGroups/Colony::animal_group.Category"/>
15+
</columns>
16+
<sorts>
17+
<sort column="Id"/>
18+
<sort column="Haplotype" />
19+
</sorts>
20+
</customView>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<query xmlns="http://labkey.org/data/xml/query">
2+
<metadata>
3+
<tables xmlns="http://labkey.org/data/xml">
4+
<table tableName="MhcDataPivot" tableDbType="NOT_IN_DB" useColumnOrder="true">
5+
<tableUrl />
6+
<insertUrl />
7+
<importUrl />
8+
<updateUrl />
9+
<deleteUrl />
10+
<columns>
11+
<column columnName="Id">
12+
<fk>
13+
<fkDbSchema>study</fkDbSchema>
14+
<fkTable>Animal</fkTable>
15+
<fkColumnName>Id</fkColumnName>
16+
</fk>
17+
</column>
18+
<column columnName="OcId">
19+
<columnTitle>OC ID</columnTitle>
20+
<isHidden>true</isHidden>
21+
</column>
22+
<column columnName="DataFileSource">
23+
<columnTitle>Data File Source</columnTitle>
24+
<isHidden>true</isHidden>
25+
</column>
26+
</columns>
27+
</table>
28+
</tables>
29+
</metadata>
30+
</query>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
SELECT
2+
b.Id,
3+
b.Haplotype,
4+
b.Ocid,
5+
b.DataFileSource,
6+
b.modified,
7+
group_concat(b.MhcValue) as MhcValue
8+
9+
FROM (
10+
SELECT
11+
b.Id,
12+
b.Haplotype,
13+
b.Ocid,
14+
b.MhcValue,
15+
b.DataFileSource,
16+
b.Modified
17+
FROM snprc_ehr.MhcData as b
18+
) as b
19+
20+
GROUP BY b.id, b.ocid, b.DataFileSource, b.haplotype, b.modified
21+
22+
PIVOT MhcValue BY Haplotype IN
23+
(select distinct Haplotype from snprc_ehr.MhcData order by Haplotype
24+
25+
)

snprc_ehr/resources/queries/study/BrowseDataSets.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ select 'study' as schema, 'Colony Management' as CategoryId,'Animal Accounts & G
4545
UNION
4646
select 'snprc_ehr' as schema, 'Misc' as CategoryId,'MHC Data' as Label, 'MhcData' as Name, true as ShowByDefault, true as isAnimal
4747
UNION
48+
select 'snprc_ehr' as schema, 'Misc' as CategoryId,'MHC Pivot' as Label, 'MhcDataPivot' as Name, true as ShowByDefault, true as isAnimal
49+
UNION
4850
select 'study' as schema, 'Clinical' as CategoryId,'Daily Observations' as Label, 'DailyObs' as Name, true as ShowByDefault, true as isAnimal
4951
UNION
5052
select 'study' as schema, 'Clinical' as CategoryId,'Daily Cycles' as Label, 'CycleDaily' as Name, true as ShowByDefault, true as isAnimal

snprc_ehr/resources/source_queries/create_v_MhcData.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ ALTER VIEW [labkey_etl].[V_MhcData] AS
2828
-- Create date: 5/16/2017
2929
-- Description:
3030
-- Changes:
31-
--
31+
-- 05/18/2022 removed leading spaces from animal id
3232
--
3333
-- ==========================================================================================
3434

3535
SELECT
36-
RIGHT(SPACE(6) + u.[Animal ID], 6) AS Id,
36+
u.[Animal ID] AS Id,
3737
u.[File Source] AS DataFileSource,
3838
u.[OC ID] AS OcId,
3939
u.Haplotype AS Haplotype,

0 commit comments

Comments
 (0)