Skip to content

Commit 3dfbbe3

Browse files
committed
Improve MCC validation and remove some elements from snapshot panel
1 parent 7624022 commit 3dfbbe3

File tree

4 files changed

+145
-2
lines changed

4 files changed

+145
-2
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
EHR.reports.clinicalHistoryPanelXtype = 'mcc-snapshotpanel';
2+
3+
Ext4.define('MCC.panel.SnapshotPanel', {
4+
extend: 'EHR.panel.SnapshotPanel',
5+
alias: 'widget.mcc-snapshotpanel',
6+
7+
showLocationDuration: false,
8+
9+
minWidth: 800,
10+
11+
initComponent: function () {
12+
13+
this.defaultLabelWidth = 120;
14+
this.callParent();
15+
},
16+
17+
getBaseItems: function(){
18+
return [{
19+
xtype: 'container',
20+
border: false,
21+
defaults: {
22+
border: false
23+
},
24+
items: [{
25+
xtype: 'container',
26+
html: '<b>Summary:</b><hr>'
27+
},{
28+
bodyStyle: 'padding-bottom: 20px;',
29+
layout: 'column',
30+
defaults: {
31+
border: false
32+
},
33+
items: [{
34+
xtype: 'container',
35+
columnWidth: 0.25,
36+
defaults: {
37+
labelWidth: this.defaultLabelWidth,
38+
style: 'margin-right: 20px;'
39+
},
40+
items: [{
41+
xtype: 'displayfield',
42+
fieldLabel: 'Status',
43+
name: 'calculated_status'
44+
},{
45+
xtype: 'displayfield',
46+
fieldLabel: 'Gender',
47+
name: 'gender'
48+
},{
49+
xtype: 'displayfield',
50+
fieldLabel: 'Species',
51+
name: 'species'
52+
}]
53+
},{
54+
xtype: 'container',
55+
columnWidth: 0.25,
56+
defaults: {
57+
labelWidth: this.defaultLabelWidth,
58+
style: 'margin-right: 20px;'
59+
},
60+
items: [{
61+
xtype: 'displayfield',
62+
fieldLabel: 'Age',
63+
name: 'age'
64+
}, {
65+
xtype: 'displayfield',
66+
fieldLabel: 'Source',
67+
name: 'source'
68+
},{
69+
xtype: 'displayfield',
70+
fieldLabel: 'Weights',
71+
name: 'weights'
72+
}]
73+
}]
74+
}]
75+
}];
76+
}
77+
});

