@@ -149,9 +149,27 @@ export class InstrumentRecordsService {
149149 instruments . set ( record . instrumentId , instrument ) ;
150150 }
151151 for ( const [ dataKey , dataValue ] of Object . entries ( record . data as object [ ] ) ) {
152- let newDataValue ;
153152 if ( typeof dataValue === 'object' && dataValue && JSON . stringify ( dataValue ) ) {
154- newDataValue = JSON . stringify ( dataValue ) ;
153+ for ( const [ , subDataValue ] of Object . entries ( dataValue ) ) {
154+ // eslint-disable-next-line max-depth
155+ for ( const [ superSubKey , superSubValue ] of Object . entries ( subDataValue as object ) ) {
156+ data . push ( {
157+ instrumentEdition : instrument . internal . edition ,
158+ instrumentName : instrument . internal . name ,
159+ measure : superSubKey ,
160+ sessionDate : record . session . date . toISOString ( ) ,
161+ sessionId : record . session . id ,
162+ sessionType : record . session . type ,
163+ subjectAge : record . subject . dateOfBirth ? yearsPassed ( record . subject . dateOfBirth ) : null ,
164+ subjectId : record . subject . id ,
165+ subjectSex : record . subject . sex ,
166+ timestamp : record . date . toISOString ( ) ,
167+ value : JSON . stringify ( superSubValue )
168+ } ) ;
169+ }
170+ }
171+
172+ continue ;
155173 }
156174 data . push ( {
157175 instrumentEdition : instrument . internal . edition ,
@@ -164,7 +182,7 @@ export class InstrumentRecordsService {
164182 subjectId : record . subject . id ,
165183 subjectSex : record . subject . sex ,
166184 timestamp : record . date . toISOString ( ) ,
167- value : newDataValue ?? ( dataValue as InstrumentMeasureValue )
185+ value : dataValue as InstrumentMeasureValue
168186 } ) ;
169187 }
170188 }
0 commit comments