Skip to content

Commit 1ab4635

Browse files
committed
Merge discvr-26.7 to develop
2 parents ace3b33 + 8f0e159 commit 1ab4635

24 files changed

Lines changed: 3710 additions & 7819 deletions

File tree

GenotypeAssays/src/org/labkey/genotypeassays/GenotypeAssaysController.java

Lines changed: 15 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,15 @@
2020
import org.json.JSONArray;
2121
import org.labkey.api.action.ApiResponse;
2222
import org.labkey.api.action.ApiSimpleResponse;
23-
import org.labkey.api.action.ConfirmAction;
2423
import org.labkey.api.action.MutatingApiAction;
2524
import org.labkey.api.action.SpringActionController;
26-
import org.labkey.api.data.DbSchema;
27-
import org.labkey.api.data.DbSchemaType;
28-
import org.labkey.api.data.SqlExecutor;
29-
import org.labkey.api.data.TableInfo;
25+
import org.labkey.api.data.ContainerType;
3026
import org.labkey.api.exp.api.ExpProtocol;
3127
import org.labkey.api.exp.api.ExperimentService;
3228
import org.labkey.api.security.RequiresPermission;
33-
import org.labkey.api.security.permissions.ReadPermission;
3429
import org.labkey.api.security.permissions.UpdatePermission;
35-
import org.labkey.api.util.HtmlString;
3630
import org.labkey.api.util.Pair;
37-
import org.labkey.api.util.URLHelper;
38-
import org.labkey.api.view.HtmlView;
3931
import org.springframework.validation.BindException;
40-
import org.springframework.validation.Errors;
41-
import org.springframework.web.servlet.ModelAndView;
4232

4333
import java.util.Arrays;
4434
import java.util.HashMap;
@@ -54,66 +44,6 @@ public GenotypeAssaysController()
5444
setActionResolver(_actionResolver);
5545
}
5646

57-
@RequiresPermission(ReadPermission.class)
58-
public static class MigrateLegacySSPAction extends ConfirmAction<Object>
59-
{
60-
@Override
61-
public void validateCommand(Object form, Errors errors)
62-
{
63-
64-
}
65-
66-
@Override
67-
public ModelAndView getConfirmView(Object form, BindException errors) throws Exception
68-
{
69-
DbSchema schema = DbSchema.get("SSP_Assay", DbSchemaType.Module);
70-
if (schema == null)
71-
return new HtmlView(HtmlString.of("Either the legacy SSP module has not been installed, or it has already been removed"));
72-
else
73-
return new HtmlView(HtmlString.of("This allows an admin to copy any primers stored in the original SSP Assay module into the new genotyping module. Any data has already been copied. Do you want to continue?"));
74-
}
75-
76-
@Override
77-
public boolean handlePost(Object form, BindException errors) throws Exception
78-
{
79-
try
80-
{
81-
DbSchema schema = DbSchema.get("SSP_Assay", DbSchemaType.Module);
82-
if (schema == null)
83-
return true; //module not installed
84-
85-
TableInfo primers = schema.getTable("primers");
86-
if (primers == null)
87-
return true;
88-
89-
SqlExecutor sql = new SqlExecutor(schema);
90-
91-
sql.execute("INSERT INTO genotypeassays.primer_pairs (primerName, ref_nt_name, ref_nt_id, shortName, forwardPrimer, reversePrimer, createdBy, created, modifiedby, modified) " +
92-
"SELECT s.primerName, s.ref_nt_name, s.ref_nt_id, s.shortName, s.forwardPrimer, s.reversePrimer, s.createdBy, s.created, s.modifiedby, s.modified " +
93-
"FROM ssp_assay.primers s " +
94-
"LEFT JOIN genotypeassays.primer_pairs p ON (p.primerName = s.primerName) " +
95-
"WHERE p.primerName is null");
96-
97-
sql.execute("DROP TABLE ssp_assay.primers");
98-
sql.execute("DROP TABLE ssp_assay.ssp_result_types");
99-
sql.execute("DROP SCHEMA ssp_assay");
100-
101-
return true;
102-
}
103-
catch (Exception e)
104-
{
105-
errors.reject(ERROR_MSG, e.getMessage());
106-
return false;
107-
}
108-
}
109-
110-
@Override
111-
public URLHelper getSuccessURL(Object form)
112-
{
113-
return getContainer().getStartURL(getUser());
114-
}
115-
}
116-
11747
@RequiresPermission(UpdatePermission.class)
11848
public static class CacheAnalysesAction extends MutatingApiAction<CacheAnalysesForm>
11949
{
@@ -134,6 +64,13 @@ public ApiResponse execute(CacheAnalysesForm form, BindException errors)
13464
return null;
13565
}
13666

