11
2- const patientBaseStreams = [
3- // profile
4- { id : 'profile' , name : 'Profile' } ,
5- { id : 'profile-name' , name : 'Name' , parentId : 'profile' } ,
6- { id : 'profile-address' , name : 'Address' , parentId : 'profile' } ,
7- { id : 'profile-date-of-birth' , name : 'Date of Birth' , parentId : 'profile' } ,
8- { id : 'profile-location' , name : 'Location' , parentId : 'profile' } ,
9- { id : 'profile-sex' , name : 'Sex' , parentId : 'profile' } ,
10- // family
11- { id : 'family' , name : 'Family' } ,
12- { id : 'family-children' , name : 'Children' , parentId : 'family' } ,
13- // fertility
14- { id : 'fertility' , name : 'Fertility' } ,
15- { id : 'fertility-miscarriages' , name : 'Miscarriages' , parentId : 'fertility' } ,
16- { id : 'fertility-trainings' , name : 'Trainings' , parentId : 'fertility' } ,
17- { id : 'fertility-cycles' , name : 'Cycles' , parentId : 'fertility' } ,
18- { id : 'fertility-cycles-start' , name : 'New Cycle' , parentId : 'fertility-cycles' } ,
19- { id : 'fertility-cycles-ovulation' , name : 'Ovulation Day' , parentId : 'fertility-cycles' } ,
20- { id : 'fertility-cycles-charted-estimation' , name : 'Cycles charted estimation' , parentId : 'fertility-cycles' } ,
21- { id : 'fertility-ttc-tta' , name : 'Trying to conceive / Avoiding pregnancy' , parentId : 'fertility' } ,
22- // body
23- { id : 'body' , name : 'Body' } ,
24- { id : 'body-height' , name : 'Body Height' , parentId : 'body' } ,
25- { id : 'body-weight' , name : 'Body Weight' , parentId : 'body' } ,
26- // vulva
27- { id : 'body-vulva' , name : 'Vulva' , parentId : 'body' } ,
28- { id : 'body-vulva-wetness' , name : 'Vulva Wetness' , parentId : 'body-vulva' } ,
29- { id : 'body-vulva-wetness-feeling' , name : 'Vulva Wetness Feeling' , parentId : 'body-vulva-wetness' } ,
30- { id : 'body-vulva-mucus' , name : 'Vulva Mucus' , parentId : 'body-vulva' } ,
31- { id : 'body-vulva-mucus-inspect' , name : 'Vulva Mucus Inspect' , parentId : 'body-vulva-mucus' } ,
32- { id : 'body-vulva-mucus-stretch' , name : 'Vulva Mucus Stretch' , parentId : 'body-vulva-mucus' }
33- ] ;
342
353const patientBasePermissionsX = [
364 { id : 'profile' , name : 'Profile' } ,
@@ -47,174 +15,6 @@ const patientBasePermissionsB = [
4715 { id : 'body-weight' , name : 'Body weight' } ,
4816]
4917
50- const formProfileContentBase = [
51- {
52- streamId : 'profile-name' ,
53- eventType : 'contact/name' ,
54- type : 'text' ,
55- label : 'First Name' ,
56- } ,
57- {
58- streamId : 'profile-name' ,
59- eventType : 'contact/surname' ,
60- type : 'text' ,
61- label : 'Last Name' ,
62- } ,
63- {
64- streamId : 'profile-date-of-birth' ,
65- eventType : 'date/iso-8601' ,
66- type : 'date' ,
67- label : 'Date of Birth' ,
68- } ] ;
69-
70- const formProfileContentX = [
71- ...formProfileContentBase ,
72- {
73- streamId : 'profile-address' ,
74- eventType : 'contact/country' ,
75- type : 'text' ,
76- label : 'Country' ,
77- } ,
78- {
79- streamId : 'profile-sex' ,
80- eventType : 'attributes/biological-sex' ,
81- type : 'select' ,
82- options : [ { value : 'male' , label : 'Male' } , { value : 'female' , label : 'Female' } ] ,
83- label : 'Sex' ,
84- } ,
85- {
86- streamId : 'family-children' ,
87- eventType : 'count/generic' ,
88- type : 'number' ,
89- label : '# of children' ,
90- } ,
91- {
92- streamId : 'fertility-miscarriages' ,
93- eventType : 'count/generic' ,
94- type : 'number' ,
95- label : '# of miscarriages' ,
96- } ,
97- {
98- streamId : 'fertility-cycles-charted-estimation' ,
99- eventType : 'count/generic' ,
100- type : 'number' ,
101- label : '# of charted cycles' ,
102- }
103- ] ;
104-
105- const formHistoricalContentX = [
106- {
107- streamId : 'fertility-ttc-tta' ,
108- eventType : 'fertility-intention/ttc-tta' ,
109- label : 'Goal: Trying to conceive or avoid pregnancy' ,
110- type : 'select' ,
111- parseValueToNum : true ,
112- options : [
113- {
114- value : 0 ,
115- label : 'TTA - Not taking risks. Would take all available measures to end a pregnancy.'
116- } ,
117- {
118- value : 1 ,
119- label : 'TTA - Not taking risks. Would strongly consider placing baby for adoption.'
120- } ,
121- {
122- value : 2 ,
123- label : 'TTA - Not taking risks. Would need some time, maybe counseling. Ultimately keeping the pregnancy.'
124- } ,
125- {
126- value : 4 ,
127- label : 'TTA - Not taking risks. Currently content with family size but a surprise pregnancy would be welcome.'
128- } ,
129- {
130- value : 5 ,
131- label : 'TTW/TTA - “Loosely TTA” known risks are taken in the fertile window. “OOPS” pregnancy would be welcome.'
132- } ,
133- {
134- value : 6 ,
135- label : 'TTW - Charting only for health/curiosity. Unprotected intercourse happens whenever. Pregnancy very welcome.'
136- } ,
137- {
138- value : 7 ,
139- label : 'TTW/TTC - Pregnancy very welcome (moving up the scale in very near future).'
140- } ,
141- {
142- value : 8 ,
143- label : 'TTC - “Excited to start/grow a family TTC” Intentional intercourse every cycle. Excited to start/grow a family. But would not use any fertility treatments if needed.'
144- } ,
145- {
146- value : 9 ,
147- label : 'TTC - “Highly hopeful TTC” Intentional intercourse every cycle. Would consider some but not all fertility treatments if needed.'
148- } ,
149- {
150- value : 10 ,
151- label : 'TTC - “Seriously TTC” Intentional intercourse every cycle. Would pursue any/ALL fertility treatments or procedures if needed.'
152- }
153- ]
154- } ,
155- {
156- streamId : 'body-weight' ,
157- eventType : 'mass/kg' ,
158- type : 'number' ,
159- label : 'Body Weight (kg)' ,
160- }
161- ]
162-
163- const formHistoricalContentB = [
164- {
165- streamId : 'body-weight' ,
166- eventType : 'mass/kg' ,
167- type : 'number' ,
168- label : 'Body Weight (kg)' ,
169- } ,
170- {
171- label : 'Vulva Wetness feeling' ,
172- streamId : 'body-vulva-wetness-feeling' ,
173- eventType : 'ratio/generic' ,
174- type : 'select' ,
175- options : [
176- { value : 0 , label : 'Dry' } ,
177- { value : 1 , label : 'Wet' } ,
178- { value : 2 , label : 'Very wet' }
179- ]
180- } ,
181- {
182- streamId : 'body-vulva-mucus-inspect' ,
183- eventType : 'vulva-mucus-inspect/v0' ,
184- type : 'select' ,
185- label : 'Cervical Fluid Inspect' ,
186- options : [
187- { value : 'clear' , label : 'Clear' } ,
188- { value : 'creamy' , label : 'Creamy' } ,
189- { value : 'dry-sticky' , label : 'Dry & Sticky' } ,
190- { value : 'egg-white' , label : 'Egg White' } ,
191- ]
192- } ,
193- {
194- streamId : 'body-vulva-mucus-stretch' ,
195- eventType : 'ratio/generic' ,
196- type : 'select' ,
197- label : 'Cervical Fluid Stretch' ,
198- options : [
199- { value : 0 , label : 'No Strech' } ,
200- { value : 1 , label : 'Short' } ,
201- { value : 2 , label : 'Long' }
202- ]
203- } ,
204- {
205- streamId : 'fertility-cycles-start' ,
206- eventType : 'activity/plain' ,
207- type : 'checkbox' ,
208- label : 'New Cycle'
209- } ,
210- {
211- streamId : 'fertility-cycles-ovulation' ,
212- eventType : 'activity/plain' ,
213- type : 'checkbox' ,
214- label : 'Ovulation Day'
215- }
216- ]
217-
21818
21919const questionnaires = {
22020 'questionary-x' : {
@@ -224,19 +24,16 @@ const questionnaires = {
22424 level : 'read' ,
22525 name : perm . name ,
22626 } ) ) ,
227- patientBaseStreams,
22827 forms : {
22928 profile : {
23029 type : 'permanent' ,
23130 key : 'profile-x' ,
23231 name : 'Profile' ,
233- content : formProfileContentX
23432 } ,
23533 history : {
23634 type : 'recurring' ,
23735 key : 'recurring-x' ,
23836 name : 'History' ,
239- content : formHistoricalContentX
24037 }
24138 }
24239 } ,
@@ -247,19 +44,16 @@ const questionnaires = {
24744 level : 'read' ,
24845 name : perm . name ,
24946 } ) ) ,
250- patientBaseStreams,
25147 forms : {
25248 profile : {
25349 type : 'permanent' ,
25450 key : 'profile-b' ,
255- name : 'Profile' ,
256- content : formProfileContentBase
51+ name : 'Profile'
25752 } ,
25853 history : {
25954 type : 'recurring' ,
26055 key : 'recurring-b' ,
261- name : 'History' ,
262- content : formHistoricalContentB
56+ name : 'History'
26357 }
26458 }
26559 }
@@ -322,8 +116,22 @@ const v2 = {
322116 }
323117}
324118
119+ /**
120+ * get all itemKeys of a questionnary
121+ * @param {* } questionaryId
122+ */
123+ function utilGetAllItemKeys ( questionaryId ) {
124+ const questionary = v2 [ questionaryId ] ;
125+ const itemKeys = [ ] ;
126+ for ( const formContent of Object . values ( questionary . forms ) ) {
127+ itemKeys . push ( ...formContent . itemKeys ) ;
128+ }
129+ return itemKeys ;
130+ }
131+
325132export const dataDefs = {
326133 appId : 'demo-dr-forms' ,
327134 questionnaires,
328- v2questionnaires : v2
135+ v2questionnaires : v2 ,
136+ utilGetAllItemKeys
329137} ;
0 commit comments