Skip to content

Commit e2e2aba

Browse files
authored
Merge pull request CoBrALab#127 from david-roper/pregnancy-plug-form
Pregnancy plug form
2 parents d2643a4 + e5bf25c commit e2e2aba

File tree

1 file changed

+106
-0
lines changed
  • public/forms/CoBrALab-Pregnancy-Plug-Check-Form

1 file changed

+106
-0
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
/* eslint-disable perfectionist/sort-objects */
2+
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');
5+
6+
export default defineInstrument({
7+
kind: 'FORM',
8+
language: 'en',
9+
tags: ['Mouse', 'Dam', 'Pregnancy', 'Plug'],
10+
internal: {
11+
edition: 1,
12+
name: 'PREGNANCY_PLUG_CHECK_FORM'
13+
},
14+
content: {
15+
plugPresent: {
16+
kind: "boolean",
17+
variant: "checkbox",
18+
label: "Is there a plug present?"
19+
},
20+
damId: {
21+
kind: "string",
22+
variant: "input",
23+
label: "Dam ID"
24+
},
25+
damWeight: {
26+
kind: 'number',
27+
variant: "input",
28+
label: "Dam weight (grams)"
29+
},
30+
daysSinceMating: {
31+
kind: "number",
32+
variant: "input",
33+
label: "Days since mating session"
34+
},
35+
malePartnerId: {
36+
kind: "string",
37+
variant: "input",
38+
label: "Male partner ID"
39+
},
40+
predictedDob: {
41+
kind: "date",
42+
label: "Predicted date of birth"
43+
},
44+
additionalComments: {
45+
kind: "string",
46+
variant: "textarea",
47+
label: "Additional Comments"
48+
}
49+
},
50+
clientDetails: {
51+
estimatedDuration: 1,
52+
instructions: ["To be filled whenever the animal is checked for a pregnancy plug, please keep in mind the days since the mouse's last mating session and the ID of the mating partner."]
53+
},
54+
details: {
55+
description: 'A form to track data from whenever an animal is checked for a pregnancy.',
56+
license: 'Apache-2.0',
57+
title: 'Pregnancy Plug Check Form'
58+
},
59+
measures: {
60+
plugPresent: {
61+
kind: 'const',
62+
visibility: 'visible',
63+
ref: 'plugPresent'
64+
},
65+
damId: {
66+
kind: 'const',
67+
visibility: 'visible',
68+
ref: 'damId'
69+
},
70+
damWeight: {
71+
kind: 'const',
72+
visibility: 'visible',
73+
ref: 'damWeight'
74+
},
75+
daysSinceMating: {
76+
kind: 'const',
77+
visibility: 'visible',
78+
ref: 'daysSinceMating'
79+
},
80+
malePartnerId: {
81+
kind: 'const',
82+
visibility: 'visible',
83+
ref: 'malePartnerId'
84+
},
85+
predictedDob: {
86+
kind: 'const',
87+
visibility: 'visible',
88+
ref: 'predictedDob'
89+
},
90+
additionalComments: {
91+
kind: 'const',
92+
visibility: 'visible',
93+
ref: 'additionalComments'
94+
}
95+
96+
},
97+
validationSchema: z.object({
98+
plugPresent: z.boolean(),
99+
damId: z.string().min(1, "Dam ID is required"),
100+
damWeight: z.number().positive("Weight must be greater than 0"),
101+
daysSinceMating: z.number().nonnegative("Must be 0 or greater"),
102+
malePartnerId: z.string().min(1, "Male partner ID is required"),
103+
predictedDob: z.date().optional(),
104+
additionalComments: z.string().optional()
105+
})
106+
});

0 commit comments

Comments
 (0)