File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -168,19 +168,21 @@ async function getPatientDetails(questionaryId, patientEvent) {
168168
169169 // -- get data
170170 // get profile form data
171- const formProfile = dataDefs . questionnaires [ questionaryId ] . forms . profile ;
171+ const formProfile = dataDefs . v2questionnaires [ questionaryId ] . forms . profile ;
172172
173- // get eventTypes
174173
175- // get the last value of each field
176- const apiCalls = formProfile . content . map ( ( field ) => ( {
177- method : "events.get" ,
178- params : {
179- streams : [ field . streamId ] ,
180- types : [ field . eventType ] ,
181- limit : 1 ,
182- } ,
183- } ) ) ;
174+ // get the last value of each itemKey
175+ const apiCalls = formProfile . itemKeys . map ( ( itemKey ) => {
176+ const itemDef = hdsModel ( ) . itemDefForKey ( itemKey ) ;
177+ return {
178+ method : "events.get" ,
179+ params : {
180+ streams : [ itemDef . data . streamId ] ,
181+ types : itemDef . types ,
182+ limit : 1 ,
183+ }
184+ } ;
185+ } ) ;
184186
185187 const profileEventsResults = await patientConnection . api ( apiCalls ) ;
186188 for ( const profileEventRes of profileEventsResults ) {
You can’t perform that action at this time.
0 commit comments