-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bhima data collector #3864
Bhima data collector #3864
Conversation
client/src/js/services/color.js
Outdated
{ name : 'violet', value : '#EE82EE'}, | ||
{ name : 'wheat', value : '#F5DEB3'}, | ||
{ name : 'white', value : '#FFFFFF'}, | ||
{ name : 'whitesmoke', value : '#F5F5F5'}]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required before '}' object-curly-spacing
client/src/js/services/color.js
Outdated
{ name : 'turquoise', value : '#40E0D0'}, | ||
{ name : 'violet', value : '#EE82EE'}, | ||
{ name : 'wheat', value : '#F5DEB3'}, | ||
{ name : 'white', value : '#FFFFFF'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required before '}' object-curly-spacing
client/src/js/services/color.js
Outdated
{ name : 'tomato', value : '#FF6347'}, | ||
{ name : 'turquoise', value : '#40E0D0'}, | ||
{ name : 'violet', value : '#EE82EE'}, | ||
{ name : 'wheat', value : '#F5DEB3'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required before '}' object-curly-spacing
client/src/js/services/color.js
Outdated
{ name : 'thistle', value : '#D8BFD8'}, | ||
{ name : 'tomato', value : '#FF6347'}, | ||
{ name : 'turquoise', value : '#40E0D0'}, | ||
{ name : 'violet', value : '#EE82EE'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required before '}' object-curly-spacing
client/src/js/services/color.js
Outdated
{ name : 'teal', value : '#008080'}, | ||
{ name : 'thistle', value : '#D8BFD8'}, | ||
{ name : 'tomato', value : '#FF6347'}, | ||
{ name : 'turquoise', value : '#40E0D0'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required before '}' object-curly-spacing
client/src/js/services/color.js
Outdated
{ name : 'silver', value : '#C0C0C0'}, | ||
{ name : 'skyblue', value : '#87CEEB'}, | ||
{ name : 'slategray', value : '#708090'}, | ||
{ name : 'snow', value : '#FFFAFA'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required before '}' object-curly-spacing
client/src/js/services/color.js
Outdated
{ name : 'sienna', value : '#A0522D'}, | ||
{ name : 'silver', value : '#C0C0C0'}, | ||
{ name : 'skyblue', value : '#87CEEB'}, | ||
{ name : 'slategray', value : '#708090'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required before '}' object-curly-spacing
client/src/js/services/color.js
Outdated
{ name : 'seashell', value : '#FFF5EE'}, | ||
{ name : 'sienna', value : '#A0522D'}, | ||
{ name : 'silver', value : '#C0C0C0'}, | ||
{ name : 'skyblue', value : '#87CEEB'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required before '}' object-curly-spacing
client/src/js/services/color.js
Outdated
{ name : 'seagreen', value : '#2E8B57'}, | ||
{ name : 'seashell', value : '#FFF5EE'}, | ||
{ name : 'sienna', value : '#A0522D'}, | ||
{ name : 'silver', value : '#C0C0C0'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required before '}' object-curly-spacing
client/src/js/services/color.js
Outdated
{ name : 'sandybrown', value : '#F4A460'}, | ||
{ name : 'seagreen', value : '#2E8B57'}, | ||
{ name : 'seashell', value : '#FFF5EE'}, | ||
{ name : 'sienna', value : '#A0522D'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required before '}' object-curly-spacing
test/integration/surveyForm.js
Outdated
'id', 'is_list', 'label', 'labelType', 'name', 'other_choice', 'required', | ||
'type', 'typeForm', 'typeLabel', 'version_number', 'calculation', 'choiceListLabel', | ||
'choice_list_id', 'color', 'constraint', 'data_collector_label', 'data_collector_management_id', | ||
'default', 'description', 'filterLabel', 'filter_choice_list_id', 'hint', 'rank'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected newline before ')' function-paren-newline
*/ | ||
|
||
/* loading grid actions */ | ||
const GridRow = require('../shared/GridRow'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'GridRow' is assigned a value but never used no-unused-vars
|
||
formula = formula.replace(/.{/g, 'data.'); | ||
formula = formula.replace(/}/g, ''); | ||
const calculation = util.roundDecimal(eval(formula), 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eval can be harmful no-eval
.done(); | ||
} | ||
|
||
function getCalculation(survey, data) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'data' is defined but never used no-unused-vars
|
||
db.exec(sql, [data]) | ||
.then((row) => { | ||
res.status(201).json({ id: row.insertId }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after key 'id' key-spacing
client/src/js/services/color.js
Outdated
{ name : 'purple', value : '#800080'}, | ||
{ name : 'rosybrown', value : '#BC8F8F'}, | ||
{ name : 'royalblue', value : '#4169E1'}, | ||
{ name : 'saddlebrown', value : '#8B4513'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required before '}' object-curly-spacing
client/src/js/services/color.js
Outdated
{ name : 'powderblue', value : '#B0E0E6'}, | ||
{ name : 'purple', value : '#800080'}, | ||
{ name : 'rosybrown', value : '#BC8F8F'}, | ||
{ name : 'royalblue', value : '#4169E1'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required before '}' object-curly-spacing
client/src/js/services/color.js
Outdated
{ name : 'plum', value : '#DDA0DD'}, | ||
{ name : 'powderblue', value : '#B0E0E6'}, | ||
{ name : 'purple', value : '#800080'}, | ||
{ name : 'rosybrown', value : '#BC8F8F'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required before '}' object-curly-spacing
client/src/js/services/color.js
Outdated
{ name : 'pink', value : '#FFC0CB'}, | ||
{ name : 'plum', value : '#DDA0DD'}, | ||
{ name : 'powderblue', value : '#B0E0E6'}, | ||
{ name : 'purple', value : '#800080'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required before '}' object-curly-spacing
client/src/js/services/color.js
Outdated
{ name : 'peru', value : '#CD853F'}, | ||
{ name : 'pink', value : '#FFC0CB'}, | ||
{ name : 'plum', value : '#DDA0DD'}, | ||
{ name : 'powderblue', value : '#B0E0E6'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required before '}' object-curly-spacing
f9f3e25
to
1acfd66
Compare
client/src/js/services/color.js
Outdated
{ name : 'violet', value : '#EE82EE' }, | ||
{ name : 'wheat', value : '#F5DEB3' }, | ||
{ name : 'white', value : '#FFFFFF' }, | ||
{ name : 'whitesmoke', value : '#F5F5F5' } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing trailing comma comma-dangle
$ctrl.hasError = false; | ||
$ctrl.loading = true; | ||
|
||
DataCollectorManagement.read(null, {is_related_patient : 1}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required after '{' object-curly-spacing
A space is required before '}' object-curly-spacing
@jniles @mbayopanda @jeremielodi All the tests pass for this PR, do not hesitate to consult me for the review of this PR |
The data collector module works perfectly, there are just few things that we have to fix
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is incredible - it represents a lot of work, and it performs very well. Well done!
As discussed, I've limited my review to the DisplayMetaData
modules for the moment, and mostly the graphical user interface.
Let me know if you have any questions!
</div> | ||
</div> | ||
|
||
<div ng-if="SurveyFormModalCtrl.selectList" style="background-color:#ededed; padding-left: 10%; padding-right: 3%"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<span class="fa fa-file-pdf-o"></span> <span translate>DOWNLOADS.PDF</span> | ||
</a> | ||
</li> | ||
<li role="separator" class="divider"></li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<ul uib-dropdown-menu role="menu" class="dropdown-menu-right"> | ||
<li role="menuitem"> | ||
<a target='_blank' | ||
ng-href="/data_kit/report/?{{ DisplayMetadataCtrl.download( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of having this large DisplayMetadataCtrl.download()
call, it would be better to move this into the controller in a function called downloadPDF()
. This href will become ng-href="/data_key/report?{{DisplayMetadataCtrl.downloadPDF()"
.
And then in your controller you can make a function:
ctrl.downloadPDF = () => {
return ctrl.download('pdf', ctrl.changes, ctrl.collectorId, /* etc ... */ );
};
</button> | ||
</div> | ||
|
||
<div ng-if="DisplayMetadataCtrl.patientData" class="toolbar-item"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have two ng-if="DisplayMetadataCtrl.patientData"
next to each other. Can you merge them?
renderer : type, | ||
changes, | ||
lang : Languages.key, | ||
patient_uuid : patientUuid || null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you specify patient
and patientUuid
as two different parameters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter 'patient' contains patient information for the purpose of no longer querying the database for its information
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you just use patient.uuid
?
vm.remove = remove; | ||
|
||
function edit(data) { | ||
if (!$state.params.patient) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already checked for this in the startup code with hasPatientData
. Could we use that variable instead of $state
?
if (hasPatientData) {
// do x
} else {
// do y
}
if (cache.collector && !vm.collectorId && !$state.params.patient) { | ||
vm.collectorId = cache.collector.id; | ||
} | ||
const changesLength = Object.keys(vm.changes).length; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make this into a boolean:
const hasNoChanges = Object.keys(vm.changes).length === 0;
Then we can use it in a nice check:
if (cache.changes && hasNoChanges) {
// do x
}
.then((survey) => { | ||
vm.filterElements = DisplayMetadata.displayFilters(survey, vm.changes); | ||
|
||
vm.params = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does vm.params
depend on the result of SurveyForm.read()
? If not, let's move it out:
vm.params = {
data_collector_management_id : vm.collectorId,
changes : vm.changes,
};
SurveyForm.read(/* etc ...*/)
vm.gridOptions.columnDefs = data.columns; | ||
vm.gridOptions.data = data.surveyData; | ||
|
||
return DataCollectorManagement.read(vm.collectorId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have a nice promise chain here that sends a request for:
SurveyForm.read()
DisplayMetadata.read()
DataCollectorManagement.read()
However, it doesn't look like any of these actually depend on one another. So, let's send them in parallel using Promise.all()
!
vm.params = {/* etc */};
return Promise.all([
SurveyForm.read(null, { data_collector_management_id : vm.collectorId }),
DisplayMetadata.read(null, vm.params),
DataCollectorManagement.read(vm.collectorId),
])
.then(([survey, data, collector]) => {
// process all queries...
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jniles, i try this options but the displaying became too slow
changes : vm.changes, | ||
}; | ||
|
||
DisplayMetadata.read(null, vm.params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See if you can do a similar Promise.all()
system here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
715786e
to
049c27d
Compare
Hello @lomamech, it seems like you have referenced #3863 in your pull request description, but you have not referenced them in your commit message description(s). When you reference an issue in a commit message, it automatically closes the corresponding issue when the commit is merged. Please run An example of a correctly-formatted commit:
Thank you for your contributions to BHIMA! |
} | ||
|
||
function displayFilters(survey, search) { | ||
let filters = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'filters' is never reassigned. Use 'const' instead prefer-const
Hello @lomamech, it seems like you have referenced #3863 in your pull request description, but you have not referenced them in your commit message description(s). When you reference an issue in a commit message, it automatically closes the corresponding issue when the commit is merged. Please run An example of a correctly-formatted commit:
Thank you for your contributions to BHIMA! |
@jniles I have finish with the first review |
58e34f2
to
738a988
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lomamech Great work on making these changes.
I'm still working through most of the code, but I've made a few more comments. Take a look :)
👍
listLabel : '@?', | ||
isTitle : '<?', | ||
isGroup : '<?', | ||
parentId : '<', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the parentId
is optional (line 36). This should be <?
.
listLabel : '@?', | ||
isTitle : '<?', | ||
isGroup : '<?', | ||
parentId : '<', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should also be optional <?
.
} | ||
|
||
function closeModal() { | ||
$state.transitionTo('choices_list_management'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of our $state
changes use $state.go()
. Can you use that there?
|
||
<ul data-row-menu="{{row.entity.label}}" class="dropdown-menu-right" bh-dropdown-menu-auto-dropup uib-dropdown-menu> | ||
<li class="dropdown-header text-ellipsis" style="max-width:250px;"> | ||
<a> {{row.entity.label}} </a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this need to be wrapped in a <a>
tag? Can you just put it in plain <span>
tag instead?
} | ||
|
||
function closeModal() { | ||
$state.transitionTo('data_collector_management'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$state.go()
should be sued here as well.
|
||
function DataCollectorManagementModalController($state, DataCollectorManagement, Notify, AppCache, Color) { | ||
const vm = this; | ||
const cache = AppCache('AccountReferenceModal'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be AccountReferenceModal
.
|
||
function SurveyFormModalController($state, SurveyForm, Notify, AppCache, DataCollectorManagement) { | ||
const vm = this; | ||
const cache = AppCache('AccountReferenceModal'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably shouldn't be AccountReferenceModal
.
function submit(surveyForm) { | ||
vm.hasNoChange = surveyForm.$submitted && surveyForm.$pristine && !vm.isCreating; | ||
if (surveyForm.$invalid) { return null; } | ||
if (!surveyForm.$dirty) { return null; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of !surveyForm.$dirty
, go ahead and use surveyForm.$pristine
. It is the same thing, but without a !
.
function closeModal() { | ||
const transitionTo = vm.updateMode ? 'display_metadata' : 'fill_form'; | ||
if (!vm.stateParams.patient) { | ||
$state.transitionTo(transitionTo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use $state.go()
here?
<div class="row"> | ||
<!-- Medical Sheet --> | ||
<div class="col-xs-12"> | ||
<bh-patient-medical-sheet patient-uuid="PatientRecordCtrl.patient.uuid"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose we name this something else - "medical sheet" makes it sound like it has something to do with the patient's medical information, but it is actually just data collections about the patient.
Let's call this <bh-patient-data-collection-forms>
or something like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the use of the term "medical sheet" simply wanted to mention that this area is dedicated to medical information of patients.
Logically, the forms that should appear on this zone should only be those collecting medical information
I propose that we use "Survey Form management" instead of "Survey Form" and |
738a988
to
eb0bf63
Compare
.controller('DisplayMetadataSearchModalController', DisplayMetadataSearchModalController); | ||
|
||
DisplayMetadataSearchModalController.$inject = [ | ||
'$uibModalInstance', 'Store', 'SurveyFormService', 'NotifyService', 'AppCache', 'ChoicesListManagementService', 'filters', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 5 exceeds the maximum line length of 120 max-len
Make sure the user can see a warning message if he submit an invalid form. |
@jniles @jeremielodi I wait another review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lomamech, a few more comments. Your changes from last time look good.
function ChoicesListManagementService(Api) { | ||
const service = new Api('/choices_list_management/'); | ||
|
||
service.formatStore = formatStore; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... looks like we have identical code in the AccountService. Is there any way we can move this into a shared service so that we don't have to duplicate code?
ng-true-value="1" | ||
ng-false-value="0" | ||
ng-model="DataCollectorManagementModalCtrl.dataCollector.is_related_patient"> | ||
<span translate> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This translate
tag needs to be on the <strong>
not the <span>
.
} | ||
|
||
function toggleLoadingIndicator() { | ||
$ctrl.loading = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Toggle loading indicator always sets "loading" to be "false". Shouldn't it turn loading on and off?
$ctrl.gridApi = {}; | ||
$ctrl.filterEnabled = false; | ||
$ctrl.toggleFilter = toggleFilter; | ||
$ctrl.consult = consult; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just FYI - for functions, you don't need to put them in the $onInit
call. The $onInit()
is most for variables that are passed in and/or need to be initialized with each component.
// S'il sont multiples afin de les affecter dans des tableaux | ||
form.forEach(f => { | ||
data.forEach(d => { | ||
if ((f.id === d.survey_form_id) && (f.type === '4')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is type === '4'
? Why not type === '7'
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you instead use the label? It will make it much easier for a developer to read. Like this:
f.label === 'FORM.LABELS.SELECT_MULTIPLE' // now all future developers knows what this means!
|
||
<div ng-if="!formItem.constraint || $eval(formItem.constraintCheck)"> | ||
<!-- Type text --> | ||
<div ng-if="formItem.typeForm === 'text'" class="form-group" ng-class="{ 'has-error' : FillFormForm.$submitted && FillFormForm.{{ formItem.name }}.$invalid }"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed together, I think that you can simply do FillFormForm[formItem.name].$invalid
and save yourself a bit of parsing.
<div ng-if="formItem.typeForm === 'text'" class="form-group" ng-class="{ 'has-error' : FillFormForm.$submitted && FillFormForm.{{ formItem.name }}.$invalid }"> | ||
<label class="control-label"> {{ formItem.label }} </label> | ||
<span style="color: #cecece"><em> {{ formItem.hint }} </em></span> | ||
<div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need this <div>
here?
<span ng-if="formItem.required"> | ||
<input name="{{ formItem.name }}" ng-model="FillFormModalCtrl.form[formItem.name]" autocomplete="off" ng-maxlength="90" class="form-control" required> | ||
</span> | ||
<span ng-if="!formItem.required"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use ngRequired
?
</div> | ||
|
||
<!-- TextArea --> | ||
<div ng-if="formItem.typeForm === 'text_area'"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you are doing a lot of formItem.typeForm === "x"
, could you use an ngSwitch
? It would probably make the code easier to read.
if (vm.reportDetails.multipleChoice[key].length) { | ||
for (let i = 0; i < vm.reportDetails.multipleChoice[key].length; i++) { | ||
vm.choicesLists.forEach(list => { | ||
if (list.id === vm.reportDetails.multipleChoice[key][i]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So .. it looks like you are taking a list of ids and turning them into a list of label
s. So, you are trying to do:
var ids = [3, 3, 5, 7, 1]
// do something
console.log(ids) // => ['formA', 'formA', 'formZ', 'formX', 'formT']
Let's try to clean this up a bit. Here is what I think the basic structure could look like:
angular.forEach(vm.reportDetails.mulitpleChoice, (values, key) => {
// values is an array.
values.forEach(value => {
vm.choicesLists.forEach(list => {
if (list.id === value) {
// replace value with list.label
}
});
});
});
Let's see if we can go one step further:
// create a way to map id -> label for the choice list
let choiceListMap = vm.choicesList.reduce((map, item) => {
map[item.id] = item.label;
}, {});
angular.forEach(vm.reportDetails.mulitpleChoice, (values, key) => {
// unfortunately, angular.map() doesn't exist for object. We have to use an ugly forEach
vm.multipleChoice[key] = values.map(value => choiceListMap[value]);
});
I think that should do it.
First, we create an object to make choiceList ids map to their labels. This takes up memory but removes the choiceLists.forEach()
loop.
Then, we use angular.forEach()
to loop through the object. This removes all the Object.keys()
calls and checks for .length
.
Try it out and see if I've missed anything.
Heads up @lomamech, we just merged some commits that conflict with the changes your made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the |
17ea2b7
to
4487468
Compare
name1 : 'Name with space', | ||
name2 : 'Namewith,and;', | ||
name3 : 'Namewith@', | ||
name4 : 'Namewith\'and\"', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary escape character: " no-useless-escape
*/ | ||
|
||
/* loading grid actions */ | ||
const { expect } = require('chai'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'expect' is assigned a value but never used no-unused-vars
|
||
it('Failed to create a form element whose name parameter with Quotation mark and apostrophe', () => { | ||
// This is the value to get | ||
const variableName = 'Namewith\'and\"'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary escape character: " no-useless-escape
const startString = /^[a-zA-Z]/; | ||
|
||
// Regular expression to check if a variable does not have special characters | ||
const haventSpecial = /^[\w \-]+$/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary escape character: - no-useless-escape
]; | ||
|
||
function AnalysisAuxiliaryCashController($sce, Notify, SavedReports, AppCache, reportData, $state, Accounts) { | ||
function AnalysisAuxiliaryCashController($sce, Notify, SavedReports, AppCache, reportData, $state, Accounts, FormatTreeData) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 9 exceeds the maximum line length of 120 max-len
@@ -18,7 +19,7 @@ AccountsController.$inject = [ | |||
*/ | |||
function AccountsController( | |||
$rootScope, $timeout, AccountGrid, Notify, Constants, Language, | |||
uiGridConstants, Modal, Accounts | |||
uiGridConstants, Modal, Accounts, FormatTreeData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'FormatTreeData' is defined but never used no-unused-vars
* @class FormatTreeDataService | ||
* | ||
*/ | ||
function FormatTreeDataService(Api) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Api' is defined but never used no-unused-vars
@jniles @mbayopanda @jeremielodi can I have another Review |
bors r+ |
3864: Bhima data collector r=jniles a=lomamech - Implente Client side for Data Collector - Implete API for Data Collector Management - Extend service color js adding new color - Implement integration test for dataCollectorManagement - Implement E2E test for dataCollectorManagement This module makes it possible to configure the different types of the choice lists, the lists of choices can be in the form of trees. - Implement client side of choice list management - Implement API for choice list Management - Add integration and E2E for choice List Management This module allows to add the elements of the form of a data collector, the elements of a form have a type, some elements can have filter compared to other elements - Add new component for Data Collector - Add new component for select Survey Form Type Select - Add new component for Select Survey List Select - Implement client side for Survey Form management - Implement API for survey form manangement - Add Integration and End to End test for Survey Form management - Implementation of APIs related to the filling of forms as well as the display of survey data, - Implementation of links between patient-related forms on the patient management page, - Implementing the data collection report with a small search engine - Implementation of components for Choicelist Multipke Select, Patient Medical Sheet, Survey Form Select, - Adding Integration and End to End test for Displaying Metadata and Filling of survey Form closes #3863 Co-authored-by: Chris Lomame <lomamech@gmail.com>
Build failed |
- Improve display metadata, reduice the function downloadD - avoid apostrophes in the search parameter
- Added the listHint property to display information about the component selection lists bhChoiceListMultipleSelect and bhChoiceListSelect - Using function downloadPDF and Using an object instead of a function with multiple parameters - Using Mao from the survey array for mere efficient
- Clear and Sanitaze Code closes Third-Culture-Software#3863
- Update component bhChoiceListSelect bhChoiceListMultipleSelect change params parentId in '<' to '<?' - Using $state.go instead $state.transitionTo - Using <span> instead not necessary tag <a> ... </a> - Using $pristine instead !<--->.$dirty - Sanitaze and Clear Code
- Improved form selection component, added disable option when viewing patient data - Reformated the research params by the using of components bh-filters - Improved data display module, removal of entangled requests in the controller -
- Update placeHolder message in component bhSurveyTypeSelect - Using function parseDataValue and use structure swith for manage type of data - Using ng-required instead to duplicate block of code - Update survey form modals, hide the selection filter for Select Multiple - Use the basic structure for manage vm.reportDetails.multipleChoice value in form of search in Report Data kit
- Added the option to include the patient selection component in the data collection form - Display of the name of the user as well as that of the patient if the form is associated with the patient
- Implementation of a service to validate the variable name parameter when configuring forms, - Implementation of the unit test for the validation of the variable parameter name - Implementation of the E2E test for the validation of the variable name parameter when configuring formulators
ab8e762
to
320b69f
Compare
@jniles @mbayopanda After several attempts this old PR is ready to be merged |
I'm hoping we can just get this in. Let's do it bors. bors r+ |
3864: Bhima data collector r=jniles a=lomamech - Implente Client side for Data Collector - Implete API for Data Collector Management - Extend service color js adding new color - Implement integration test for dataCollectorManagement - Implement E2E test for dataCollectorManagement This module makes it possible to configure the different types of the choice lists, the lists of choices can be in the form of trees. - Implement client side of choice list management - Implement API for choice list Management - Add integration and E2E for choice List Management This module allows to add the elements of the form of a data collector, the elements of a form have a type, some elements can have filter compared to other elements - Add new component for Data Collector - Add new component for select Survey Form Type Select - Add new component for Select Survey List Select - Implement client side for Survey Form management - Implement API for survey form manangement - Add Integration and End to End test for Survey Form management - Implementation of APIs related to the filling of forms as well as the display of survey data, - Implementation of links between patient-related forms on the patient management page, - Implementing the data collection report with a small search engine - Implementation of components for Choicelist Multipke Select, Patient Medical Sheet, Survey Form Select, - Adding Integration and End to End test for Displaying Metadata and Filling of survey Form closes #3863 Co-authored-by: Chris Lomame <lomamech@gmail.com>
Build failed |
bors try |
tryBuild failed |
bors r+ |
3864: Bhima data collector r=jeremielodi a=lomamech - Implente Client side for Data Collector - Implete API for Data Collector Management - Extend service color js adding new color - Implement integration test for dataCollectorManagement - Implement E2E test for dataCollectorManagement This module makes it possible to configure the different types of the choice lists, the lists of choices can be in the form of trees. - Implement client side of choice list management - Implement API for choice list Management - Add integration and E2E for choice List Management This module allows to add the elements of the form of a data collector, the elements of a form have a type, some elements can have filter compared to other elements - Add new component for Data Collector - Add new component for select Survey Form Type Select - Add new component for Select Survey List Select - Implement client side for Survey Form management - Implement API for survey form manangement - Add Integration and End to End test for Survey Form management - Implementation of APIs related to the filling of forms as well as the display of survey data, - Implementation of links between patient-related forms on the patient management page, - Implementing the data collection report with a small search engine - Implementation of components for Choicelist Multipke Select, Patient Medical Sheet, Survey Form Select, - Adding Integration and End to End test for Displaying Metadata and Filling of survey Form closes #3863 Co-authored-by: Chris Lomame <lomamech@gmail.com>
This module makes it possible to configure the different types of the
choice lists, the lists of choices can be in the form of trees.
This module allows to add the elements of the form of a data collector,
the elements of a form have a type, some elements can have filter
compared to other elements
Add new component for Data Collector
Add new component for select Survey Form Type Select
Add new component for Select Survey List Select
Implement client side for Survey Form management
Implement API for survey form manangement
Add Integration and End to End test for Survey Form management
Implementation of APIs related to the filling of forms as well as the
display of survey data,
Implementation of links between patient-related forms on the patient
management page,
Implementing the data collection report with a small search engine
Implementation of components for Choicelist Multipke Select, Patient
Medical Sheet, Survey Form Select,
Adding Integration and End to End test for Displaying Metadata and
Filling of survey Form
closes #3863