Skip to content

Commit 536df55

Browse files
committed
Fixing fields
1 parent e91a4cc commit 536df55

5 files changed

Lines changed: 18 additions & 11 deletions

File tree

common-data-defs.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11

22
const patientBaseStreams = [
33
// profile
4+
{id: 'profile', name: 'Profile'},
45
{id: 'profile-name', name: 'Name', parentId: 'profile'},
56
{id: 'profile-nationality', name: 'Nationality', parentId: 'profile'},
67
{id: 'profile-date-of-birth', name: 'Date of Birth', parentId: 'profile'},
78
{id: 'profile-location', name: 'Location', parentId: 'profile'},
89
{id: 'profile-sex', name: 'Sex', parentId: 'profile'},
910
// family
11+
{id: 'family', name: 'Family'},
1012
{id: 'family-children', name: 'Children', parentId: 'family'},
1113
// fertility
14+
{id: 'fertility', name: 'Fertility'},
1215
{id: 'fertility-miscarriages', name: 'Miscarriages', parentId: 'fertility'},
1316
{id: 'fertility-traings', name: 'Trainings', parentId: 'fertility'},
1417
{id: 'fertility-cycles', name: 'Cycles', parentId: 'fertility'},
1518
{id: 'fertility-cycles-charted-extimation', name: 'Cycles charted estimation', parentId: 'fertility'},
1619
{id: 'fertility-ttc-tta', name: 'Trying to conceive / Avoiding pregnancy', parentId: 'fertility'},
20+
// body
21+
{id: 'body', name: 'Body'},
22+
{id: 'body-height', name: 'Body Height', parentId: 'body'},
23+
{id: 'body-weight', name: 'Body Weight', parentId: 'body'},
1724
];
1825

1926
const patientBasePermissions = [

dr-lib.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ async function getPatientDetails (patientEvent) {
136136
const profileEvents = await patientConnection.api([{ method: 'events.get', params: { limit: 100 } }]);
137137
for (const profileEvent of profileEvents[0].events) {
138138
const field = dataFieldFromEvent(profileEvent);
139-
if (field) {
139+
if (field && patient.formData[field.key] == null) { // drop historical values
140140
patient.formData[field.key] = field;
141141
}
142142
}

patient-home-lib.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ async function grantAccess (formInfo, formDetails) {
112112
}
113113

114114
async function publishAccess (formInfo, apiEndpoint) {
115+
// create needed base streams
116+
const baseStreams = dataDefs.questionnaires[formInfo.questionaryId].patientBaseStreams;
117+
await createsPatientAccountStreams(connection, baseStreams);
118+
115119
// publishing access on Dr Account
116120
const apiCalls = [{
117121
method: 'events.create',
@@ -180,12 +184,6 @@ function getPatientApiEndpoint() {
180184
}
181185

182186
function showLoginButton (loginSpanId, stateChangeCallBack) {
183-
184-
// const requestedPermissions = dataDefs.patientBasePermissions.map(perm => ({
185-
// streamId: perm.id,
186-
// defaultName: perm.name,
187-
// level: 'manage'
188-
// }));
189187

190188
const requestedPermissions = [{
191189
streamId: '*',

patient-profile-controler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
window.onload = async (event) => {
9-
const { patientApiEndpoint, questionaryId } = getPatientApiEndpoint();
9+
const { patientApiEndpoint, questionaryId } = getPatientApiEndpointAndFormId();
1010
console.log('## patientApiEndpoint:', patientApiEndpoint);
1111
await connect(patientApiEndpoint, questionaryId);
1212
updateFormContent('profile');
@@ -17,7 +17,7 @@ window.onload = async (event) => {
1717

1818

1919
// ------- Get Dr's info -------- //
20-
function getPatientApiEndpoint() {
20+
function getPatientApiEndpointAndFormId() {
2121
const params = new URLSearchParams(document.location.search);
2222
const patientApiEndpoint = params.get('patientApiEndpoint');
2323
const questionaryId = params.get('questionaryId');

patient.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ <h3>Permission request</h3>
8282
<br>
8383

8484
<br>
85-
<h3>JSON detail</h3>
86-
<span id="card-questionnary-details-content"></span>
85+
<!--
86+
<h3>JSON detail</h3>
87+
<span id="card-questionnary-details-content"></span>
88+
-->
8789
</div>
8890
</div>
8991
</div>

0 commit comments

Comments
 (0)