Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 3231151

Browse files
committed
Merge branch 'release/1.5.0'
2 parents 4b904b4 + e923740 commit 3231151

File tree

7 files changed

+34
-10
lines changed

7 files changed

+34
-10
lines changed

js/core/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var config = {
1515
subjectIdZeroPadding: 4,
1616
subjectIdRegex: /^HEP-([0-9]+)$/,
1717
demographicDataset: 'Database_Enrollment',
18-
searchFields: ['ParticipantId', 'NHSNumber', 'MRNNumber', 'FirstName', 'LastName']
18+
searchFields: ['ParticipantId', 'NHSNumber', 'MRNNumber', 'MedWarNum', 'FirstName', 'LastName']
1919
// subjectNameFields: ['FirstName', 'LastName'],
2020
// headlineSubjectInfoFields: ['ParticipantId', 'NHSNumber', 'MRNNumber', 'DOB']
2121
};

js/participantFilter/participantFilter.controller.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ function ParticipantFilterController($modal, $q, $scope, config, CohortService,
2828
self.isParticipantSelected = isParticipantSelected;
2929
self.keyFieldsPercentageComplete = keyFieldsPercentageComplete;
3030

31+
self.searchFields = config.searchFields.slice();
3132
self.openAddParticipantModal = openAddParticipantModal;
3233

3334
self.updateParticipantGroupFilter = updateParticipantGroupFilter;
@@ -66,7 +67,14 @@ function ParticipantFilterController($modal, $q, $scope, config, CohortService,
6667

6768
function selectParticipant(participant) {
6869
self.selectedParticipant = participant;
69-
self.onParticipantSelect({participantId: participant[config.subjectNoun]});
70+
var subjectKey = config.subjectNoun;
71+
72+
// lower-case the first character, because LabKey's expecting it that way
73+
subjectKey = subjectKey[0].toLowerCase() + subjectKey.substr(1);
74+
75+
var payload = {};
76+
payload[subjectKey] = participant[config.subjectNoun];
77+
self.onParticipantSelect(payload);
7078
}
7179

7280
function isParticipantSelected(participant){
@@ -76,7 +84,7 @@ function ParticipantFilterController($modal, $q, $scope, config, CohortService,
7684
function filterParticipants(){
7785
self.filteredParticipants = self.allParticipants.filter(function(candidateParticipant) {
7886
return self.selectedCohorts[candidateParticipant.Cohort]
79-
&& _.contains(self.groupFilterParticipantIDs, candidateParticipant.ParticipantId);
87+
&& _.includes(self.groupFilterParticipantIDs, candidateParticipant.ParticipantId);
8088
});
8189
}
8290

js/participantFilter/participantFilter.directive.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ <h4>
4141
<div class="form-inline">
4242
<div class="form-group has-feedback">
4343
<label for="labking-participant-search">Search</label>
44-
<input type="search" class="form-control" id="labking-participant-search" placeholder="NHS #, MRN or name" autofocus ng-model="vm.participantSearchText">
44+
<input type="search" class="form-control" id="labking-participant-search" placeholder="{{vm.searchFields.join(', ')}}" autofocus ng-model="vm.participantSearchText">
4545
<a ng-show="vm.participantSearchText" ng-click="vm.clearSearch()" class="text-muted">
4646
<span class="fa fa-remove form-control-feedback"></span>
4747
</a>

js/participantFilter/participantRecord.directive.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ <h3 class="nav-header">Dataset:</h3>
3232
ng-class="{active: vm.selectedDataSet == dataSet}"
3333
ng-repeat="dataSet in vm.selectedCategory">
3434
<a aria-controls="home" role="tab"
35-
ng-bind="dataSet.Label"
36-
ng-click="vm.selectDataSet(dataSet)"></a>
35+
ng-click="vm.selectDataSet(dataSet)">
36+
{{dataSet.Label}}
37+
<span class="badge">{{vm.getRecordCount(dataSet.Name)}}</span>
38+
</a>
3739
</li>
3840
</ul>
3941

js/participantFilter/participantRecord.directive.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ function ParticipantRecord(config, ParticipantService, DatasetMetadataService) {
2525
self.getParticipantName = getParticipantName;
2626
self.selectCategory = selectCategory;
2727
self.selectDataSet = selectDataSet;
28+
self.getRecordCount = getRecordCount;
2829

2930
DatasetMetadataService.getMetaData().then(function(metadata) {
3031

@@ -55,6 +56,19 @@ function ParticipantRecord(config, ParticipantService, DatasetMetadataService) {
5556
selectDataSet(self.selectedCategory[0]);
5657
}
5758

59+
/**
60+
* Gets the number of rows in a dataset for the currently selected user.
61+
* @param {String} datasetName The name of the dataset. NOT the dataset object.
62+
* @return {Number} The count of rows in the dataset with the passed name, for the currently selected participant.
63+
*/
64+
function getRecordCount (datasetName) {
65+
if(self.participant !== undefined && self.participant.dataSets[datasetName] !== undefined){
66+
return self.participant.dataSets[datasetName].rows.length;
67+
}else{
68+
return 0;
69+
}
70+
}
71+
5872
function selectDataSet(dataSet) {
5973
self.selectedDataSet = dataSet;
6074
}

js/participantGroups/participantGroups.service.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ exports.service = ParticipantGroupsService;
55

66

77
/** @ngInject **/
8-
function ParticipantGroupsService($q, logger) {
8+
function ParticipantGroupsService($q, logger, config) {
99
var LabKeyAPI = require('../lib/LabKeyAPI'),
1010
_ = require('lodash');
1111

@@ -63,7 +63,7 @@ function ParticipantGroupsService($q, logger) {
6363
var categoryLabel = participantGroupMapping['GroupId/CategoryId/Label'];
6464
var groupId = participantGroupMapping.GroupId;
6565
var groupLabel = participantGroupMapping['GroupId/Label'];
66-
var participantId = participantGroupMapping.ParticipantId;
66+
var participantId = participantGroupMapping[config.subjectNoun];
6767

6868
// Create participant group category if it doesn't exist
6969
if(participantGroupCategories[categoryId] === undefined){

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "labking",
3-
"version": "1.4.0",
3+
"version": "1.5.0",
44
"description": "A LabKey module to allow creation and editing of Study module datasets in a subject-centric way",
55
"main": "js/labking.module.js",
66
"scripts": {
@@ -61,7 +61,7 @@
6161
},
6262
"homepage": "https://github.com/spikeheap/labkey-labking",
6363
"devDependencies": {
64-
"babel-eslint": "^3.1.23",
64+
"babel-eslint": "4.1.7",
6565
"babelify": "^5.0.4",
6666
"bower": "^1.4.1",
6767
"browserify": "^9.0.3",

0 commit comments

Comments
 (0)