67+
if (!protocol.getContainer().getContainerFor(ContainerType.DataType.tabParent).equals(getContainer().getContainerFor(ContainerType.DataType.tabParent)))
68+
{
69+
errors.reject(ERROR_MSG, "Protocol is from the wrong container: " + form.getProtocolId());
70+
logger.error("CacheAnalysesAction targeted a protocol from the wrong container: {}, from {}, in the container: {}", form.getProtocolId(), protocol.getContainer().getPath(), getContainer().getPath());
71+
return null;
72+
}
73+
13774
String[] alleleNames = Arrays.stream(form.getAlleleNames()).map(StringEscapeUtils::unescapeHtml4).toArray(String[]::new);
13875
Pair<List<Long>, List<Long>> ret = GenotypeAssaysManager.get().cacheAnalyses(getViewContext(), protocol, alleleNames);
13976
resultProperties.put("runsCreated", ret.first);
@@ -214,6 +151,13 @@ public ApiResponse execute(CacheAnalysesForm form, BindException errors)
214151
return null;
215152
}
216153

154+
if (!protocol.getContainer().getContainerFor(ContainerType.DataType.tabParent).equals(getContainer().getContainerFor(ContainerType.DataType.tabParent)))
155+
{
156+
errors.reject(ERROR_MSG, "Protocol is from the wrong container: " + form.getProtocolId());
157+
logger.error("CacheHaplotypesAction targeted a protocol from the wrong container: {}, from {}, in the container: {}", form.getProtocolId(), protocol.getContainer().getPath(), getContainer().getPath());
158+
return null;
159+
}
160+
217161
Pair<List<Long>, List<Long>> ret = GenotypeAssaysManager.get().cacheHaplotypes(getViewContext(), protocol, new JSONArray(form.getJson()));
218162
resultProperties.put("runsCreated", ret.first);
219163
resultProperties.put("runsDeleted", ret.second);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
value category
2+
Born Dead/Not Born false
3+
Live Birth true
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
value
2+
Estimated
3+
Actual
4+
Undetermined

PMR/resources/data/lookup_sets.tsv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ behavior_types Behavior Types value
5353
fecal_smear_score Fecal Smear Scores value
5454
problem_list_subcategory Problem List Subcategory value
5555
customer_affiliation Customer Affiliation value
56+
birth_condition_raw Birth Condition Field Values value value
5657
birth_date_type Birth Date Type value
5758
birth_type Birth Type Field Values value
5859
chemistry_method Chemistry Method Field Values value

PMR/resources/etls/prime-birth.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
</transform>
5454
</transforms>
5555
<incrementalFilter timestampColumnName="modified" pkColumnName="objectid" className="ModifiedSinceFilterStrategy" >
56-
<deletedRowsSource remoteSource="EHR_ClinicalSource" schemaName="AuditSummary" queryName="DatasetUpdateAuditLog" timestampColumnName="Created" deletedSourceKeyColumnName="primaryKey" targetKeyColumnName="objectid">
56+
<deletedRowsSource remoteSource="EHR_ClinicalSource" schemaName="AuditSummary" queryName="DatasetUpdateAuditLog" timestampColumnName="Created" deletedSourceKeyColumnName="primaryKey" targetKeyColumnName="Id">
5757
<sourceFilters>
5858
<sourceFilter column="datasetid/Name" operator="eq" value="birth" />
5959
<sourceFilter column="Comment" operator="contains" value="Delete"/>

PMR/resources/etls/prime-demographics.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
</transform>
4949
</transforms>
5050
<incrementalFilter timestampColumnName="modified" pkColumnName="objectid" className="ModifiedSinceFilterStrategy" >
51-
<deletedRowsSource remoteSource="EHR_ClinicalSource" schemaName="AuditSummary" queryName="DatasetUpdateAuditLog" timestampColumnName="Created" deletedSourceKeyColumnName="primaryKey" targetKeyColumnName="objectid">
51+
<deletedRowsSource remoteSource="EHR_ClinicalSource" schemaName="AuditSummary" queryName="DatasetUpdateAuditLog" timestampColumnName="Created" deletedSourceKeyColumnName="primaryKey" targetKeyColumnName="Id">
5252
<sourceFilters>
5353
<sourceFilter column="datasetid/Name" operator="eq" value="demographics" />
5454
<sourceFilter column="Comment" operator="contains" value="Delete"/>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
-- This is a workaround to allow the lookup_sets system to provide an additional field beyond value/title:
2+
SELECT
3+
value,
4+
CASE
5+
WHEN category = 'true' THEN true
6+
WHEN category = 'false' THEN false
7+
ELSE true
8+
END as alive
9+
10+
FROM ehr_lookups.birth_condition_raw
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<query xmlns="http://labkey.org/data/xml/query">
2+
<metadata>
3+
<tables xmlns="http://labkey.org/data/xml">
4+
<table tableName="" tableDbType="NOT_IN_DB">
5+
<columns>
6+
<column columnName="birth_condition">
7+
<fk>
8+
<fkDbSchema>ehr_lookups</fkDbSchema>
9+
<fkTable>birth_condition</fkTable>
10+
<fkColumnName>value</fkColumnName>
11+
</fk>
12+
</column>
13+
14+
</columns>
15+
</table>
16+
</tables>
17+
</metadata>
18+
</query>

PMR/resources/views/populateData.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,20 @@
236236
schemaName: 'ehr_lookups',
237237
queryName: 'geographic_origins',
238238
pk: 'rowid'
239+
},{
240+
label: 'Birth Condition Raw',
241+
populateFn: 'populateFromFile',
242+
moduleName: 'pmr',
243+
schemaName: 'ehr_lookups',
244+
queryName: 'birth_condition_raw',
245+
pk: 'rowid'
246+
},{
247+
label: 'Birth Date Type',
248+
populateFn: 'populateFromFile',
249+
moduleName: 'pmr',
250+
schemaName: 'ehr_lookups',
251+
queryName: 'birth_date_type',
252+
pk: 'rowid'
239253
},{
240254
label: 'Birth Type',
241255
populateFn: 'populateFromFile',

hivrc/src/org/labkey/hivrc/view/analysisHeader.jsp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<%@ page import="org.apache.commons.lang3.StringUtils" %>
1+
<%@ page import="org.json.JSONArray" %>
2+
<%@ page import="org.labkey.api.util.JavaScriptFragment" %>
23
<%@ page import="org.labkey.api.view.HttpView" %>
34
<%@ page import="org.labkey.api.view.JspView" %>
45
<%@ page import="org.labkey.api.view.template.ClientDependencies" %>
56
<%@ page import="org.labkey.hivrc.query.AnalysisModel" %>
6-
<%@ page import="java.util.Arrays" %>
77
<%@ page extends="org.labkey.api.jsp.JspBase" %>
88
<%!
99
@Override
@@ -53,7 +53,7 @@
5353
materials: <%=q(model.getMaterials())%>,
5454
methods: <%=q(model.getMethods())%>,
5555
results: <%=q(model.getResults())%>,
56-
tags: <%=unsafe(model.getTags() == null || model.getTags().length == 0 ? "null" : "['" + unsafe(StringUtils.join(Arrays.asList(model.getTags()), "','")) + "']")%>
56+
tags: <% if (model.getTags() == null || model.getTags().length == 0) { %><%=JavaScriptFragment.NULL%><% } else { %><%=new JSONArray(model.getTags())%><% } %>
5757
}).render(webpartId);
5858
5959
if (LABKEY.Security.currentUser.canInsert) {

0 commit comments

Comments
 (0)