Skip to content

Commit 2151510

Browse files
authored
Added MHC Data Pivot report (#451)
* Added pivot query for MHC data * added MHC Pivot to Browse All Data * tweaked metadata
1 parent bed79b6 commit 2151510

3 files changed

Lines changed: 57 additions & 0 deletions

File tree

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

0 commit comments

Comments
 (0)