forked from bimberlabinternal/LabDevKitModules
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #191 from LabKey/fb_merge_23.11_to_develop
Merge discvr-23.11 to develop
- Loading branch information
Showing
10 changed files
with
259 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
laboratory/api-src/org/labkey/api/laboratory/DemographicsProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package org.labkey.api.laboratory; | ||
|
||
import org.jetbrains.annotations.Nullable; | ||
import org.labkey.api.data.Container; | ||
import org.labkey.api.module.Module; | ||
import org.labkey.api.security.User; | ||
|
||
|
||
public class DemographicsProvider | ||
{ | ||
private final Module _owningModule; | ||
private final String _schemaName; | ||
private final String _queryName; | ||
private final String _subjectField; | ||
|
||
public DemographicsProvider(Module owningModule, String schemaName, String queryName, String subjectField) | ||
{ | ||
_owningModule = owningModule; | ||
_schemaName = schemaName; | ||
_queryName = queryName; | ||
_subjectField = subjectField; | ||
} | ||
|
||
public String getSchema() | ||
{ | ||
return _schemaName; | ||
} | ||
|
||
public String getQuery() | ||
{ | ||
return _queryName; | ||
} | ||
|
||
public String getSubjectField() | ||
{ | ||
return _subjectField; | ||
} | ||
|
||
public @Nullable String getMotherField() | ||
{ | ||
return null; | ||
} | ||
|
||
public @Nullable String getFatherField() | ||
{ | ||
return null; | ||
} | ||
|
||
public @Nullable String getSexField() | ||
{ | ||
return null; | ||
} | ||
|
||
public boolean isAvailable(Container c, User u) | ||
{ | ||
return c.getActiveModules().contains(_owningModule); | ||
} | ||
|
||
public String getLabel() | ||
{ | ||
return getSchema() + "." + getQuery(); | ||
} | ||
|
||
public boolean isValidForPedigree() | ||
{ | ||
return getMotherField() != null && getFatherField() != null && getSexField() != null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
laboratory/resources/web/laboratory/field/PedigreeSelectorField.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
Ext4.define('Laboratory.field.PedigreeSelectorField', { | ||
extend: 'LABKEY.ext4.ComboBox', | ||
alias: 'widget.laboratory-pedigreeselectorfield', | ||
|
||
forceSelection: true, | ||
typeAhead: true, | ||
queryMode: 'local', | ||
triggerAction: 'all', | ||
|
||
initComponent: function(){ | ||
Ext4.apply(this, { | ||
displayField: 'value', | ||
valueField: 'value', | ||
store: { | ||
type: 'array', | ||
fields: ['value'] | ||
} | ||
}); | ||
|
||
this.callParent(arguments); | ||
|
||
this.loadData(); | ||
}, | ||
|
||
loadData: function(){ | ||
LABKEY.Ajax.request({ | ||
url: LABKEY.ActionURL.buildURL('laboratory', 'getDemographicsProviders', Laboratory.Utils.getQueryContainerPath()), | ||
method : 'POST', | ||
scope: this, | ||
failure: LDK.Utils.getErrorCallback(), | ||
success: LABKEY.Utils.getCallbackWrapper(function(response){ | ||
console.log(response); | ||
Ext4.Array.forEach(response.providers, function(d){ | ||
if (d.isValidForPedigree) { | ||
this.store.add(this.store.createModel({value: d.label})); | ||
} | ||
}, this); | ||
}, this) | ||
}); | ||
}, | ||
|
||
getToolParameterValue : function(){ | ||
return this.getSubmitValue(); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
laboratory/src/org/labkey/laboratory/query/LaboratoryDemographicsProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.labkey.laboratory.query; | ||
|
||
import org.jetbrains.annotations.Nullable; | ||
import org.labkey.api.laboratory.DemographicsProvider; | ||
import org.labkey.api.module.ModuleLoader; | ||
import org.labkey.laboratory.LaboratoryModule; | ||
import org.labkey.laboratory.LaboratorySchema; | ||
|
||
public class LaboratoryDemographicsProvider extends DemographicsProvider | ||
{ | ||
public LaboratoryDemographicsProvider() | ||
{ | ||
super(ModuleLoader.getInstance().getModule(LaboratoryModule.class), LaboratoryModule.SCHEMA_NAME, LaboratorySchema.TABLE_SUBJECTS, "subjectname"); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public String getMotherField() | ||
{ | ||
return "mother"; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public String getFatherField() | ||
{ | ||
return "father"; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public String getSexField() | ||
{ | ||
return "gender"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters