@centricare/contract 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -34,17 +34,50 @@ var singleResourceResponseSchema = (dataSchema) => apiResponseSchema(dataSchema)
34
34
  message: "Single resource response metadata must have total=1, offset=0, limit=0, next=null, previous=null"
35
35
  }
36
36
  );
37
+ var SETTING_OPTIONS_TYPE = [
38
+ // Single input
39
+ "string",
40
+ // Mapped to text input in client
41
+ "number",
42
+ // Mapped to number input in client
43
+ "boolean",
44
+ // Mapped to checkbox/switch in client
45
+ "date",
46
+ // Mapped date picker in client
47
+ "datetime",
48
+ // Mapped datetime picker in client
49
+ "daterange",
50
+ // Mapped date range picker in client
51
+ "image",
52
+ // Mapped to file input (single image only) in client
53
+ // Multiple input
54
+ "strings",
55
+ // Mapped to nested array text input in client
56
+ "numbers",
57
+ // Mapped to nested array number input in client
58
+ "images",
59
+ // Mapped to file input (multiple image) in client
60
+ "keyvals"
61
+ // Mapped to nested array text input pair in client
62
+ ];
37
63
  var settingOptionTypeSchema = z5.z.union([
38
- z5.z.enum(["string", "number", "boolean", "date"]),
39
- z5.z.array(z5.z.enum(["string", "number", "boolean", "date"])),
40
- z5.z.string()
64
+ z5.z.enum(SETTING_OPTIONS_TYPE),
65
+ z5.z.string(),
66
+ z5.z.string().array()
41
67
  ]);
42
68
  var settingOptionSchema = z5.z.object({
43
69
  field: z5.z.string().min(1, { message: "field is required" }),
44
70
  label: z5.z.string().optional(),
45
71
  type: settingOptionTypeSchema,
46
72
  default: z5.z.string().nullable(),
47
- value: z5.z.union([z5.z.string(), z5.z.boolean(), z5.z.number()]).nullable()
73
+ value: z5.z.union([
74
+ z5.z.string(),
75
+ z5.z.boolean(),
76
+ z5.z.number(),
77
+ z5.z.string().array(),
78
+ z5.z.number().array(),
79
+ z5.z.object({ key: z5.z.string(), value: z5.z.string() })
80
+ ]).nullable()
48
81
  });
49
82
 
50
83
  // src/registry/registry.json
@@ -58,9 +91,24 @@ var registry_default = {
58
91
  description: "Status of a record",
59
92
  type: "parameter",
60
93
  values: [
61
- { value: "active", display: "Active", description: "Record is still active and valid", status: "Active" },
62
- { value: "inactive", display: "Inactive", description: "Record is no longer active and valid", status: "Active" },
63
- { value: "suspended", display: "Suspended", description: "Record is suspended and may not be used or valid until the suspension is over", status: "Active" }
94
+ {
95
+ value: "active",
96
+ display: "Active",
97
+ description: "Record is still active and valid",
98
+ status: "Active"
99
+ },
100
+ {
101
+ value: "inactive",
102
+ display: "Inactive",
103
+ description: "Record is no longer active and valid",
104
+ status: "Active"
105
+ },
106
+ {
107
+ value: "suspended",
108
+ display: "Suspended",
109
+ description: "Record is suspended and may not be used or valid until the suspension is over",
110
+ status: "Active"
111
+ }
64
112
  ]
65
113
  },
66
114
  {
@@ -71,8 +119,18 @@ var registry_default = {
71
119
  description: "Patient-specific status codes",
72
120
  type: "parameter",
73
121
  values: [
74
- { value: "blacklisted", display: "Blacklisted", description: "Patient is blacklisted from the facility", status: "Active" },
75
- { value: "deceased", display: "Deceased", description: "Patient is already deceased", status: "Active" }
122
+ {
123
+ value: "blacklisted",
124
+ display: "Blacklisted",
125
+ description: "Patient is blacklisted from the facility",
126
+ status: "Active"
127
+ },
128
+ {
129
+ value: "deceased",
130
+ display: "Deceased",
131
+ description: "Patient is already deceased",
132
+ status: "Active"
133
+ }
76
134
  ]
77
135
  },
78
136
  {
@@ -83,10 +141,30 @@ var registry_default = {
83
141
  description: "Marital status codes",
84
142
  type: "parameter",
85
143
  values: [
86
- { value: "married", display: "Married", description: "Person is married", status: "Active" },
87
- { value: "unmarried", display: "Unmarried", description: "Person is not married", status: "Active" },
88
- { value: "widowed", display: "Widowed", description: "Person is widowed due to the death of their spouse", status: "Active" },
89
- { value: "divorced", display: "Divorced", description: "Person is legally divorced", status: "Active" }
144
+ {
145
+ value: "married",
146
+ display: "Married",
147
+ description: "Person is married",
148
+ status: "Active"
149
+ },
150
+ {
151
+ value: "unmarried",
152
+ display: "Unmarried",
153
+ description: "Person is not married",
154
+ status: "Active"
155
+ },
156
+ {
157
+ value: "widowed",
158
+ display: "Widowed",
159
+ description: "Person is widowed due to the death of their spouse",
160
+ status: "Active"
161
+ },
162
+ {
163
+ value: "divorced",
164
+ display: "Divorced",
165
+ description: "Person is legally divorced",
166
+ status: "Active"
167
+ }
90
168
  ]
91
169
  },
92
170
  {
@@ -97,9 +175,24 @@ var registry_default = {
97
175
  description: "Resource operational status",
98
176
  type: "parameter",
99
177
  values: [
100
- { value: "open", display: "Open", description: "Resource is open and operating", status: "Active" },
101
- { value: "closed", display: "Closed", description: "Resource is closed and not operating", status: "Active" },
102
- { value: "maintenance", display: "Maintenance", description: "Resource is in maintenance and not operating", status: "Active" }
178
+ {
179
+ value: "open",
180
+ display: "Open",
181
+ description: "Resource is open and operating",
182
+ status: "Active"
183
+ },
184
+ {
185
+ value: "closed",
186
+ display: "Closed",
187
+ description: "Resource is closed and not operating",
188
+ status: "Active"
189
+ },
190
+ {
191
+ value: "maintenance",
192
+ display: "Maintenance",
193
+ description: "Resource is in maintenance and not operating",
194
+ status: "Active"
195
+ }
103
196
  ]
104
197
  },
105
198
  {
@@ -110,9 +203,30 @@ var registry_default = {
110
203
  description: "Queue number status",
111
204
  type: "parameter",
112
205
  values: [
113
- { value: "idle", display: "Idle", description: "Queue number are not in progress", status: "Active" },
114
- { value: "in-progress", display: "In Progress", description: "Queue number are in progress", status: "Active" },
115
- { value: "done", display: "Done", description: "Queue number are done with service", status: "Active" }
206
+ {
207
+ value: "idle",
208
+ display: "Idle",
209
+ description: "Queue number are not in progress",
210
+ status: "Active"
211
+ },
212
+ {
213
+ value: "in-progress",
214
+ display: "In Progress",
215
+ description: "Queue number are in progress",
216
+ status: "Active"
217
+ },
218
+ {
219
+ value: "done",
220
+ display: "Done",
221
+ description: "Queue number are done with service",
222
+ status: "Active"
223
+ },
224
+ {
225
+ value: "skip",
226
+ display: "Skip",
227
+ description: "Indicate the queue number are skipped and at the bottom of call priority",
228
+ status: "Active"
229
+ }
116
230
  ]
117
231
  },
118
232
  {
@@ -123,9 +237,24 @@ var registry_default = {
123
237
  description: "Person salutations/honorifics",
124
238
  type: "parameter",
125
239
  values: [
126
- { value: "tuan", display: "Tn.", description: "Adult male honorific or title (Mr.)", status: "Active" },
127
- { value: "nyonya", display: "Ny.", description: "Married or adult female honorific or title (Mrs.)", status: "Active" },
128
- { value: "anak", display: "An.", description: "Child or pediatric patient honorific", status: "Active" }
240
+ {
241
+ value: "tuan",
242
+ display: "Tn.",
243
+ description: "Adult male honorific or title (Mr.)",
244
+ status: "Active"
245
+ },
246
+ {
247
+ value: "nyonya",
248
+ display: "Ny.",
249
+ description: "Married or adult female honorific or title (Mrs.)",
250
+ status: "Active"
251
+ },
252
+ {
253
+ value: "anak",
254
+ display: "An.",
255
+ description: "Child or pediatric patient honorific",
256
+ status: "Active"
257
+ }
129
258
  ]
130
259
  },
131
260
  {
@@ -136,9 +265,24 @@ var registry_default = {
136
265
  description: "Biological and physiological characteristics",
137
266
  type: "parameter",
138
267
  values: [
139
- { value: "m", display: "Male", description: "Male characteristics", status: "Active" },
140
- { value: "f", display: "Female", description: "Female characteristics", status: "Active" },
141
- { value: "i", display: "Intersex", description: "Biological sex characteristics that do not fit typical medical definitions", status: "Proposed" }
268
+ {
269
+ value: "m",
270
+ display: "Male",
271
+ description: "Male characteristics",
272
+ status: "Active"
273
+ },
274
+ {
275
+ value: "f",
276
+ display: "Female",
277
+ description: "Female characteristics",
278
+ status: "Active"
279
+ },
280
+ {
281
+ value: "i",
282
+ display: "Intersex",
283
+ description: "Biological sex characteristics that do not fit typical medical definitions",
284
+ status: "Proposed"
285
+ }
142
286
  ]
143
287
  },
144
288
  {
@@ -149,12 +293,42 @@ var registry_default = {
149
293
  description: "Religion or belief system",
150
294
  type: "parameter",
151
295
  values: [
152
- { value: "islam", display: "Islam", description: "The islamic belief system", status: "Active" },
153
- { value: "protestantism", display: "Protestant", description: "The protestantism belief system", status: "Active" },
154
- { value: "catholicism", display: "Catholic", description: "The catholicism belief system", status: "Active" },
155
- { value: "hinduism", display: "Hindu", description: "The hinduism belief system", status: "Active" },
156
- { value: "buddhism", display: "Buddha", description: "The buddhism belief system", status: "Active" },
157
- { value: "confucianism", display: "Confucian", description: "The confucianism belief system", status: "Active" }
296
+ {
297
+ value: "islam",
298
+ display: "Islam",
299
+ description: "The islamic belief system",
300
+ status: "Active"
301
+ },
302
+ {
303
+ value: "protestantism",
304
+ display: "Protestant",
305
+ description: "The protestantism belief system",
306
+ status: "Active"
307
+ },
308
+ {
309
+ value: "catholicism",
310
+ display: "Catholic",
311
+ description: "The catholicism belief system",
312
+ status: "Active"
313
+ },
314
+ {
315
+ value: "hinduism",
316
+ display: "Hindu",
317
+ description: "The hinduism belief system",
318
+ status: "Active"
319
+ },
320
+ {
321
+ value: "buddhism",
322
+ display: "Buddha",
323
+ description: "The buddhism belief system",
324
+ status: "Active"
325
+ },
326
+ {
327
+ value: "confucianism",
328
+ display: "Confucian",
329
+ description: "The confucianism belief system",
330
+ status: "Active"
331
+ }
158
332
  ]
159
333
  },
160
334
  {
@@ -165,10 +339,30 @@ var registry_default = {
165
339
  description: "Blood group types",
166
340
  type: "parameter",
167
341
  values: [
168
- { value: "a", display: "A", description: "Blood group A", status: "Active" },
169
- { value: "b", display: "B", description: "Blood group B", status: "Active" },
170
- { value: "ab", display: "AB", description: "Blood group AB", status: "Active" },
171
- { value: "o", display: "O", description: "Blood group O", status: "Active" }
342
+ {
343
+ value: "a",
344
+ display: "A",
345
+ description: "Blood group A",
346
+ status: "Active"
347
+ },
348
+ {
349
+ value: "b",
350
+ display: "B",
351
+ description: "Blood group B",
352
+ status: "Active"
353
+ },
354
+ {
355
+ value: "ab",
356
+ display: "AB",
357
+ description: "Blood group AB",
358
+ status: "Active"
359
+ },
360
+ {
361
+ value: "o",
362
+ display: "O",
363
+ description: "Blood group O",
364
+ status: "Active"
365
+ }
172
366
  ]
173
367
  },
174
368
  {
@@ -179,8 +373,18 @@ var registry_default = {
179
373
  description: "RhD antigen presence",
180
374
  type: "parameter",
181
375
  values: [
182
- { value: "positive", display: "Rh-Positive (+)", description: "Presence of Rhesus (RhD) antigen", status: "Active" },
183
- { value: "negative", display: "Rh-Negative (-)", description: "Absence of Rhesus (RhD) antigen", status: "Active" }
376
+ {
377
+ value: "positive",
378
+ display: "Rh-Positive (+)",
379
+ description: "Presence of Rhesus (RhD) antigen",
380
+ status: "Active"
381
+ },
382
+ {
383
+ value: "negative",
384
+ display: "Rh-Negative (-)",
385
+ description: "Absence of Rhesus (RhD) antigen",
386
+ status: "Active"
387
+ }
184
388
  ]
185
389
  },
186
390
  {
@@ -191,9 +395,24 @@ var registry_default = {
191
395
  description: "Priority/precedence levels",
192
396
  type: "parameter",
193
397
  values: [
194
- { value: "primary", display: "Primary", description: "Highest level of priority", status: "Active" },
195
- { value: "secondary", display: "Secondary", description: "Secondary level of priority", status: "Active" },
196
- { value: "tertiary", display: "Tertiary", description: "Third-tier or lowest level of priority", status: "Active" }
398
+ {
399
+ value: "primary",
400
+ display: "Primary",
401
+ description: "Highest level of priority",
402
+ status: "Active"
403
+ },
404
+ {
405
+ value: "secondary",
406
+ display: "Secondary",
407
+ description: "Secondary level of priority",
408
+ status: "Active"
409
+ },
410
+ {
411
+ value: "tertiary",
412
+ display: "Tertiary",
413
+ description: "Third-tier or lowest level of priority",
414
+ status: "Active"
415
+ }
197
416
  ]
198
417
  },
199
418
  {
@@ -204,11 +423,36 @@ var registry_default = {
204
423
  description: "Intensity/severity levels",
205
424
  type: "parameter",
206
425
  values: [
207
- { value: "very-low", display: "Very Low", description: "Minimal or lowest level of intensity", status: "Active" },
208
- { value: "low", display: "Low", description: "Minor or low level of intensity", status: "Active" },
209
- { value: "medium", display: "Medium", description: "Moderate or average level of intensity", status: "Active" },
210
- { value: "high", display: "High", description: "High or elevated level of intensity", status: "Active" },
211
- { value: "very-high", display: "Very High", description: "Extreme or critical level of intensity", status: "Active" }
426
+ {
427
+ value: "very-low",
428
+ display: "Very Low",
429
+ description: "Minimal or lowest level of intensity",
430
+ status: "Active"
431
+ },
432
+ {
433
+ value: "low",
434
+ display: "Low",
435
+ description: "Minor or low level of intensity",
436
+ status: "Active"
437
+ },
438
+ {
439
+ value: "medium",
440
+ display: "Medium",
441
+ description: "Moderate or average level of intensity",
442
+ status: "Active"
443
+ },
444
+ {
445
+ value: "high",
446
+ display: "High",
447
+ description: "High or elevated level of intensity",
448
+ status: "Active"
449
+ },
450
+ {
451
+ value: "very-high",
452
+ display: "Very High",
453
+ description: "Extreme or critical level of intensity",
454
+ status: "Active"
455
+ }
212
456
  ]
213
457
  },
214
458
  {
@@ -219,9 +463,24 @@ var registry_default = {
219
463
  description: "Medical Record Number separators",
220
464
  type: "parameter",
221
465
  values: [
222
- { value: "dash", display: "Dash (-)", description: "Use dash as separator", status: "Active" },
223
- { value: "dot", display: "Dot (.)", description: "Use dot as separator", status: "Active" },
224
- { value: "none", display: "None", description: "No separator", status: "Active" }
466
+ {
467
+ value: "dash",
468
+ display: "Dash (-)",
469
+ description: "Use dash as separator",
470
+ status: "Active"
471
+ },
472
+ {
473
+ value: "dot",
474
+ display: "Dot (.)",
475
+ description: "Use dot as separator",
476
+ status: "Active"
477
+ },
478
+ {
479
+ value: "none",
480
+ display: "None",
481
+ description: "No separator",
482
+ status: "Active"
483
+ }
225
484
  ]
226
485
  },
227
486
  {
@@ -232,11 +491,36 @@ var registry_default = {
232
491
  description: "Types of patient additional information",
233
492
  type: "parameter",
234
493
  values: [
235
- { value: "emergency-contact", display: "Emergency Contact", description: "Patient emergency contact info", status: "Active" },
236
- { value: "emergency-address", display: "Emergency Address", description: "Patient emergency address info", status: "Active" },
237
- { value: "relationship", display: "Relationship", description: "Patient relationship information", status: "Active" },
238
- { value: "blood-info", display: "Blood Information", description: "Patient blood information", status: "Active" },
239
- { value: "payer", display: "Payer Information", description: "Patient payer information", status: "Active" }
494
+ {
495
+ value: "emergency-contact",
496
+ display: "Emergency Contact",
497
+ description: "Patient emergency contact info",
498
+ status: "Active"
499
+ },
500
+ {
501
+ value: "emergency-address",
502
+ display: "Emergency Address",
503
+ description: "Patient emergency address info",
504
+ status: "Active"
505
+ },
506
+ {
507
+ value: "relationship",
508
+ display: "Relationship",
509
+ description: "Patient relationship information",
510
+ status: "Active"
511
+ },
512
+ {
513
+ value: "blood-info",
514
+ display: "Blood Information",
515
+ description: "Patient blood information",
516
+ status: "Active"
517
+ },
518
+ {
519
+ value: "payer",
520
+ display: "Payer Information",
521
+ description: "Patient payer information",
522
+ status: "Active"
523
+ }
240
524
  ]
241
525
  },
242
526
  {
@@ -247,10 +531,30 @@ var registry_default = {
247
531
  description: "Healthcare payer categories",
248
532
  type: "parameter",
249
533
  values: [
250
- { value: "insurance", display: "Insurance", description: "Third-party health insurance payer", status: "Active" },
251
- { value: "government", display: "Government", description: "Government-sponsored health program", status: "Active" },
252
- { value: "corporate", display: "Corporate", description: "Company-sponsored health benefit", status: "Active" },
253
- { value: "self", display: "Self", description: "Patient pay out of pocket", status: "Active" }
534
+ {
535
+ value: "insurance",
536
+ display: "Insurance",
537
+ description: "Third-party health insurance payer",
538
+ status: "Active"
539
+ },
540
+ {
541
+ value: "government",
542
+ display: "Government",
543
+ description: "Government-sponsored health program",
544
+ status: "Active"
545
+ },
546
+ {
547
+ value: "corporate",
548
+ display: "Corporate",
549
+ description: "Company-sponsored health benefit",
550
+ status: "Active"
551
+ },
552
+ {
553
+ value: "self",
554
+ display: "Self",
555
+ description: "Patient pay out of pocket",
556
+ status: "Active"
557
+ }
254
558
  ]
255
559
  },
256
560
  {
@@ -261,8 +565,40 @@ var registry_default = {
261
565
  description: "Queue processing stages",
262
566
  type: "parameter",
263
567
  values: [
264
- { value: "waiting", display: "Waiting", description: "Waiting stage", status: "Active" },
265
- { value: "processing", display: "Processing", description: "Processing stage", status: "Active" }
568
+ {
569
+ value: "waiting",
570
+ display: "Waiting",
571
+ description: "Waiting stage",
572
+ status: "Active"
573
+ },
574
+ {
575
+ value: "processing",
576
+ display: "Processing",
577
+ description: "Processing stage",
578
+ status: "Active"
579
+ }
580
+ ]
581
+ },
582
+ {
583
+ system: "crn:queue:priority",
584
+ domain: "queue",
585
+ variant: "priority",
586
+ display: "Queue Priority",
587
+ description: "Queue sort and call priority",
588
+ type: "parameter",
589
+ values: [
590
+ {
591
+ value: "sequence",
592
+ display: "Sequence",
593
+ description: "Based on queue sequence number",
594
+ status: "Active"
595
+ },
596
+ {
597
+ value: "arrival",
598
+ display: "Arrival",
599
+ description: "Based on queue arrival",
600
+ status: "Active"
601
+ }
266
602
  ]
267
603
  },
268
604
  {
@@ -273,13 +609,48 @@ var registry_default = {
273
609
  description: "Family relationship types",
274
610
  type: "parameter",
275
611
  values: [
276
- { value: "spouse", display: "Spouse", description: "Partner in a marriage or legal union", status: "Active" },
277
- { value: "father", display: "Father", description: "Male parent", status: "Active" },
278
- { value: "mother", display: "Mother", description: "Female parent", status: "Active" },
279
- { value: "grandfather", display: "Grandfather", description: "Father of a person's father or mother", status: "Active" },
280
- { value: "grandmother", display: "Grandmother", description: "Mother of a person's father or mother", status: "Active" },
281
- { value: "grandchildren", display: "Grandchildren", description: "Child or children of a person's son or daughter", status: "Active" },
282
- { value: "children", display: "Children", description: "Person's offspring or child", status: "Active" }
612
+ {
613
+ value: "spouse",
614
+ display: "Spouse",
615
+ description: "Partner in a marriage or legal union",
616
+ status: "Active"
617
+ },
618
+ {
619
+ value: "father",
620
+ display: "Father",
621
+ description: "Male parent",
622
+ status: "Active"
623
+ },
624
+ {
625
+ value: "mother",
626
+ display: "Mother",
627
+ description: "Female parent",
628
+ status: "Active"
629
+ },
630
+ {
631
+ value: "grandfather",
632
+ display: "Grandfather",
633
+ description: "Father of a person's father or mother",
634
+ status: "Active"
635
+ },
636
+ {
637
+ value: "grandmother",
638
+ display: "Grandmother",
639
+ description: "Mother of a person's father or mother",
640
+ status: "Active"
641
+ },
642
+ {
643
+ value: "grandchildren",
644
+ display: "Grandchildren",
645
+ description: "Child or children of a person's son or daughter",
646
+ status: "Active"
647
+ },
648
+ {
649
+ value: "children",
650
+ display: "Children",
651
+ description: "Person's offspring or child",
652
+ status: "Active"
653
+ }
283
654
  ]
284
655
  },
285
656
  {
@@ -290,8 +661,18 @@ var registry_default = {
290
661
  description: "Practitioner schedule types",
291
662
  type: "parameter",
292
663
  values: [
293
- { value: "recurring", display: "Recurring", description: "A recurring schedule", status: "Active" },
294
- { value: "one-time", display: "One-Time", description: "A one-time schedule", status: "Active" }
664
+ {
665
+ value: "recurring",
666
+ display: "Recurring",
667
+ description: "A recurring schedule",
668
+ status: "Active"
669
+ },
670
+ {
671
+ value: "one-time",
672
+ display: "One-Time",
673
+ description: "A one-time schedule",
674
+ status: "Active"
675
+ }
295
676
  ]
296
677
  },
297
678
  {
@@ -302,9 +683,24 @@ var registry_default = {
302
683
  description: "Department classifications",
303
684
  type: "parameter",
304
685
  values: [
305
- { value: "medical", display: "Medical", description: "Department for medical affair", status: "Active" },
306
- { value: "administrative", display: "Administrative", description: "Department for administrative affair", status: "Active" },
307
- { value: "operational", display: "Operational", description: "Department for operational affair", status: "Active" }
686
+ {
687
+ value: "medical",
688
+ display: "Medical",
689
+ description: "Department for medical affair",
690
+ status: "Active"
691
+ },
692
+ {
693
+ value: "administrative",
694
+ display: "Administrative",
695
+ description: "Department for administrative affair",
696
+ status: "Active"
697
+ },
698
+ {
699
+ value: "operational",
700
+ display: "Operational",
701
+ description: "Department for operational affair",
702
+ status: "Active"
703
+ }
308
704
  ]
309
705
  },
310
706
  {
@@ -315,10 +711,36 @@ var registry_default = {
315
711
  description: "Unit classifications",
316
712
  type: "parameter",
317
713
  values: [
318
- { value: "medical-service", display: "Medical Service", description: "Unit that provide medical service", status: "Active" },
319
- { value: "pharmacy", display: "Pharmacy", description: "Unit for pharmacy", status: "Active" },
320
- { value: "ancillary", display: "Ancillary", description: "Unit for ancillary services", status: "Active" },
321
- { value: "service-counter", display: "Service Counter", description: "Unit that act as counter for various purposes", status: "Active" }
714
+ {
715
+ value: "medical-service",
716
+ display: "Medical Service",
717
+ description: "Unit that provide medical service",
718
+ status: "Active"
719
+ },
720
+ {
721
+ value: "pharmacy",
722
+ display: "Pharmacy",
723
+ description: "Unit for pharmacy",
724
+ status: "Active"
725
+ },
726
+ {
727
+ value: "ancillary",
728
+ display: "Ancillary",
729
+ description: "Unit for ancillary services",
730
+ status: "Active"
731
+ },
732
+ {
733
+ value: "service-counter",
734
+ display: "Service Counter",
735
+ description: "Unit that act as counter for various purposes",
736
+ status: "Active"
737
+ },
738
+ {
739
+ value: "cashier",
740
+ display: "Cashier",
741
+ description: "Unit that act as counter for cashier",
742
+ status: "Active"
743
+ }
322
744
  ]
323
745
  },
324
746
  {
@@ -329,10 +751,30 @@ var registry_default = {
329
751
  description: "Location classifications",
330
752
  type: "parameter",
331
753
  values: [
332
- { value: "building", display: "Building", description: "A building", status: "Active" },
333
- { value: "level", display: "Level", description: "A floor level", status: "Active" },
334
- { value: "bed", display: "Bed", description: "A bed", status: "Active" },
335
- { value: "cabinet", display: "Cabinet", description: "A cabinet", status: "Active" }
754
+ {
755
+ value: "building",
756
+ display: "Building",
757
+ description: "A building",
758
+ status: "Active"
759
+ },
760
+ {
761
+ value: "level",
762
+ display: "Level",
763
+ description: "A floor level",
764
+ status: "Active"
765
+ },
766
+ {
767
+ value: "bed",
768
+ display: "Bed",
769
+ description: "A bed",
770
+ status: "Active"
771
+ },
772
+ {
773
+ value: "cabinet",
774
+ display: "Cabinet",
775
+ description: "A cabinet",
776
+ status: "Active"
777
+ }
336
778
  ]
337
779
  },
338
780
  {
@@ -343,9 +785,24 @@ var registry_default = {
343
785
  description: "Staff classifications",
344
786
  type: "parameter",
345
787
  values: [
346
- { value: "practitioner", display: "Practitioner", description: "Healthcare practitioner (i.e. Doctor)", status: "Active" },
347
- { value: "medical", display: "Medical", description: "Medical staff (i.e. Nurse, Therapist)", status: "Active" },
348
- { value: "non-medical", display: "Non Medical", description: "Non medical staff (i.e. Administrator staff)", status: "Active" }
788
+ {
789
+ value: "practitioner",
790
+ display: "Practitioner",
791
+ description: "Healthcare practitioner (i.e. Doctor)",
792
+ status: "Active"
793
+ },
794
+ {
795
+ value: "medical",
796
+ display: "Medical",
797
+ description: "Medical staff (i.e. Nurse, Therapist)",
798
+ status: "Active"
799
+ },
800
+ {
801
+ value: "non-medical",
802
+ display: "Non Medical",
803
+ description: "Non medical staff (i.e. Administrator staff)",
804
+ status: "Active"
805
+ }
349
806
  ]
350
807
  },
351
808
  {
@@ -356,8 +813,18 @@ var registry_default = {
356
813
  description: "Resource assignment types",
357
814
  type: "parameter",
358
815
  values: [
359
- { value: "staff-to-unit", display: "Staff to Unit", description: "Assignment of staff to a unit", status: "Active" },
360
- { value: "location-to-unit", display: "Location to Unit", description: "Assignment of location to a unit", status: "Active" }
816
+ {
817
+ value: "staff-to-unit",
818
+ display: "Staff to Unit",
819
+ description: "Assignment of staff to a unit",
820
+ status: "Active"
821
+ },
822
+ {
823
+ value: "location-to-unit",
824
+ display: "Location to Unit",
825
+ description: "Assignment of location to a unit",
826
+ status: "Active"
827
+ }
361
828
  ]
362
829
  },
363
830
  {
@@ -368,12 +835,42 @@ var registry_default = {
368
835
  description: "Person identifier types",
369
836
  type: "parameter",
370
837
  values: [
371
- { value: "nik", display: "NIK", description: "Nomor Induk Kependudukan", status: "Active" },
372
- { value: "mrn", display: "MRN", description: "Medical Record Number", status: "Active" },
373
- { value: "passport", display: "Passport Number", description: "Passport Number", status: "Active" },
374
- { value: "str", display: "STR", description: "Surat Tanda Registrasi by Konsil Kedokteran Indonesia", status: "Active" },
375
- { value: "sip", display: "SIP", description: "Surat Izin Praktik by Dinas Kesehatan", status: "Active" },
376
- { value: "npa", display: "NPA", description: "Nomor Pokok Anggota by Ikatan Dokter Indonesia", status: "Active" }
838
+ {
839
+ value: "nik",
840
+ display: "NIK",
841
+ description: "Nomor Induk Kependudukan",
842
+ status: "Active"
843
+ },
844
+ {
845
+ value: "mrn",
846
+ display: "MRN",
847
+ description: "Medical Record Number",
848
+ status: "Active"
849
+ },
850
+ {
851
+ value: "passport",
852
+ display: "Passport Number",
853
+ description: "Passport Number",
854
+ status: "Active"
855
+ },
856
+ {
857
+ value: "str",
858
+ display: "STR",
859
+ description: "Surat Tanda Registrasi by Konsil Kedokteran Indonesia",
860
+ status: "Active"
861
+ },
862
+ {
863
+ value: "sip",
864
+ display: "SIP",
865
+ description: "Surat Izin Praktik by Dinas Kesehatan",
866
+ status: "Active"
867
+ },
868
+ {
869
+ value: "npa",
870
+ display: "NPA",
871
+ description: "Nomor Pokok Anggota by Ikatan Dokter Indonesia",
872
+ status: "Active"
873
+ }
377
874
  ]
378
875
  },
379
876
  {
@@ -384,10 +881,30 @@ var registry_default = {
384
881
  description: "Method of contacting a person",
385
882
  type: "label",
386
883
  values: [
387
- { value: "mobile", display: "Mobile", description: "Cellular or mobile phone contact number", status: "Active" },
388
- { value: "phone", display: "Phone", description: "Landline or primary telephone contact number", status: "Active" },
389
- { value: "email", display: "Email", description: "Electronic mail address for digital communication", status: "Active" },
390
- { value: "fax", display: "Fax", description: "Facsimile machine contact number", status: "Active" }
884
+ {
885
+ value: "mobile",
886
+ display: "Mobile",
887
+ description: "Cellular or mobile phone contact number",
888
+ status: "Active"
889
+ },
890
+ {
891
+ value: "phone",
892
+ display: "Phone",
893
+ description: "Landline or primary telephone contact number",
894
+ status: "Active"
895
+ },
896
+ {
897
+ value: "email",
898
+ display: "Email",
899
+ description: "Electronic mail address for digital communication",
900
+ status: "Active"
901
+ },
902
+ {
903
+ value: "fax",
904
+ display: "Fax",
905
+ description: "Facsimile machine contact number",
906
+ status: "Active"
907
+ }
391
908
  ]
392
909
  },
393
910
  {
@@ -398,9 +915,24 @@ var registry_default = {
398
915
  description: "System event types",
399
916
  type: "parameter",
400
917
  values: [
401
- { value: "create", display: "Create", description: "Event triggered when creating a resource", status: "Active" },
402
- { value: "update", display: "Update", description: "Event triggered when updating a resource", status: "Active" },
403
- { value: "delete", display: "Delete", description: "Event triggered when deleting a resource", status: "Active" }
918
+ {
919
+ value: "create",
920
+ display: "Create",
921
+ description: "Event triggered when creating a resource",
922
+ status: "Active"
923
+ },
924
+ {
925
+ value: "update",
926
+ display: "Update",
927
+ description: "Event triggered when updating a resource",
928
+ status: "Active"
929
+ },
930
+ {
931
+ value: "delete",
932
+ display: "Delete",
933
+ description: "Event triggered when deleting a resource",
934
+ status: "Active"
935
+ }
404
936
  ]
405
937
  },
406
938
  {
@@ -411,10 +943,30 @@ var registry_default = {
411
943
  description: "Queue event types",
412
944
  type: "parameter",
413
945
  values: [
414
- { value: "called", display: "Called", description: "Event triggered when calling a queue number", status: "Active" },
415
- { value: "skipped", display: "Skipped", description: "Event triggered when skipping a queue number", status: "Active" },
416
- { value: "noshow", display: "No Show", description: "Event triggered when patient fails to show up", status: "Active" },
417
- { value: "arrived", display: "Arrived", description: "Event triggered when patient arrives at the location", status: "Active" }
946
+ {
947
+ value: "called",
948
+ display: "Called",
949
+ description: "Event triggered when calling a queue number",
950
+ status: "Active"
951
+ },
952
+ {
953
+ value: "skipped",
954
+ display: "Skipped",
955
+ description: "Event triggered when skipping a queue number",
956
+ status: "Active"
957
+ },
958
+ {
959
+ value: "noshow",
960
+ display: "No Show",
961
+ description: "Event triggered when patient fails to show up",
962
+ status: "Active"
963
+ },
964
+ {
965
+ value: "arrived",
966
+ display: "Arrived",
967
+ description: "Event triggered when patient arrives at the location",
968
+ status: "Active"
969
+ }
418
970
  ]
419
971
  }
420
972
  ]
@@ -447,11 +999,11 @@ var codedConceptSchema = z5.z.object({
447
999
  });
448
1000
  var demographicSchema = z5__default.default.object({
449
1001
  sex: codedConceptSchema,
450
- religion: codedConceptSchema,
451
- ethnicity: z5__default.default.string().optional(),
452
- marital_status: codedConceptSchema,
453
- date_of_birth: z5__default.default.string(),
454
- place_of_birth: z5__default.default.string().optional()
1002
+ religion: codedConceptSchema.nullable(),
1003
+ ethnicity: z5__default.default.string().nullable(),
1004
+ marital_status: codedConceptSchema.nullable(),
1005
+ date_of_birth: z5__default.default.string().nullable(),
1006
+ place_of_birth: z5__default.default.string().nullable()
455
1007
  });
456
1008
  var addressSchema = z5.z.object({
457
1009
  street: z5.z.string().min(1, { message: "street is required" }),
@@ -466,6 +1018,23 @@ var objectIdSchema = z5.z.string().length(24, {
466
1018
  }).regex(/^[0-9a-fA-F]{24}$/, {
467
1019
  message: "ObjectId must be a valid MongoDB ObjectId (24-character hex string)"
468
1020
  });
1021
+ var baseSchema = (version) => z5.z.object({
1022
+ _id: objectIdSchema,
1023
+ created_at: timestampSchema,
1024
+ created_by: z5.z.string().min(1, { message: "created_by is required" }),
1025
+ updated_at: timestampSchema,
1026
+ updated_by: z5.z.string().min(1, { message: "updated_by is required" }),
1027
+ schema_version: z5.z.number().int().positive().default(version)
1028
+ });
1029
+ var baseSchemaWithExpiredAt = (version) => z5.z.object({
1030
+ _id: objectIdSchema,
1031
+ created_at: timestampSchema,
1032
+ created_by: z5.z.string().min(1, { message: "created_by is required" }),
1033
+ updated_at: timestampSchema,
1034
+ updated_by: z5.z.string().min(1, { message: "updated_by is required" }),
1035
+ expired_at: timestampSchema,
1036
+ schema_version: z5.z.number().int().positive().default(version)
1037
+ });
469
1038
  var USER_SCHEMA_VERSION = 1;
470
1039
  var userSchema = z5.z.object({
471
1040
  id: z5.z.string(),
@@ -527,25 +1096,23 @@ var userMinimalSchema = userSchema.omit({
527
1096
 
528
1097
  // src/models/user/user-partial.schema.ts
529
1098
  var userPartialSchema = userMinimalSchema.partial();
530
- var nonEmpty = z5.z.string().min(1, { message: "assigned_to is required" });
531
1099
  var ASSIGNMENT_SCHEMA_VERSION = 1;
532
- var assignmentSchema = z5.z.object({
533
- _id: objectIdSchema,
1100
+ var assignmentSchema = baseSchema(ASSIGNMENT_SCHEMA_VERSION).extend({
534
1101
  facility_id: objectIdSchema,
535
1102
  type: codedConceptSchema,
536
1103
  for: z5.z.string().min(1, { message: "for is required" }),
537
- assigned_to: z5.z.union([nonEmpty, z5.z.array(nonEmpty)]).transform((val) => Array.isArray(val) ? val : [val]).refine((arr) => arr.length >= 1, {
538
- message: "assigned_to is required"
539
- }),
540
- created_at: z5.z.string(),
541
- created_by: z5.z.string(),
542
- updated_at: z5.z.string(),
543
- updated_by: z5.z.string(),
544
- schema_version: z5.z.number().int().positive().default(ASSIGNMENT_SCHEMA_VERSION)
1104
+ assigned_to: z5.z.array(
1105
+ z5.z.string().min(1, {
1106
+ message: "assigned_to is required"
1107
+ })
1108
+ ).min(1)
545
1109
  });
546
1110
  var AssignmentMongooseSchema = zodMongoose.toMongooseSchema(assignmentSchema);
547
1111
  var AssignmentModelName = "assignments";
548
- var AssignmentModel = mongoose.model(AssignmentModelName, AssignmentMongooseSchema);
1112
+ var AssignmentModel = mongoose.model(
1113
+ AssignmentModelName,
1114
+ AssignmentMongooseSchema
1115
+ );
549
1116
 
550
1117
  // src/models/assignment/assignment-minimal.schema.ts
551
1118
  var assignmentMinimalSchema = assignmentSchema.omit({
@@ -560,16 +1127,10 @@ var assignmentMinimalSchema = assignmentSchema.omit({
560
1127
  // src/models/assignment/assignment-partial.schema.ts
561
1128
  var assignmentPartialSchema = assignmentMinimalSchema.partial();
562
1129
  var DEPARTMENT_SCHEMA_VERSION = 1;
563
- var departmentSchema = z5.z.object({
564
- _id: objectIdSchema,
1130
+ var departmentSchema = baseSchema(DEPARTMENT_SCHEMA_VERSION).extend({
565
1131
  facility_id: objectIdSchema,
566
1132
  name: z5.z.string().min(1, { message: "name is required" }),
567
- type: codedConceptSchema,
568
- created_at: z5.z.string(),
569
- created_by: z5.z.string(),
570
- updated_at: z5.z.string(),
571
- updated_by: z5.z.string(),
572
- schema_version: z5.z.number().int().positive().default(DEPARTMENT_SCHEMA_VERSION)
1133
+ type: codedConceptSchema
573
1134
  });
574
1135
  var DepartmentMongooseSchema = zodMongoose.toMongooseSchema(departmentSchema);
575
1136
  var DepartmentModelName = "departments";
@@ -606,10 +1167,15 @@ var FACILITY_SETTING_FIELDS = [
606
1167
  "satusehat_org_id",
607
1168
  "satusehat_client_id",
608
1169
  "satusehat_client_secret",
1170
+ "queue_number_length",
609
1171
  "queue_number_separator",
610
- "queue_number_prefix",
611
- "queue_no_response_count",
612
- "queue_skip_no_response"
1172
+ "queue_call_threshold",
1173
+ "queue_call_priority",
1174
+ "kiosk_announcements",
1175
+ "kiosk_gallery",
1176
+ "kiosk_faq",
1177
+ "kiosk_services",
1178
+ "payer_types"
613
1179
  ];
614
1180
  var FACILITY_SETTINGS_SCHEMA_VERSION = 1;
615
1181
  var facilitySettingsSchema = z5.z.object({
@@ -626,14 +1192,21 @@ var facilitySettingsSchema = z5.z.object({
626
1192
  schema_version: z5.z.number().int().positive().default(FACILITY_SETTINGS_SCHEMA_VERSION)
627
1193
  });
628
1194
  var facilitySettingsKVSchema = z5.z.object({
629
- branding_logo: z5.z.string().optional(),
630
- satusehat_org_id: z5.z.string().optional(),
631
- satusehat_client_id: z5.z.string().optional(),
632
- satusehat_client_secret: z5.z.string().optional(),
633
- queue_number_separator: z5.z.string().optional(),
634
- queue_number_prefix: z5.z.enum(["none", "payer"]).default("payer"),
635
- queue_no_response_count: z5.z.number().default(3),
636
- queue_skip_no_response: z5.z.boolean().default(true)
1195
+ branding_logo: z5.z.string().nullable(),
1196
+ satusehat_org_id: z5.z.string().nullable(),
1197
+ satusehat_client_id: z5.z.string().nullable(),
1198
+ satusehat_client_secret: z5.z.string().nullable(),
1199
+ queue_number_length: z5.z.number().int().positive().nullable().default(3),
1200
+ queue_number_separator: z5.z.string().nullable(),
1201
+ queue_call_priority: z5.z.string().default("sequence").refine((data) => validateCode("crn:queue:priority", data), {
1202
+ message: "Invalid CodedConcept: system/value combination not found in registry"
1203
+ }),
1204
+ queue_call_threshold: z5.z.number().int().positive().default(3),
1205
+ kiosk_announcements: z5.z.string().array(),
1206
+ kiosk_gallery: z5.z.url().array(),
1207
+ kiosk_faq: z5.z.object({ key: z5.z.string(), value: z5.z.string() }).array(),
1208
+ kiosk_services: z5.z.object({ key: z5.z.string(), value: z5.z.string() }).array(),
1209
+ payer_types: z5.z.string().array()
637
1210
  });
638
1211
 
639
1212
  // src/models/facility/facility-minimal.schema.ts
@@ -646,8 +1219,7 @@ var facilityMinimalSchema = facilitySchema.omit({
646
1219
  // src/models/facility/facility-partial.schema.ts
647
1220
  var facilityPartialSchema = facilityMinimalSchema.partial();
648
1221
  var LOCATION_SCHEMA_VERSION = 1;
649
- var locationSchema = z5.z.object({
650
- _id: objectIdSchema,
1222
+ var locationSchema = baseSchema(LOCATION_SCHEMA_VERSION).extend({
651
1223
  parent_id: objectIdSchema,
652
1224
  identifiers: z5.z.array(codedConceptSchema).nonempty({
653
1225
  message: "identifiers must contain at least one CodedConcept"
@@ -659,12 +1231,7 @@ var locationSchema = z5.z.object({
659
1231
  statuses: z5.z.array(codedConceptSchema).nonempty({
660
1232
  message: "statuses must contain at least one CodedConcept"
661
1233
  }),
662
- settings_id: objectIdSchema,
663
- created_at: timestampSchema,
664
- created_by: z5.z.string(),
665
- updated_at: timestampSchema,
666
- updated_by: z5.z.string(),
667
- schema_version: z5.z.number().int().positive().default(LOCATION_SCHEMA_VERSION)
1234
+ settings_id: objectIdSchema
668
1235
  });
669
1236
  var LocationMongooseSchema = zodMongoose.toMongooseSchema(locationSchema);
670
1237
  var LocationModelName = "locations";
@@ -700,7 +1267,8 @@ var locationMinimalSchema = locationSchema.omit({
700
1267
  created_at: true,
701
1268
  created_by: true,
702
1269
  updated_at: true,
703
- updated_by: true
1270
+ updated_by: true,
1271
+ schema_version: true
704
1272
  });
705
1273
 
706
1274
  // src/models/location/location-partial.schema.ts
@@ -775,28 +1343,26 @@ var organizationMinimalSchema = organizationSchema.omit({
775
1343
  // src/models/organization/organization-partial.schema.ts
776
1344
  var organizationPartialSchema = organizationMinimalSchema.partial();
777
1345
  var PATIENT_SCHEMA_VERSION = 1;
778
- var patientSchema = z5.z.object({
779
- _id: objectIdSchema,
1346
+ var patientSchema = baseSchema(PATIENT_SCHEMA_VERSION).extend({
780
1347
  organization_id: objectIdSchema,
781
1348
  registering_facility_id: objectIdSchema,
782
1349
  identifiers: z5.z.array(codedConceptSchema),
783
- salutation: z5.z.string().min(1, { message: "salutation is required" }),
1350
+ salutation: codedConceptSchema,
784
1351
  first_name: z5.z.string().min(1, { message: "first_name is required" }),
785
1352
  middle_name: z5.z.string().optional(),
786
1353
  last_name: z5.z.string().min(1, { message: "last_name is required" }),
787
1354
  title: z5.z.string().optional(),
788
1355
  image: z5.z.string().optional(),
789
- demographic: demographicSchema,
1356
+ demographic: demographicSchema.extend({
1357
+ place_of_birth: demographicSchema.shape.place_of_birth.unwrap(),
1358
+ date_of_birth: demographicSchema.shape.date_of_birth.unwrap(),
1359
+ marital_status: demographicSchema.shape.marital_status.unwrap()
1360
+ }),
790
1361
  statuses: z5.z.array(codedConceptSchema).nonempty({
791
1362
  message: "statuses must contain at least one CodedConcept"
792
1363
  }),
793
1364
  contacts: z5.z.array(codedConceptSchema).optional(),
794
- address: addressSchema,
795
- created_at: timestampSchema,
796
- created_by: z5.z.string(),
797
- updated_at: timestampSchema,
798
- updated_by: z5.z.string(),
799
- schema_version: z5.z.number().int().positive().default(PATIENT_SCHEMA_VERSION)
1365
+ address: addressSchema
800
1366
  });
801
1367
  var PatientMongooseSchema = zodMongoose.toMongooseSchema(patientSchema);
802
1368
  var PatientModelName = "patients";
@@ -815,16 +1381,10 @@ var patientMinimalSchema = patientSchema.omit({
815
1381
  // src/models/patient/patient-partial.schema.ts
816
1382
  var patientPartialSchema = patientMinimalSchema.partial();
817
1383
  var PATIENT_ADDITIONAL_SCHEMA_VERSION = 1;
818
- var patientAdditionalSchema = z5.z.object({
819
- id: z5.z.string().uuid({ message: "id must be a valid UUID" }),
1384
+ var patientAdditionalSchema = baseSchema(PATIENT_ADDITIONAL_SCHEMA_VERSION).extend({
820
1385
  patient_id: objectIdSchema,
821
1386
  type: codedConceptSchema,
822
- data: z5.z.union([z5.z.object({}), z5.z.array(z5.z.any())]),
823
- created_at: timestampSchema,
824
- created_by: z5.z.string(),
825
- updated_at: timestampSchema,
826
- updated_by: z5.z.string(),
827
- schema_version: z5.z.number().int().positive().default(PATIENT_ADDITIONAL_SCHEMA_VERSION)
1387
+ data: z5.z.union([z5.z.object({}), z5.z.array(z5.z.any())])
828
1388
  });
829
1389
  var PatientAdditionalMongooseSchema = zodMongoose.toMongooseSchema(patientAdditionalSchema);
830
1390
  var PatientAdditionalModelName = "patient_additionals";
@@ -832,7 +1392,7 @@ var PatientAdditionalModel = mongoose.model(PatientAdditionalModelName, PatientA
832
1392
 
833
1393
  // src/models/patient-additional/patient-additional-minimal.schema.ts
834
1394
  var patientAdditionalMinimalSchema = patientAdditionalSchema.omit({
835
- id: true,
1395
+ _id: true,
836
1396
  created_at: true,
837
1397
  created_by: true,
838
1398
  updated_at: true,
@@ -843,20 +1403,14 @@ var patientAdditionalMinimalSchema = patientAdditionalSchema.omit({
843
1403
  // src/models/patient-additional/patient-additional-partial.schema.ts
844
1404
  var patientAdditionalPartialSchema = patientAdditionalMinimalSchema.partial();
845
1405
  var STAFF_SCHEMA_VERSION = 1;
846
- var staffSchema = z5.z.object({
847
- id: z5.z.string().uuid({ message: "id must be a valid UUID" }),
1406
+ var staffSchema = baseSchema(STAFF_SCHEMA_VERSION).extend({
848
1407
  team_id: objectIdSchema,
849
1408
  user_id: objectIdSchema,
850
1409
  type: codedConceptSchema,
851
1410
  status: codedConceptSchema,
852
1411
  membership_key: z5.z.string().optional(),
853
1412
  group: z5.z.string().optional(),
854
- subspecialist: z5.z.string().optional(),
855
- created_at: timestampSchema,
856
- created_by: z5.z.string(),
857
- updated_at: timestampSchema,
858
- updated_by: z5.z.string(),
859
- schema_version: z5.z.number().int().positive().default(STAFF_SCHEMA_VERSION)
1413
+ subspecialist: z5.z.string().optional()
860
1414
  });
861
1415
  var StaffMongooseSchema = zodMongoose.toMongooseSchema(staffSchema);
862
1416
  var StaffModelName = "staffs";
@@ -864,7 +1418,7 @@ var StaffModel = mongoose.model(StaffModelName, StaffMongooseSchema);
864
1418
 
865
1419
  // src/models/staff/staff-minimal.schema.ts
866
1420
  var staffMinimalSchema = staffSchema.omit({
867
- id: true,
1421
+ _id: true,
868
1422
  created_at: true,
869
1423
  created_by: true,
870
1424
  updated_at: true,
@@ -875,8 +1429,7 @@ var staffMinimalSchema = staffSchema.omit({
875
1429
  // src/models/staff/staff-partial.schema.ts
876
1430
  var staffPartialSchema = staffMinimalSchema.partial();
877
1431
  var UNIT_SCHEMA_VERSION = 1;
878
- var unitSchema = z5.z.object({
879
- _id: objectIdSchema,
1432
+ var unitSchema = baseSchema(UNIT_SCHEMA_VERSION).extend({
880
1433
  facility_id: objectIdSchema,
881
1434
  department_id: objectIdSchema,
882
1435
  name: z5.z.string().min(1, { message: "name is required" }),
@@ -885,12 +1438,7 @@ var unitSchema = z5.z.object({
885
1438
  statuses: z5.z.array(codedConceptSchema).nonempty({
886
1439
  message: "statuses must contain at least one CodedConcept"
887
1440
  }),
888
- settings_id: objectIdSchema,
889
- created_at: timestampSchema,
890
- created_by: z5.z.string(),
891
- updated_at: timestampSchema,
892
- updated_by: z5.z.string(),
893
- schema_version: z5.z.number().int().positive().default(UNIT_SCHEMA_VERSION)
1441
+ settings_id: objectIdSchema
894
1442
  });
895
1443
  var UnitMongooseSchema = zodMongoose.toMongooseSchema(unitSchema);
896
1444
  var UnitModelName = "units";
@@ -909,19 +1457,15 @@ var unitMinimalSchema = unitSchema.omit({
909
1457
  // src/models/unit/unit-partial.schema.ts
910
1458
  var unitPartialSchema = unitMinimalSchema.partial();
911
1459
  var PRACTITIONER_SCHEDULE_SCHEMA_VERSION = 1;
912
- var practitionerScheduleSchema = z5.z.object({
1460
+ var practitionerScheduleSchema = baseSchema(
1461
+ PRACTITIONER_SCHEDULE_SCHEMA_VERSION
1462
+ ).extend({
913
1463
  organization_id: objectIdSchema,
914
1464
  facility_id: objectIdSchema,
915
1465
  staff_id: objectIdSchema,
916
1466
  unit_id: objectIdSchema,
917
1467
  type: codedConceptSchema,
918
- day: z5.z.union([z5.z.number(), z5.z.string()]).refine((val) => val != null, { message: "day is required" }),
919
- _id: objectIdSchema,
920
- created_at: timestampSchema.optional(),
921
- created_by: z5.z.string().optional(),
922
- updated_at: timestampSchema.optional(),
923
- updated_by: z5.z.string().optional(),
924
- schema_version: z5.z.number().int().positive().default(PRACTITIONER_SCHEDULE_SCHEMA_VERSION)
1468
+ day: z5.z.union([z5.z.number(), z5.z.string()]).refine((val) => val != null, { message: "day is required" })
925
1469
  });
926
1470
  var PractitionerScheduleMongooseSchema = zodMongoose.toMongooseSchema(practitionerScheduleSchema);
927
1471
  var PractitionerScheduleModelName = "practitioner_schedules";
@@ -940,19 +1484,15 @@ var practitionerScheduleMinimalSchema = practitionerScheduleSchema.omit({
940
1484
  // src/models/practitioner-schedule/practitioner-schedule-partial.schema.ts
941
1485
  var practitionerSchedulePartialSchema = practitionerScheduleMinimalSchema.partial();
942
1486
  var PRACTITIONER_SESSION_SCHEMA_VERSION = 1;
943
- var practitionerSessionSchema = z5.z.object({
1487
+ var practitionerSessionSchema = baseSchema(
1488
+ PRACTITIONER_SESSION_SCHEMA_VERSION
1489
+ ).extend({
944
1490
  schedule_id: objectIdSchema,
945
1491
  staff_id: objectIdSchema,
946
1492
  unit_id: objectIdSchema,
947
1493
  start: z5.z.string().min(1, { message: "start is required" }),
948
1494
  end: z5.z.string().min(1, { message: "end is required" }),
949
- max_quota: z5.z.number().int().positive({ message: "max_quota must be a positive integer" }),
950
- _id: objectIdSchema,
951
- created_at: timestampSchema.optional(),
952
- created_by: z5.z.string().optional(),
953
- updated_at: timestampSchema.optional(),
954
- updated_by: z5.z.string().optional(),
955
- schema_version: z5.z.number().int().positive().default(PRACTITIONER_SESSION_SCHEMA_VERSION)
1495
+ max_quota: z5.z.number().int().positive({ message: "max_quota must be a positive integer" })
956
1496
  });
957
1497
  var PractitionerSessionMongooseSchema = zodMongoose.toMongooseSchema(practitionerSessionSchema);
958
1498
  var PractitionerSessionModelName = "practitioner_sessions";
@@ -971,17 +1511,11 @@ var practitionerSessionMinimalSchema = practitionerSessionSchema.omit({
971
1511
  // src/models/practitioner-session/practitioner-session-partial.schema.ts
972
1512
  var practitionerSessionPartialSchema = practitionerSessionMinimalSchema.partial();
973
1513
  var KSM_SCHEMA_VERSION = 1;
974
- var ksmSchema = z5.z.object({
975
- id: z5.z.string().uuid({ message: "id must be a valid UUID" }),
1514
+ var ksmSchema = baseSchema(KSM_SCHEMA_VERSION).extend({
976
1515
  organization_id: objectIdSchema,
977
1516
  facility_id: objectIdSchema,
978
1517
  name: z5.z.string().min(1, { message: "name is required" }),
979
- subspecialist: z5.z.array(z5.z.string()).min(1, { message: "subspecialist is required" }),
980
- created_at: timestampSchema,
981
- created_by: z5.z.string().min(1, { message: "created_by is required" }),
982
- updated_at: timestampSchema.nullable(),
983
- updated_by: z5.z.string().nullable(),
984
- schema_version: z5.z.number().int().positive().default(KSM_SCHEMA_VERSION)
1518
+ subspecialist: z5.z.array(z5.z.string()).min(1, { message: "subspecialist is required" })
985
1519
  });
986
1520
  var KsmMongooseSchema = zodMongoose.toMongooseSchema(ksmSchema);
987
1521
  var KsmModelName = "medical_staff_groups";
@@ -989,7 +1523,7 @@ var KsmModel = mongoose.model(KsmModelName, KsmMongooseSchema);
989
1523
 
990
1524
  // src/models/ksm/ksm-minimal.schema.ts
991
1525
  var ksmMinimalSchema = ksmSchema.omit({
992
- id: true,
1526
+ _id: true,
993
1527
  created_at: true,
994
1528
  created_by: true,
995
1529
  updated_at: true,
@@ -1001,8 +1535,7 @@ var ksmMinimalSchema = ksmSchema.omit({
1001
1535
  var ksmPartialSchema = ksmMinimalSchema.partial();
1002
1536
  var isoDatetimeRegex3 = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:?\d{2})$/;
1003
1537
  var PAYER_SCHEMA_VERSION = 1;
1004
- var payerSchema = z5.z.object({
1005
- id: z5.z.string().uuid({ message: "id must be a valid UUID" }),
1538
+ var payerSchema = baseSchema(PAYER_SCHEMA_VERSION).extend({
1006
1539
  organization_id: objectIdSchema,
1007
1540
  facility_id: objectIdSchema,
1008
1541
  code: z5.z.string().min(1, { message: "code is required" }),
@@ -1037,12 +1570,7 @@ var payerSchema = z5.z.object({
1037
1570
  ),
1038
1571
  settings_id: objectIdSchema
1039
1572
  })
1040
- ),
1041
- created_at: timestampSchema,
1042
- created_by: z5.z.string().min(1, { message: "created_by is required" }),
1043
- updated_at: timestampSchema,
1044
- updated_by: z5.z.string().min(1, { message: "updated_by is required" }),
1045
- schema_version: z5.z.number().int().positive().default(PAYER_SCHEMA_VERSION)
1573
+ )
1046
1574
  });
1047
1575
  var PayerMongooseSchema = zodMongoose.toMongooseSchema(payerSchema);
1048
1576
  var PayerModelName = "payers";
@@ -1100,7 +1628,7 @@ var payerSettingsKVSchema = z5.z.object({
1100
1628
 
1101
1629
  // src/models/payer/payer-minimal.schema.ts
1102
1630
  var payerMinimalSchema = payerSchema.omit({
1103
- id: true,
1631
+ _id: true,
1104
1632
  created_at: true,
1105
1633
  created_by: true,
1106
1634
  updated_at: true,
@@ -1111,8 +1639,7 @@ var payerMinimalSchema = payerSchema.omit({
1111
1639
  // src/models/payer/payer-partial.schema.ts
1112
1640
  var payerPartialSchema = payerMinimalSchema.partial();
1113
1641
  var QUEUE_SCHEMA_VERSION = 1;
1114
- var queueSchema = z5.z.object({
1115
- id: z5.z.string().uuid({ message: "id must be a valid UUID" }),
1642
+ var queueSchema = baseSchema(QUEUE_SCHEMA_VERSION).extend({
1116
1643
  organization_id: objectIdSchema,
1117
1644
  facility_id: objectIdSchema,
1118
1645
  unit_id: objectIdSchema,
@@ -1125,70 +1652,15 @@ var queueSchema = z5.z.object({
1125
1652
  status: codedConceptSchema,
1126
1653
  call_count: z5.z.number().int().positive({ message: "call_count must be a positive integer" })
1127
1654
  })
1128
- ),
1129
- created_at: timestampSchema,
1130
- created_by: z5.z.string().min(1, { message: "created_by is required" }),
1131
- updated_at: timestampSchema,
1132
- updated_by: z5.z.string().min(1, { message: "updated_by is required" }),
1133
- schema_version: z5.z.number().int().positive().default(QUEUE_SCHEMA_VERSION)
1655
+ )
1134
1656
  });
1135
1657
  var QueueMongooseSchema = zodMongoose.toMongooseSchema(queueSchema);
1136
1658
  var QueueModelName = "queues";
1137
1659
  var QueueModel = mongoose.model(QueueModelName, QueueMongooseSchema);
1138
- var QUEUE_SETTING_FIELDS = [
1139
- "use_header_contact_info",
1140
- "use_header_bank_info",
1141
- "use_header_status_info",
1142
- "rules_drug_formulary",
1143
- "rules_method",
1144
- "rules_global_cover_outpatient",
1145
- "rules_global_cover_emergency",
1146
- "rules_global_tariff_calculation_date",
1147
- "rules_global_margin_id",
1148
- "rules_global_rule_type",
1149
- "rules_admin_calculate",
1150
- "rules_admin_min_fee",
1151
- "rules_admin_max_fee",
1152
- "rules_admin_before_discount",
1153
- "rules_admin_covered",
1154
- "rules_item_restriction_id"
1155
- ];
1156
- var QUEUE_SETTINGS_SCHEMA_VERSION = 1;
1157
- var queueSettingsSchema = z5.z.object({
1158
- _id: objectIdSchema,
1159
- scope: z5.z.string().min(1),
1160
- options: z5.z.array(
1161
- settingOptionSchema.refine(
1162
- (opt) => QUEUE_SETTING_FIELDS.includes(opt.field),
1163
- { message: "Invalid field for queue settings" }
1164
- )
1165
- ),
1166
- updated_at: timestampSchema,
1167
- updated_by: z5.z.string(),
1168
- schema_version: z5.z.number().int().positive().default(QUEUE_SETTINGS_SCHEMA_VERSION)
1169
- });
1170
- var queueSettingsKVSchema = z5.z.object({
1171
- use_header_contact_info: z5.z.boolean().default(false),
1172
- use_header_bank_info: z5.z.boolean().default(false),
1173
- use_header_status_info: z5.z.boolean().default(true),
1174
- rules_drug_formulary: z5.z.string().optional(),
1175
- rules_method: z5.z.string().optional(),
1176
- rules_global_cover_outpatient: z5.z.boolean().default(true),
1177
- rules_global_cover_emergency: z5.z.boolean().default(true),
1178
- rules_global_tariff_calculation_date: z5.z.enum(["transaction-date", "billing-date"]).default("transaction-date"),
1179
- rules_global_margin_id: z5.z.string().optional(),
1180
- rules_global_rule_type: z5.z.enum(["margin", "plafond"]).default("margin"),
1181
- rules_admin_calculate: z5.z.boolean().default(false),
1182
- rules_admin_min_fee: z5.z.number().default(0),
1183
- rules_admin_max_fee: z5.z.number().default(0),
1184
- rules_admin_before_discount: z5.z.boolean().default(false),
1185
- rules_admin_covered: z5.z.boolean().default(true),
1186
- rules_item_restriction_id: z5.z.string().optional()
1187
- });
1188
1660
 
1189
1661
  // src/models/queue/queue-minimal.schema.ts
1190
1662
  var queueMinimalSchema = queueSchema.omit({
1191
- id: true,
1663
+ _id: true,
1192
1664
  created_at: true,
1193
1665
  created_by: true,
1194
1666
  updated_at: true,
@@ -1199,17 +1671,11 @@ var queueMinimalSchema = queueSchema.omit({
1199
1671
  // src/models/queue/queue-partial.schema.ts
1200
1672
  var queuePartialSchema = queueMinimalSchema.partial();
1201
1673
  var QUEUE_EVENT_LOG_SCHEMA_VERSION = 1;
1202
- var queueEventLogSchema = z5.z.object({
1203
- id: z5.z.string().uuid({ message: "id must be a valid UUID" }),
1674
+ var queueEventLogSchema = baseSchema(QUEUE_EVENT_LOG_SCHEMA_VERSION).extend({
1204
1675
  queue_number_id: objectIdSchema,
1205
1676
  queue_number: z5.z.string().min(1, { message: "queue_number is required" }),
1206
1677
  events: z5.z.array(codedConceptSchema),
1207
- count: z5.z.number().int().positive({ message: "count must be a positive integer" }),
1208
- created_at: timestampSchema,
1209
- created_by: z5.z.string().min(1, { message: "created_by is required" }),
1210
- updated_at: timestampSchema,
1211
- updated_by: z5.z.string().min(1, { message: "updated_by is required" }),
1212
- schema_version: z5.z.number().int().positive().default(QUEUE_EVENT_LOG_SCHEMA_VERSION)
1678
+ count: z5.z.number().int().positive({ message: "count must be a positive integer" })
1213
1679
  });
1214
1680
  var QueueEventLogMongooseSchema = zodMongoose.toMongooseSchema(queueEventLogSchema);
1215
1681
  var QueueEventLogModelName = "queue_event_logs";
@@ -1217,7 +1683,7 @@ var QueueEventLogModel = mongoose.model(QueueEventLogModelName, QueueEventLogMon
1217
1683
 
1218
1684
  // src/models/queue-event-log/queue-event-log-minimal.schema.ts
1219
1685
  var queueEventLogMinimalSchema = queueEventLogSchema.omit({
1220
- id: true,
1686
+ _id: true,
1221
1687
  created_at: true,
1222
1688
  created_by: true,
1223
1689
  updated_at: true,
@@ -1229,8 +1695,9 @@ var queueEventLogMinimalSchema = queueEventLogSchema.omit({
1229
1695
  var queueEventLogPartialSchema = queueEventLogMinimalSchema.partial();
1230
1696
  var isoDatetimeRegex4 = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:?\d{2})$/;
1231
1697
  var QUEUE_NUMBER_SCHEMA_VERSION = 1;
1232
- var queueNumberSchema = z5.z.object({
1233
- id: z5.z.string().uuid({ message: "id must be a valid UUID" }),
1698
+ var queueNumberSchema = baseSchemaWithExpiredAt(
1699
+ QUEUE_NUMBER_SCHEMA_VERSION
1700
+ ).extend({
1234
1701
  organization_id: objectIdSchema,
1235
1702
  facility_id: objectIdSchema,
1236
1703
  patient_id: objectIdSchema,
@@ -1245,15 +1712,7 @@ var queueNumberSchema = z5.z.object({
1245
1712
  }),
1246
1713
  sequence: z5.z.number().int().positive({ message: "sequence must be a positive integer" }),
1247
1714
  prefix: z5.z.string().min(1, { message: "prefix is required" }),
1248
- number: z5.z.string().min(1, { message: "number is required" }),
1249
- created_at: timestampSchema,
1250
- created_by: z5.z.string().min(1, { message: "created_by is required" }),
1251
- updated_at: timestampSchema,
1252
- updated_by: z5.z.string().min(1, { message: "updated_by is required" }),
1253
- expired_at: z5.z.string().refine((val) => isoDatetimeRegex4.test(val), {
1254
- message: "expired_at must be a valid ISO 8601 datetime"
1255
- }),
1256
- schema_version: z5.z.number().int().positive().default(QUEUE_NUMBER_SCHEMA_VERSION)
1715
+ number: z5.z.string().min(1, { message: "number is required" })
1257
1716
  });
1258
1717
  var QueueNumberMongooseSchema = zodMongoose.toMongooseSchema(queueNumberSchema);
1259
1718
  var QueueNumberModelName = "queue_numbers";
@@ -1314,7 +1773,7 @@ var queueNumberSettingsKVSchema = z5.z.object({
1314
1773
 
1315
1774
  // src/models/queue-number/queue-number-minimal.schema.ts
1316
1775
  var queueNumberMinimalSchema = queueNumberSchema.omit({
1317
- id: true,
1776
+ _id: true,
1318
1777
  created_at: true,
1319
1778
  created_by: true,
1320
1779
  updated_at: true,
@@ -1325,8 +1784,35 @@ var queueNumberMinimalSchema = queueNumberSchema.omit({
1325
1784
 
1326
1785
  // src/models/queue-number/queue-number-partial.schema.ts
1327
1786
  var queueNumberPartialSchema = queueNumberMinimalSchema.partial();
1787
+ var ARTICLE_SCHEMA_VERSION = 1;
1788
+ var articleSchema = baseSchema(ARTICLE_SCHEMA_VERSION).extend({
1789
+ facility_id: objectIdSchema,
1790
+ title: z5.z.string().min(1, { message: "for is required" }),
1791
+ banner: z5.z.url(),
1792
+ body: z5.z.string(),
1793
+ status: codedConceptSchema
1794
+ });
1795
+ var ArticleMongooseSchema = zodMongoose.toMongooseSchema(articleSchema);
1796
+ var ArticleModelName = "articles";
1797
+ var ArticleModel = mongoose.model(ArticleModelName, ArticleMongooseSchema);
1798
+
1799
+ // src/models/article/article-minimal.schema.ts
1800
+ var articleMinimalSchema = articleSchema.omit({
1801
+ _id: true,
1802
+ created_at: true,
1803
+ created_by: true,
1804
+ updated_at: true,
1805
+ updated_by: true,
1806
+ schema_version: true
1807
+ });
1808
+
1809
+ // src/models/article/article-partial.schema.ts
1810
+ var articlePartialSchema = articleMinimalSchema.partial();
1328
1811
 
1812
+ exports.ARTICLE_SCHEMA_VERSION = ARTICLE_SCHEMA_VERSION;
1329
1813
  exports.ASSIGNMENT_SCHEMA_VERSION = ASSIGNMENT_SCHEMA_VERSION;
1814
+ exports.ArticleModel = ArticleModel;
1815
+ exports.ArticleMongooseSchema = ArticleMongooseSchema;
1330
1816
  exports.AssignmentModel = AssignmentModel;
1331
1817
  exports.AssignmentMongooseSchema = AssignmentMongooseSchema;
1332
1818
  exports.DEPARTMENT_SCHEMA_VERSION = DEPARTMENT_SCHEMA_VERSION;
@@ -1370,7 +1856,6 @@ exports.QUEUE_EVENT_LOG_SCHEMA_VERSION = QUEUE_EVENT_LOG_SCHEMA_VERSION;
1370
1856
  exports.QUEUE_NUMBER_SCHEMA_VERSION = QUEUE_NUMBER_SCHEMA_VERSION;
1371
1857
  exports.QUEUE_NUMBER_SETTINGS_SCHEMA_VERSION = QUEUE_NUMBER_SETTINGS_SCHEMA_VERSION;
1372
1858
  exports.QUEUE_SCHEMA_VERSION = QUEUE_SCHEMA_VERSION;
1373
- exports.QUEUE_SETTINGS_SCHEMA_VERSION = QUEUE_SETTINGS_SCHEMA_VERSION;
1374
1859
  exports.QueueEventLogModel = QueueEventLogModel;
1375
1860
  exports.QueueEventLogMongooseSchema = QueueEventLogMongooseSchema;
1376
1861
  exports.QueueModel = QueueModel;
@@ -1389,9 +1874,14 @@ exports.UserModel = UserModel;
1389
1874
  exports.UserMongooseSchema = UserMongooseSchema;
1390
1875
  exports.addressSchema = addressSchema;
1391
1876
  exports.apiResponseSchema = apiResponseSchema;
1877
+ exports.articleMinimalSchema = articleMinimalSchema;
1878
+ exports.articlePartialSchema = articlePartialSchema;
1879
+ exports.articleSchema = articleSchema;
1392
1880
  exports.assignmentMinimalSchema = assignmentMinimalSchema;
1393
1881
  exports.assignmentPartialSchema = assignmentPartialSchema;
1394
1882
  exports.assignmentSchema = assignmentSchema;
1883
+ exports.baseSchema = baseSchema;
1884
+ exports.baseSchemaWithExpiredAt = baseSchemaWithExpiredAt;
1395
1885
  exports.codedConceptSchema = codedConceptSchema;
1396
1886
  exports.demographicSchema = demographicSchema;
1397
1887
  exports.departmentMinimalSchema = departmentMinimalSchema;
@@ -1448,8 +1938,6 @@ exports.queueNumberSettingsKVSchema = queueNumberSettingsKVSchema;
1448
1938
  exports.queueNumberSettingsSchema = queueNumberSettingsSchema;
1449
1939
  exports.queuePartialSchema = queuePartialSchema;
1450
1940
  exports.queueSchema = queueSchema;
1451
- exports.queueSettingsKVSchema = queueSettingsKVSchema;
1452
- exports.queueSettingsSchema = queueSettingsSchema;
1453
1941
  exports.settingOptionSchema = settingOptionSchema;
1454
1942
  exports.settingOptionTypeSchema = settingOptionTypeSchema;
1455
1943
  exports.singleResourceResponseSchema = singleResourceResponseSchema;