Skip to content

Commit 3f7efad

Browse files
committed
removing unsued dataFieldKey
1 parent 55498c0 commit 3f7efad

4 files changed

Lines changed: 15 additions & 16 deletions

File tree

common-data-defs.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,57 +37,49 @@ const formProfileContent = [
3737
eventType: 'contact/name',
3838
type: 'text',
3939
label: 'Name',
40-
dataFieldKey: 'name',
4140
},
4241
{
4342
streamId: 'profile-name',
4443
eventType: 'contact/surname',
4544
type: 'text',
4645
label: 'Surname',
47-
dataFieldKey: 'surname',
4846
},
4947
{
5048
streamId: 'profile-nationality',
5149
eventType: 'contact/nationality',
5250
type: 'text',
5351
label: 'Nationality',
54-
dataFieldKey: 'nationality',
5552
},
5653
{
5754
streamId: 'profile-sex',
5855
eventType: 'attributes/biological-sex',
5956
type: 'select',
6057
options: [{ value: 'male', label: 'Male' }, { value: 'female', label: 'Female'}],
6158
label: 'Sex',
62-
dataFieldKey: 'sex',
6359
},
6460
{
6561
streamId: 'profile-date-of-birth',
6662
eventType: 'date/iso-8601',
6763
type: 'date',
6864
label: 'Date of Birth',
69-
dataFieldKey: 'date-of-birth',
7065
},
7166
{
7267
streamId: 'family-children',
7368
eventType: 'count/generic',
7469
type: 'number',
7570
label: 'Nb of children',
76-
dataFieldKey: 'children-count',
7771
},
7872
{
7973
streamId: 'fertility-miscarriages',
8074
eventType: 'count/generic',
8175
type: 'number',
8276
label: 'Nb of miscarriages',
83-
dataFieldKey: 'miscarriages-count',
8477
},
8578
{
8679
streamId: 'fertility-cycles-charted-extimation',
8780
eventType: 'count/generic',
8881
type: 'number',
8982
label: 'Nb of charted cycles',
90-
dataFieldKey: 'charted-cycles-count',
9183
}
9284
];
9385

@@ -97,7 +89,6 @@ const formHistoricalContent = [
9789
streamId: 'ttc-tta',
9890
eventType: 'fertility-intention/ttc-tta',
9991
label: 'Trying to conceive / Avoiding pregnancy',
100-
dataFieldKey: 'ttc-tta',
10192
type: 'select',
10293
options: [
10394
{
@@ -141,6 +132,12 @@ const formHistoricalContent = [
141132
label: 'TTC - “ Seriously TTC” Intentional intercourse every cycle. Would pursue any/ALL fertility treatments or procedures if needed.'
142133
}
143134
]
135+
},
136+
{
137+
streamId: 'body-weight',
138+
eventType: 'mass/kg',
139+
type: 'number',
140+
label: 'Body Weight (kg)',
144141
}
145142
]
146143

dr-controler.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ async function setPatientList(questionaryId) {
5252
const cellUsername = row.insertCell(-1);
5353
cellUsername.innerHTML = patient.username;
5454
for (const field of fields) {
55-
const value = patient.formData[field.dataFieldKey]?.value;
55+
const formFieldId = field.streamId + ':' + field.eventType;
56+
const value = patient.formData[formFieldId]?.value;
5657
row.insertCell(-1).innerHTML = (value != null) ? value : '';
5758
}
5859
}

dr-lib.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,7 @@ function dataFieldFromEvent (formProfile, event) {
195195
return null;
196196
}
197197
const field = {
198-
formFieldId,
199-
key: dataField.dataFieldKey,
198+
key: formFieldId,
200199
label: dataField.label,
201200
type: dataField.type,
202201
value: event.content,

patient-lib.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ async function getFormContent (questionaryId, formKey) {
3535

3636
async function getFormRecurringContent (form) {
3737
const formReccuringData = structuredClone(form.content);
38-
formReccuringData.forEach(field => {
39-
field.id = 'field-historical-' + field.dataFieldKey;
40-
});
38+
39+
for (let i = 0; i < formReccuringData.length; i++) {
40+
const field = formReccuringData[i];
41+
field.id = form.key + '-' + i;
42+
}
4143
return formReccuringData;
4244
}
4345

@@ -61,7 +63,7 @@ async function getFormPermanentContent (form) {
6163
for (let i = 0; i < res.length; i++) {
6264
const e = res[i];
6365
const field = formPermanentData[i];
64-
field.id = 'field-profile-' + field.dataFieldKey;
66+
field.id = form.key + '-' + i;
6567
console.log('## getFormContent ' + i, e);
6668
if (e.events && e.events.length > 0) {
6769
const event = e.events[0];

0 commit comments

Comments
 (0)