Skip to content

Commit

Permalink
feat: add biologic parser
Browse files Browse the repository at this point in the history
* test: added biologic test back

* chore: update deps

* update: flatten meta.

* update: forgot updating one condition

* fix(flatten): just get the variables there which is the relevant data.
  • Loading branch information
santifoo committed Oct 18, 2022
1 parent b7df05d commit ab90365
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -49,7 +49,7 @@
"@emotion/react": "^11.10.4",
"@lukeed/uuid": "^2.0.0",
"@tanstack/react-table": "^8.5.15",
"biologic-converter": "^0.2.0",
"biologic-converter": "^0.3.2",
"cheminfo-types": "^1.4.0",
"filelist-utils": "^1.0.1",
"immer": "^9.0.15",
Expand Down
2 changes: 1 addition & 1 deletion src/app/data/__tests__/getIVMeasurement.test.ts
Expand Up @@ -7,7 +7,7 @@ import { getEmptyDataState } from '../DataState';
import { append } from '../append';
import { biologicLoader } from '../loaders/biologicLoader';

test.skip('getIVMeasurement', async () => {
test('getIVMeasurement', async () => {
const result = await getIVMeasurement();

expect(result.entries).toHaveLength(2);
Expand Down
21 changes: 15 additions & 6 deletions src/app/data/loaders/biologicLoader.ts
Expand Up @@ -3,23 +3,32 @@ import { convert } from 'biologic-converter';
import type { FileCollection } from 'filelist-utils';

import { getEmptyMeasurements, Loader } from '../DataState';
import type { MeasurementBase } from '../MeasurementBase';

export const biologicLoader: Loader = async function biologicLoader(
fileCollection: FileCollection,
) {
let measurements = getEmptyMeasurements();
const results = await convert(fileCollection);
for (let result of results) {
for (let { dir, mpr, mps, mpt } of results) {
//still not for plotting, just a schema
measurements.iv.entries.push({
const prepare: Partial<MeasurementBase> = {
id: v4(),
meta: result.mps ? { ...result.mps } : {},
filename: '',
path: result.dir,
path: dir,
info: {},
title: '',
data: [],
});
};
if (mpr !== undefined) {
prepare.meta = { ...mpr.settings.variables };
prepare.data = [{ variables: mpr.data.variables }];
} else if (mpt !== undefined) {
prepare.meta = { ...mpt.settings.variables };
prepare.data = [{ variables: mpt.data.variables }];
} else if (mps !== undefined) {
prepare.meta = { ...mps.settings.variables };
}
measurements.iv.entries.push(prepare as MeasurementBase);
}
return measurements;
};

0 comments on commit ab90365

Please sign in to comment.