mcc/resources/web/mcc/panel/MccImportPanel.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ Ext4.define('MCC.panel.MccImportPanel', {
131131
expectInImport: true
132132
},{
133133
name: 'availability',
134-
labels: ['Available to Transfer', 'available to transfer'],
134+
// NOTE: availalble was a typo in one generation of the input templates:
135+
labels: ['Available to Transfer', 'available to transfer', 'availalble to transfer'],
135136
allowRowSpan: false,
136137
allowBlank: true,
137138
transform: 'available',
@@ -348,6 +349,14 @@ Ext4.define('MCC.panel.MccImportPanel', {
348349
row.errors.push('Suspicious weight value');
349350
}
350351

352+
return val;
353+
},
354+
355+
alternateIds: function(val) {
356+
if (val) {
357+
val = val.split(/[ ]*[;,]+[ ]*/g).join(',')
358+
}
359+
351360
return val;
352361
}
353362
},
@@ -520,18 +529,26 @@ Ext4.define('MCC.panel.MccImportPanel', {
520529
else {
521530
row.objectId = existingRecord.objectid;
522531

523-
var fields = ['birth', 'dam', 'sire', 'source', 'alternateIds'];
532+
var fields = ['birth', 'dam', 'sire', 'source'];
524533
for (var idx in fields) {
525534
var fn = fields[idx];
526535

527536
// kind of a hack:
528537
if (fn === 'birth' && existingRecord[fn]) {
529538
existingRecord[fn] = Ext4.Date.format(LDK.ConvertUtils.parseDate(existingRecord[fn]), 'Y-m-d');
530539
}
540+
531541
if (row[fn] && existingRecord[fn] && row[fn] !== existingRecord[fn]) {
532542
row.errors.push('Does not match existing row for ' + fn + ': ' + existingRecord[fn]);
533543
}
534544
}
545+
546+
// The goal of this is to take the union of the existing/new aliases:
547+
if (row.alternateIds && existingRecord.alternateIds) {
548+
row.alternateIds = row.alternateIds.split(/[ ]*[;,]+[ ]*/g)
549+
existingRecord.alternateIds = existingRecord.alternateIds.split(/[ ]*[;,]+[ ]*/g)
550+
row.alternateIds = Ext4.unique(row.alternateIds.concat(existingRecord.alternateIds)).sort().join(',')
551+
}
535552
}
536553

537554
if (existingRecord['Id/death/date']) {

mcc/src/org/labkey/mcc/MccModule.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
import org.labkey.api.security.roles.RoleManager;
3232
import org.labkey.api.util.SystemMaintenance;
3333
import org.labkey.api.view.WebPartFactory;
34+
import org.labkey.api.view.template.ClientDependency;
3435
import org.labkey.api.writer.ContainerUser;
36+
import org.labkey.mcc.ehr.NoOpClinicalHistorySource;
3537
import org.labkey.mcc.query.MarkShippedButton;
3638
import org.labkey.mcc.query.MccEhrCustomizer;
3739
import org.labkey.mcc.query.RenameIdButton;
@@ -125,6 +127,9 @@ private void registerEHRResources()
125127
EHRService.get().registerMoreActionsButton(new MarkShippedButton(), "study", "demographics");
126128
EHRService.get().registerMoreActionsButton(new RenameIdButton(), "study", "demographics");
127129
LDKService.get().registerQueryButton(new ShowEditUIButton(this, MccSchema.NAME, MccSchema.TABLE_CENSUS), MccSchema.NAME, MccSchema.TABLE_CENSUS);
130+
131+
EHRService.get().registerHistoryDataSource(new NoOpClinicalHistorySource("Case Opened"));
132+
EHRService.get().registerClientDependency(ClientDependency.supplierFromPath("mcc/panel/MccClinicalSnapshotPanel.js"), this);
128133
}
129134

130135
@Override
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package org.labkey.mcc.ehr;
2+
3+
import org.jetbrains.annotations.NotNull;
4+
import org.labkey.api.data.Container;
5+
import org.labkey.api.data.Results;
6+
import org.labkey.api.data.TableInfo;
7+
import org.labkey.api.ehr.history.AbstractDataSource;
8+
import org.labkey.api.ehr.history.HistoryRow;
9+
import org.labkey.api.module.ModuleLoader;
10+
import org.labkey.api.security.User;
11+
import org.labkey.mcc.MccModule;
12+
13+
import java.sql.SQLException;
14+
import java.util.Collections;
15+
import java.util.Date;
16+
import java.util.List;
17+
18+
public class NoOpClinicalHistorySource extends AbstractDataSource
19+
{
20+
public NoOpClinicalHistorySource(String categoryText)
21+
{
22+
super(null, null, categoryText, ModuleLoader.getInstance().getModule(MccModule.class));
23+
24+
}
25+
26+
@Override
27+
protected TableInfo getTableInfo(Container c, User u)
28+
{
29+
throw new UnsupportedOperationException("This should never be called");
30+
}
31+
32+
@Override
33+
@NotNull
34+
public List<HistoryRow> getRows(Container c, User u, final String subjectId, Date minDate, Date maxDate, boolean redacted)
35+
{
36+
return Collections.emptyList();
37+
}
38+
39+
@Override
40+
protected String getHtml(Container c, Results rs, boolean redacted) throws SQLException
41+
{
42+
return null;
43+
}
44+
}

0 commit comments

Comments
 (0)