Skip to content

Commit 788bad9

Browse files
committed
chore: clean up unused commented code
1 parent 631f8d6 commit 788bad9

2 files changed

Lines changed: 1 addition & 59 deletions

File tree

apps/api/src/instrument-records/export-worker.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import type { InstrumentRecordsExport } from '@opendatacapture/schemas/instrumen
66
import { removeSubjectIdScope } from '@opendatacapture/subject-utils';
77

88
import type { ChunkCompleteData, InitData, ParentMessage, RecordType } from './thread-types';
9-
import { isArray } from 'lodash-es';
109

1110
type ExpandDataType =
1211
| {

apps/api/src/instrument-records/instrument-records.service.ts

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -146,40 +146,6 @@ export class InstrumentRecordsService {
146146
}
147147

148148
async exportRecords({ groupId }: { groupId?: string } = {}, { ability }: Required<EntityOperationOptions>) {
149-
//separate this into seperate queries that are done within the thread (ie find session and subject info in thread instead with prisma model)
150-
// const records = await this.instrumentRecordModel.findMany({
151-
// include: {
152-
// session: {
153-
// select: {
154-
// date: true,
155-
// id: true,
156-
// type: true,
157-
// user: { select: { username: true } }
158-
// }
159-
// },
160-
// subject: {
161-
// select: {
162-
// dateOfBirth: true,
163-
// groupIds: true,
164-
// id: true,
165-
// sex: true
166-
// }
167-
// }
168-
// },
169-
// where: {
170-
// AND: [
171-
// {
172-
// subject: groupId ? { groupIds: { has: groupId } } : {}
173-
// },
174-
// accessibleQuery(ability, 'read', 'InstrumentRecord')
175-
// ]
176-
// }
177-
// });
178-
179-
// TBD IMPORTANT - add permissions
180-
181-
//const permissions = accessibleQuery(ability, 'read', 'InstrumentRecord')
182-
183149
const records = await this.queryRecordsRaw(ability, groupId);
184150

185151
// console.log(records[0]
@@ -221,7 +187,7 @@ export class InstrumentRecordsService {
221187
// console.log(records[0]);
222188

223189
// throw new Error("NULL")
224-
structuredClone(records);
190+
// structuredClone(records);
225191

226192
const instrumentIds = [...new Set(records.map((r) => r.instrumentId))];
227193

@@ -231,29 +197,6 @@ export class InstrumentRecordsService {
231197

232198
const instruments = new Map(instrumentsArray.map((instrument) => [instrument.id, instrument]));
233199

234-
// const convertRecords = records.map((record) => {
235-
// return {
236-
// computedMeasures: record.computedMeasures,
237-
// date: record.date.toISOString(),
238-
// id: record.id,
239-
// instrumentId: record.instrumentId,
240-
// session: {
241-
// date: record.session.date.toISOString(),
242-
// id: record.session.id,
243-
// type: record.session.type,
244-
// user: {
245-
// username: record.session.user?.username
246-
// }
247-
// },
248-
// subject: {
249-
// age: record.subject.dateOfBirth ? yearsPassed(record.subject.dateOfBirth) : null,
250-
// groupIds: record.subject.groupIds,
251-
// id: record.subject.id,
252-
// sex: record.subject.sex
253-
// }
254-
// };
255-
// });
256-
257200
const numWorkers = Math.min(cpus().length, Math.ceil(records.length / 100)); // Use up to CPU count, chunk size 100
258201
const chunkSize = Math.ceil(records.length / numWorkers);
259202
const chunks = [];

0 commit comments

Comments
 (0)