@@ -32,104 +32,11 @@ function expandData(listEntry: any[]): ExpandDataType[] {
3232 measureValue : dataValue ,
3333 success : true
3434 } ) ;
35-
36- // if (!parseResult.success) {
37- // validRecordArrayList.push({
38- // message: `Error interpreting value ${dataValue} and record array key ${dataKey}`,
39- // success: false
40- // });
41- // }
4235 }
4336 }
4437 return validRecordArrayList ;
4538}
4639
47- // parentPort?.on(
48- // 'message',
49- // ({ instruments, records }: { instruments: [string, ScalarInstrument][]; records: RecordType[] }) => {
50- // const instrumentsMap = new Map(instruments);
51-
52- // const processRecord = (record: RecordType): InstrumentRecordsExport => {
53- // if (!record.computedMeasures) return [];
54-
55- // const instrument = instrumentsMap.get(record.instrumentId)!;
56- // const rows: InstrumentRecordsExport = [];
57-
58- // for (const [measureKey, measureValue] of Object.entries(record.computedMeasures)) {
59- // if (measureValue == null) continue;
60-
61- // if (!Array.isArray(measureValue)) {
62- // rows.push({
63- // groupId: record.subject.groupIds[0] ?? DEFAULT_GROUP_NAME,
64- // instrumentEdition: instrument.internal.edition,
65- // instrumentName: instrument.internal.name,
66- // measure: measureKey,
67- // sessionDate: record.session.date.toISOString(),
68- // sessionId: record.session.id,
69- // sessionType: record.session.type,
70- // subjectAge: record.subject.dateOfBirth ? yearsPassed(record.subject.dateOfBirth) : null,
71- // subjectId: removeSubjectIdScope(record.subject.id),
72- // subjectSex: record.subject.sex,
73- // timestamp: record.date.toISOString(),
74- // username: record.session.user?.username ?? 'N/A',
75- // value: measureValue as InstrumentMeasureValue
76- // });
77- // continue;
78- // }
79-
80- // if (measureValue.length < 1) continue;
81-
82- // const expanded = expandData(measureValue);
83- // for (const entry of expanded) {
84- // if (!entry.success) {
85- // throw new Error(`exportRecords: ${instrument.internal.name}.${measureKey} — ${entry.message}`);
86- // }
87- // rows.push({
88- // groupId: record.subject.groupIds[0] ?? DEFAULT_GROUP_NAME,
89- // instrumentEdition: instrument.internal.edition,
90- // instrumentName: instrument.internal.name,
91- // measure: `${measureKey} - ${entry.measure}`,
92- // sessionDate: record.session.date.toISOString(),
93- // sessionId: record.session.id,
94- // sessionType: record.session.type,
95- // subjectAge: record.subject.dateOfBirth ? yearsPassed(record.subject.dateOfBirth) : null,
96- // subjectId: removeSubjectIdScope(record.subject.id),
97- // subjectSex: record.subject.sex,
98- // timestamp: record.date.toISOString(),
99- // username: record.session.user?.username ?? 'N/A',
100- // value: entry.measureValue
101- // });
102- // }
103- // }
104-
105- // return rows;
106- // };
107-
108- // try {
109- // const results = records.map(processRecord);
110- // parentPort?.postMessage({ data: results.flat(), success: true });
111- // } catch (error) {
112- // parentPort?.postMessage({ error: (error as Error).message, success: false });
113- // }
114- // }
115- // );
116-
117- // type InitData = string
118-
119- // type InitMessage = {
120- // data: InitData
121- // type: 'INIT'
122- // }
123-
124- // type ChunkCompleteData = number
125-
126- // type ChunkCompleteMessage = {
127- // data: ChunkCompleteData
128- // type: 'CHUNK_COMPLETE'
129- // }
130-
131- // type ParentMessage = ChunkCompleteMessage | InitMessage
132-
13340let initData : Map <
13441 string | undefined ,
13542 {
0 commit comments