Skip to content

Commit f882b5f

Browse files
authored
Merge pull request CoBrALab#100 from david-roper/update-record-array-measures
Update record array measures
2 parents 5356a0d + f393d67 commit f882b5f

File tree

4 files changed

+42
-54
lines changed

4 files changed

+42
-54
lines changed

public/forms/CoBrALab-Histology-Form/index.ts

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default defineInstrument({
1717
"Antibodies"
1818
],
1919
internal: {
20-
edition: 2,
20+
edition: 3,
2121
name: "HISTOLOGY_FORM",
2222
},
2323
content: {
@@ -255,22 +255,13 @@ export default defineInstrument({
255255
label: "Antibodies used info",
256256
visibility: "visible",
257257
value: (data) => {
258-
const antibodyList = data.antibodiesUsedInfo.map((x) => x);
259-
let antibodyInfoString = "";
260-
if (antibodyList) {
261-
for (const antibody of antibodyList) {
262-
antibodyInfoString +=
263-
"Antibody Type: " +
264-
antibody.antibodyType +
265-
" Antibody Name: " +
266-
antibody.antibodyName +
267-
" Antibody Concentration: " +
268-
antibody.antibodyConcentration +
269-
" μg/mL ";
270-
}
271-
}
272-
273-
return antibodyInfoString;
258+
const antibodyList = data.antibodiesUsedInfo || []
259+
const antiBodyListResults = antibodyList.map(antiBodyInfo => ({
260+
"Antibody type": antiBodyInfo.antibodyType,
261+
"Antibody name": antiBodyInfo.antibodyName,
262+
"Antibody concentration μg/mL": antiBodyInfo.antibodyConcentration
263+
}))
264+
return antiBodyListResults
274265
},
275266
},
276267
serumUsed: {

public/forms/CoBrALab-Mouse-End-Of-Life-Form/index.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default defineInstrument({
2323
language: 'en',
2424
tags: ['End of Life', 'Mouse', 'Euthanasia', 'Termination'],
2525
internal: {
26-
edition: 3,
26+
edition: 4,
2727
name: 'MOUSE_END_OF_LIFE_FORM'
2828
},
2929
content: {
@@ -344,16 +344,17 @@ export default defineInstrument({
344344
label: "Body part extraction info",
345345
visibility: "visible",
346346
value: (data) => {
347-
const val = data.bodyExtractionInfo?.map((x) => x);
348-
let extractInfo = '';
349-
if (val) {
350-
for (const info of val) {
351-
extractInfo += info.bodyPartExtracted + ' ' + info.bodyExtractionComments + ' ' + (info.extractionMotive ?? '') + ' ' + (info.pfaBatch ?? '') + ' '
352-
+ (info.pfaBatchExpiration ?? '') + ' ' + info.bodyExtractionComments + ' ' + info.bodyPartStorageSolution + ' ' + info.bodyPartStorageLocation + ' ' +
353-
+ '\n';
354-
}
355-
}
356-
return extractInfo;
347+
const bodyExtractionValues = data.bodyExtractionInfo || []
348+
const bodyExtractionResults = bodyExtractionValues.map(info => ({
349+
"Body part extracted": info.bodyPartExtracted,
350+
"Extraction motive": info.extractionMotive,
351+
"Extraction reason comments": info.bodyExtractionComments,
352+
"PFA batch": info.pfaBatch,
353+
"PFA batch expiration": info.pfaBatchExpiration,
354+
"Body part storage solution": info.bodyPartStorageSolution,
355+
"Body part storage location": info.bodyPartStorageLocation,
356+
}))
357+
return bodyExtractionResults
357358
}
358359
},
359360
additionalComments: {

public/forms/CoBrALab-Mouse-MRI-Form/index.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default defineInstrument({
2626
language: 'en',
2727
tags: ['Mouse', 'MRI', 'Structural', 'fMRI'],
2828
internal: {
29-
edition: 2,
29+
edition: 3,
3030
name: 'MOUSE_MRI_FORM'
3131
},
3232
content: {
@@ -526,17 +526,17 @@ export default defineInstrument({
526526
kind: "computed",
527527
label: "Scan record info",
528528
value: (data) => {
529-
const val = data.scanRecordInfo?.map((x) => x)
530-
let measureOutput = ''
531-
if (val) {
532-
for (const info of val) {
533-
measureOutput += info.mriScanName + ' ' + (info.breathingStable ? 'breathing stable: ' + info.breathingStable : '') + ' ' +
534-
(info.oxygenConcentration ? 'O_2 concentration: ' + info.oxygenConcentration + '%' : '') + ' ' + (info.oxygenSaturation ? 'O_2 saturation: ' + info.oxygenSaturation + '%' : '') +
535-
' ' + (info.respirationRate ? 'respiration rate: ' + info.respirationRate + 'breath/min' : '') + ' ' + (info.formOfMeasurement ? 'form of measurement: ' + info.formOfMeasurement : '') +
536-
+ (info.otherComments ? 'comments: ' + info.otherComments : '') + '\n';
537-
}
538-
}
539-
return measureOutput
529+
const scanResults = data.scanRecordInfo || []
530+
const scanRecordResults = scanResults.map(scan => ({
531+
"MRI scan name": scan.mriScanName,
532+
"Breathing stable": scan.breathingStable,
533+
"O_2 concentration %": scan.oxygenConcentration,
534+
"O_2 saturation %": scan.oxygenSaturation,
535+
"Respiration rate /min": scan.respirationRate,
536+
"Form of measurement": scan.formOfMeasurement,
537+
"Comments": scan.otherComments
538+
}))
539+
return scanRecordResults
540540
}
541541
}
542542
},
@@ -557,7 +557,7 @@ export default defineInstrument({
557557
exVivoCranioStatus: z.enum(['In-cranio', 'Ex-cranio']).optional(),
558558
exVivoScanningMedium: z.enum(["Dry", "Fluorinert", "Other"]).optional(),
559559
exVivoScanningMediumOther: z.string().optional(),
560-
anestheticUsed: z.boolean(),
560+
anestheticUsed: z.boolean().optional(),
561561
dexUsed: z.boolean().optional(),
562562
dexSolutionCreationDate: z.date().optional(),
563563
dexBottleSerialCode: z.string().optional(),
@@ -585,7 +585,7 @@ export default defineInstrument({
585585
"MGE_MTOff_Tw1_30deg",
586586
"T2star_FID_EPI_sat_dan_ver_original",
587587
"exvivoDanFLASH"
588-
]),
588+
]).optional(),
589589
mouseVitalsTracked: z.boolean().optional(),
590590
breathingStable: z.boolean().optional(),
591591
oxygenConcentration: z.number().min(0).max(100).optional(),

public/forms/CoBrALab-Physical-Intervention-Form/index.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable perfectionist/sort-objects */
22

3-
const { defineInstrument } = await import('/runtime/v1/@opendatacapture/runtime-core/index.js');
4-
const { z } = await import('/runtime/v1/zod@3.23.x/index.js');
3+
import { z }from '/runtime/v1/zod@3.23.x/index.js';
4+
import { defineInstrument } from '/runtime/v1/@opendatacapture/runtime-core';
55

66
const interventionTypeList = [ "Blood extraction",
77
"Teeth extraction",
@@ -32,7 +32,7 @@ export default defineInstrument({
3232
language: 'en',
3333
tags: ['Physical intervention','Blood extraction', 'Ear tagging', 'Genotyping', 'Vaginal cytology','Blood glucose','anesthesia'],
3434
internal: {
35-
edition: 2,
35+
edition: 3,
3636
name: 'PHYSICAL_INTERVENTION_FORM'
3737
},
3838
content: {
@@ -212,15 +212,11 @@ export default defineInstrument({
212212
label: "Tattoo Locations",
213213
visibility: "visible",
214214
value: (data) => {
215-
const val = data.tattooLocationInfo?.map((x) => x)
216-
let tattooText = ""
217-
if(val){
218-
for (const info of val){
219-
tattooText += info.tattooLocation + " "
220-
}
221-
return tattooText
222-
}
223-
return undefined
215+
const val = data.tattooLocationInfo || []
216+
const tattooResults = val.map(tattoo => ({
217+
"Tattoo Location": tattoo.tattooLocation
218+
}))
219+
return tattooResults
224220
}
225221
},
226222
teethExtractionNumber: {

0 commit comments

Comments
 (0)