@htilabs/platform-common-models 0.15.0 → 0.18.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.
Files changed (76) hide show
  1. package/dist/agency-BHv54o79.d.ts +484 -0
  2. package/dist/agency-Ca4pCOOf.d.ts +342 -0
  3. package/dist/agency-DYCv839V.d.cts +342 -0
  4. package/dist/agency-Djp57S71.d.cts +484 -0
  5. package/dist/constants/index.cjs +952 -0
  6. package/dist/constants/index.cjs.map +1 -1
  7. package/dist/constants/index.d.cts +3 -1
  8. package/dist/constants/index.d.ts +3 -1
  9. package/dist/constants/index.js +920 -0
  10. package/dist/constants/index.js.map +1 -1
  11. package/dist/{cvcEntry-DaDrEuTa.d.cts → cvcEntry-0BIB9sen.d.cts} +44 -44
  12. package/dist/{cvcEntry-DaDrEuTa.d.ts → cvcEntry-0BIB9sen.d.ts} +44 -44
  13. package/dist/cvcs/index.cjs +182 -77
  14. package/dist/cvcs/index.cjs.map +1 -1
  15. package/dist/cvcs/index.d.cts +187 -78
  16. package/dist/cvcs/index.d.ts +187 -78
  17. package/dist/cvcs/index.js +182 -77
  18. package/dist/cvcs/index.js.map +1 -1
  19. package/dist/enums/index.cjs +3 -1
  20. package/dist/enums/index.cjs.map +1 -1
  21. package/dist/enums/index.d.cts +7 -5
  22. package/dist/enums/index.d.ts +7 -5
  23. package/dist/enums/index.js +3 -1
  24. package/dist/enums/index.js.map +1 -1
  25. package/dist/{index-C0J3f169.d.ts → index-CDoqrfc1.d.ts} +1 -1
  26. package/dist/{index-EPjPjR0z.d.cts → index-Zu_mOJRn.d.cts} +1 -1
  27. package/dist/index.cjs +1704 -1073
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.cts +6 -4
  30. package/dist/index.d.ts +6 -4
  31. package/dist/index.js +1650 -1072
  32. package/dist/index.js.map +1 -1
  33. package/dist/models/index.d.cts +2 -2
  34. package/dist/models/index.d.ts +2 -2
  35. package/dist/org-type-BYQb9Qzq.d.ts +366 -0
  36. package/dist/org-type-D_FG4KdN.d.cts +366 -0
  37. package/dist/{platform-auth-CrF5U_JH.d.cts → platform-auth-CvAYFVhK.d.cts} +39 -0
  38. package/dist/{platform-auth-CrF5U_JH.d.ts → platform-auth-CvAYFVhK.d.ts} +39 -0
  39. package/dist/schemas/index.cjs +977 -2
  40. package/dist/schemas/index.cjs.map +1 -1
  41. package/dist/schemas/index.d.cts +38 -35
  42. package/dist/schemas/index.d.ts +38 -35
  43. package/dist/schemas/index.js +962 -1
  44. package/dist/schemas/index.js.map +1 -1
  45. package/dist/types/index.d.cts +2 -2
  46. package/dist/types/index.d.ts +2 -2
  47. package/dist/validation/index.cjs +894 -2
  48. package/dist/validation/index.cjs.map +1 -1
  49. package/dist/validation/index.d.cts +5 -1
  50. package/dist/validation/index.d.ts +5 -1
  51. package/dist/validation/index.js +884 -1
  52. package/dist/validation/index.js.map +1 -1
  53. package/package.json +26 -27
  54. package/src/__tests__/__snapshots__/cvc-sot.snap +5 -5
  55. package/src/__tests__/core-functions-canon.test.ts +53 -0
  56. package/src/__tests__/core-information-scope-invariant.test.ts +94 -4
  57. package/src/__tests__/cvc-sot-snapshot.test.ts +13 -10
  58. package/src/__tests__/cvc-status-parser.test.ts +1 -1
  59. package/src/__tests__/cvc-structural.test.ts +3 -3
  60. package/src/__tests__/org-type-contract.test.ts +1353 -0
  61. package/src/__tests__/referral-entity-category-canon.test.ts +255 -81
  62. package/src/constants/ic.ts +45 -0
  63. package/src/constants/index.ts +1 -0
  64. package/src/constants/org-type.ts +703 -0
  65. package/src/cvcs/{coreFunctions.v1.0.0.json → coreFunctions.v1.1.0.json} +11 -2
  66. package/src/cvcs/index.ts +3 -3
  67. package/src/cvcs/{referralEntityCategory.v1.1.0.json → referralEntityCategory.v1.2.0.json} +111 -59
  68. package/src/cvcs/{roiScope.v1.0.0.json → roiScope.v1.2.0.json} +51 -7
  69. package/src/generated/cvc-enums.ts +7 -5
  70. package/src/index.ts +23 -0
  71. package/src/schemas/agency.ts +481 -0
  72. package/src/schemas/index.ts +24 -0
  73. package/src/validation/agency.ts +119 -0
  74. package/src/validation/index.ts +1 -0
  75. package/dist/team-C4LJ5Tex.d.cts +0 -333
  76. package/dist/team-C4LJ5Tex.d.ts +0 -333
@@ -24,6 +24,7 @@ __export(constants_exports, {
24
24
  ACCOMMODATION_OPTIONS: () => ACCOMMODATION_OPTIONS,
25
25
  ACTIVE_CVC_136_CORE_INDICATOR_VALUES: () => ACTIVE_CVC_136_CORE_INDICATOR_VALUES,
26
26
  ACTIVE_INCIDENT_PARTICIPATION_ROLE_VALUES: () => ACTIVE_INCIDENT_PARTICIPATION_ROLE_VALUES,
27
+ AGENCY_TYPE_KEYS: () => AGENCY_TYPE_KEYS,
27
28
  AGE_BIN_REPORTING: () => AGE_BIN_REPORTING,
28
29
  AGE_BIN_REPORTING_IS_MINOR: () => AGE_BIN_REPORTING_IS_MINOR,
29
30
  AGE_BIN_REPORTING_LABELS: () => AGE_BIN_REPORTING_LABELS,
@@ -189,6 +190,7 @@ __export(constants_exports, {
189
190
  FUNCTION_STATUS: () => FUNCTION_STATUS,
190
191
  FUNCTION_STATUS_LABELS: () => FUNCTION_STATUS_LABELS,
191
192
  FUNCTION_STATUS_VALUES: () => FUNCTION_STATUS_VALUES,
193
+ HEALTHCARE_ORG_TYPE_KEYS: () => HEALTHCARE_ORG_TYPE_KEYS,
192
194
  IC_13_CATEGORIES: () => IC_13_CATEGORIES,
193
195
  IC_13_CATEGORY_ORDER: () => IC_13_CATEGORY_ORDER,
194
196
  IC_13_LABELS: () => IC_13_LABELS,
@@ -247,8 +249,17 @@ __export(constants_exports, {
247
249
  INTERACTION_TYPES: () => INTERACTION_TYPES,
248
250
  INTERACTION_TYPE_LABELS: () => INTERACTION_TYPE_LABELS,
249
251
  INVOLVEMENT_ROLE_TO_PERSON_TYPE: () => INVOLVEMENT_ROLE_TO_PERSON_TYPE,
252
+ LAW_ENFORCEMENT_ORG_TYPE_KEYS: () => LAW_ENFORCEMENT_ORG_TYPE_KEYS,
253
+ LEGACY_NUMERIC_TO_REFERRAL_ENTITY_KEY: () => LEGACY_NUMERIC_TO_REFERRAL_ENTITY_KEY,
254
+ LEGAL_ORG_TYPE_KEYS: () => LEGAL_ORG_TYPE_KEYS,
250
255
  MINOR_ADULT_STATUS: () => MINOR_ADULT_STATUS,
251
256
  MINOR_ADULT_STATUS_LABELS: () => MINOR_ADULT_STATUS_LABELS,
257
+ NO_SECTOR_ORG_TYPE_KEYS: () => NO_SECTOR_ORG_TYPE_KEYS,
258
+ ORG_TYPE_HEADING_KEYS: () => ORG_TYPE_HEADING_KEYS,
259
+ ORG_TYPE_KEYS: () => ORG_TYPE_KEYS,
260
+ ORG_TYPE_NONPICKABLE_LEAF_KEYS: () => ORG_TYPE_NONPICKABLE_LEAF_KEYS,
261
+ ORG_TYPE_PARENT_KEY: () => ORG_TYPE_PARENT_KEY,
262
+ ORG_TYPE_SELECTABLE_KEYS: () => ORG_TYPE_SELECTABLE_KEYS,
252
263
  PARTICIPATION_ROLE_CATEGORIES: () => PARTICIPATION_ROLE_CATEGORIES,
253
264
  PERMISSION_STATE: () => PERMISSION_STATE,
254
265
  PERMISSION_STATE_DISPLAY: () => PERMISSION_STATE_DISPLAY,
@@ -275,6 +286,7 @@ __export(constants_exports, {
275
286
  RELATIONSHIP_DYNAMICS: () => RELATIONSHIP_DYNAMICS,
276
287
  RELATIONSHIP_DYNAMICS_LABELS: () => RELATIONSHIP_DYNAMICS_LABELS,
277
288
  RELATIONSHIP_DYNAMICS_VALUES: () => RELATIONSHIP_DYNAMICS_VALUES,
289
+ REPORT_AUTHORITY_ORG_TYPE_KEYS: () => REPORT_AUTHORITY_ORG_TYPE_KEYS,
278
290
  ROLE_LEVEL: () => ROLE_LEVEL,
279
291
  ROLE_LEVEL_LABELS: () => ROLE_LEVEL_LABELS,
280
292
  ROLE_LEVEL_VALUES: () => ROLE_LEVEL_VALUES,
@@ -290,6 +302,7 @@ __export(constants_exports, {
290
302
  USER_STATUS_LABELS: () => USER_STATUS_LABELS,
291
303
  VALID_INTERACTION_TYPES: () => VALID_INTERACTION_TYPES,
292
304
  VALID_RECORD_STATES: () => VALID_RECORD_STATES,
305
+ VICTIM_SERVING_ORG_TYPE_KEYS: () => VICTIM_SERVING_ORG_TYPE_KEYS,
293
306
  canonicalCoreIndicator: () => canonicalCoreIndicator,
294
307
  canonicalIncidentParticipationRole: () => canonicalIncidentParticipationRole,
295
308
  deriveAgeBinFromAge: () => deriveAgeBinFromAge,
@@ -305,14 +318,33 @@ __export(constants_exports, {
305
318
  getIC48TopicForCategory: () => getIC48TopicForCategory,
306
319
  getPersonTypeForRole: () => getPersonTypeForRole,
307
320
  getRelationshipCategory: () => getRelationshipCategory,
321
+ isAgencyTypeKey: () => isAgencyTypeKey,
308
322
  isDeprecatedCoreIndicator: () => isDeprecatedCoreIndicator,
309
323
  isDeprecatedIncidentParticipationRole: () => isDeprecatedIncidentParticipationRole,
324
+ isHealthcareOrgType: () => isHealthcareOrgType,
310
325
  isIC56Missingness: () => isIC56Missingness,
311
326
  isIC56ValidChannel: () => isIC56ValidChannel,
327
+ isLawEnforcementOrgType: () => isLawEnforcementOrgType,
328
+ isLegalOrgType: () => isLegalOrgType,
312
329
  isLgbtqOrientation: () => isLgbtqOrientation,
330
+ isOrgTypeKey: () => isOrgTypeKey,
313
331
  isProtectedRelationship: () => isProtectedRelationship,
332
+ isReportAuthorityOrgType: () => isReportAuthorityOrgType,
314
333
  isStructuredNameType: () => isStructuredNameType,
315
334
  isTransgenderGenderIdentity: () => isTransgenderGenderIdentity,
335
+ isVictimServingOrgType: () => isVictimServingOrgType,
336
+ orgTypeAncestry: () => orgTypeAncestry,
337
+ orgTypeCanonicalCode: () => orgTypeCanonicalCode,
338
+ orgTypeDefaultSessionRole: () => orgTypeDefaultSessionRole,
339
+ orgTypeDefaultSessionRoleOrNull: () => orgTypeDefaultSessionRoleOrNull,
340
+ orgTypeDefaultVsp: () => orgTypeDefaultVsp,
341
+ orgTypeEnumConstant: () => orgTypeEnumConstant,
342
+ orgTypeLabel: () => orgTypeLabel,
343
+ orgTypeSector: () => orgTypeSector,
344
+ resolveAgencyTypeKey: () => resolveAgencyTypeKey,
345
+ resolveOrgTypeKey: () => resolveOrgTypeKey,
346
+ resolveOrgTypeKeyFromLegacyNumeric: () => resolveOrgTypeKeyFromLegacyNumeric,
347
+ resolveReferralEntityKeyFromLegacyNumeric: () => resolveReferralEntityKeyFromLegacyNumeric,
316
348
  sortRelationshipsByPriority: () => sortRelationshipsByPriority
317
349
  });
318
350
  module.exports = __toCommonJS(constants_exports);
@@ -6332,12 +6364,901 @@ var FUNCTION_STATUS_LABELS = {
6332
6364
  [FUNCTION_STATUS.FUNCTIONAL]: "Functional",
6333
6365
  [FUNCTION_STATUS.FUTURE]: "Future (Not v1)"
6334
6366
  };
6367
+
6368
+ // src/cvcs/referralEntityCategory.v1.2.0.json
6369
+ var referralEntityCategory_v1_2_0_default = {
6370
+ domain: "referral_entity_category",
6371
+ name: "Core Referral Entity Category",
6372
+ version: "1.2.0",
6373
+ _status: "CANONICAL \u2014 Notion CVC-48 `core-referral_entity_category` (IC-58), status Active (full audit 2026-08-20, CVC48_IC58_REFERRAL_ENTITY_CATEGORY_AUDIT; `Date of last audit` 2026-09-01). Re-mirrored from prototype canon yaml v1.3 @ f1321e47 and the live Notion codebook (46 rows, compared row by row 2026-10-05). SUPERSEDES referralEntityCategory v1.0.0 (platform-common <= 0.13.0), which predated the audit. ADDITIVE: no v1.0.0 key is removed and no v1.0.0 positional code changes. ADDED (4): `adult_protective_services` (02-03-06-00), `school_academic_institution` (02-05-01-00), `legal_services_provider` (02-06-04-00), and since 0.18.0 `hotline` (02-02-01-00, canon's selectable Level-2 parent of the two hotline children) at the next free ordinal 048-006-003 with `national_hotline` / `local_other_hotline` RE-PARENTED under it \u2014 their codes are unchanged (a positional code is identity, `parentCode` is hierarchy). SELECTABLE follows canon on two rows: `education` is now a non-selectable heading (its leaf is `school_academic_institution`, which carries the HMIS R1 School rollup \u2014 ruled 2026-08-20) and `law_enforcement` is now selectable (canon Level 2 Required; its five children are optional depth). A stored `education` is still a valid key. `title` and `definition` are canon's, verbatim (yaml `name` / `definition`; the live Notion wording where the two differ: the Adult Protective Services label, the quotation marks in the Victim service provider definition, and the wording of the residual Community-based provider definition); the Level-0 rows keep the package's house missingness titles. `justice_protective_systems` no longer carries the package-authored definition v1.0.0 gave it: canon's heading (02-03-00-00) has none. Every canon-backed row carries canon's 4-segment code as `canonicalCode`; the package's own positional codes are unchanged and are NOT canon's. NOT carried: canon `hmis_r1_code` / `hmis_r1_mapping`, `required`, `voca_ovc_pmt_bucket`, `pave_2025_mapping`, `logic_notes`, `mappings_notes` (v1.0.0 carried none of them). CARRIED since 0.18.0: canon `enum_constant` as `enumConstant` on every canon-backed row (the Sean-spec constant the org registry / `agencies.typeId` spell the type with). Generated by scripts/gen-referral-entity-category.py \u2014 do not hand-edit.",
6374
+ _source: "htilabstech/prototype/data/cvcs/core_referral_entity_category.yaml @ f1321e47 (Notion CVC-48, yaml v1.3; read from origin/main) + Notion codebook collection://3181ef14-abcd-8081-95b5-000bc30a73bd (wording of 3 cells, compared 2026-10-05)",
6375
+ _supersedes: {
6376
+ version: "1.0.0",
6377
+ keyMap: {
6378
+ missingness_root: "missingness_root",
6379
+ unknown: "unknown",
6380
+ anonymous: "anonymous",
6381
+ data_not_collected: "data_not_collected",
6382
+ self_referred: "self_referred",
6383
+ family_guardian_friend: "family_guardian_friend",
6384
+ peer: "peer",
6385
+ other_individual: "other_individual",
6386
+ housing_shelter_continuum: "housing_shelter_continuum",
6387
+ outreach_project: "outreach_project",
6388
+ temporary_shelter: "temporary_shelter",
6389
+ residential_project: "residential_project",
6390
+ hotlines: "hotlines",
6391
+ national_hotline: "national_hotline",
6392
+ local_other_hotline: "local_other_hotline",
6393
+ justice_protective_systems: "justice_protective_systems",
6394
+ child_welfare_cps: "child_welfare_cps",
6395
+ juvenile_justice: "juvenile_justice",
6396
+ law_enforcement: "law_enforcement",
6397
+ local_law_enforcement: "local_law_enforcement",
6398
+ state_law_enforcement: "state_law_enforcement",
6399
+ federal_law_enforcement: "federal_law_enforcement",
6400
+ tribal_law_enforcement: "tribal_law_enforcement",
6401
+ other_law_enforcement: "other_law_enforcement",
6402
+ courts_prosecution: "courts_prosecution",
6403
+ correction_probation: "correction_probation",
6404
+ health_behavioral_health: "health_behavioral_health",
6405
+ inpatient_psychiatric_facility: "inpatient_psychiatric_facility",
6406
+ healthcare_provider: "healthcare_provider",
6407
+ education: "education",
6408
+ victim_community_service_providers: "victim_community_service_providers",
6409
+ child_advocacy_center: "child_advocacy_center",
6410
+ victim_service_provider: "victim_service_provider",
6411
+ community_based_service_provider: "community_based_service_provider",
6412
+ coordination_governance: "coordination_governance",
6413
+ mdt: "mdt",
6414
+ coalition: "coalition",
6415
+ internal: "internal",
6416
+ own_agency_internal: "own_agency_internal",
6417
+ other_entity: "other_entity",
6418
+ employer: "employer",
6419
+ benefits_public_assistance_office: "benefits_public_assistance_office",
6420
+ other_organization: "other_organization"
6421
+ },
6422
+ retiredCodes: [],
6423
+ notes: {
6424
+ education: "v1.0.0 `education` was a selectable leaf. Canon makes Education a heading whose only leaf is School / academic institution. `education` stays a valid stored key (now `selectable: false`); the specific successor for a school is `school_academic_institution`. Not mapped automatically.",
6425
+ law_enforcement: "v1.0.0 `law_enforcement` was a non-selectable heading. Canon makes Law enforcement / Police a selectable leaf with five optional children."
6426
+ }
6427
+ },
6428
+ _notCarried: [],
6429
+ levels: {
6430
+ "0": "Unknown or Missing",
6431
+ "1": "Category",
6432
+ "2": "Entity",
6433
+ "3": "Variant"
6434
+ },
6435
+ entries: [
6436
+ {
6437
+ code: "048-000-000-000-000-000-000",
6438
+ key: "missingness_root",
6439
+ title: "Unknown, Redacted, or Missing",
6440
+ selectable: false,
6441
+ parentCode: null,
6442
+ childCodes: [
6443
+ "048-000-000-000-000-000-001",
6444
+ "048-000-000-000-000-000-002",
6445
+ "048-000-000-000-000-000-003"
6446
+ ],
6447
+ definition: "Root group for values indicating absent, withheld, or uncollected data."
6448
+ },
6449
+ {
6450
+ code: "048-000-000-000-000-000-001",
6451
+ key: "unknown",
6452
+ title: "Unknown",
6453
+ selectable: true,
6454
+ parentCode: "048-000-000-000-000-000-000",
6455
+ childCodes: [],
6456
+ definition: "Referral entity category unknown.",
6457
+ canonicalCode: "00-00-01-00",
6458
+ enumConstant: "EMPTY_RESPONSE_UNKNOWN"
6459
+ },
6460
+ {
6461
+ code: "048-000-000-000-000-000-002",
6462
+ key: "anonymous",
6463
+ title: "Anonymous",
6464
+ selectable: true,
6465
+ parentCode: "048-000-000-000-000-000-000",
6466
+ childCodes: [],
6467
+ definition: "Referral entity category withheld or redacted.",
6468
+ canonicalCode: "00-00-02-00",
6469
+ enumConstant: "EMPTY_RESPONSE_ANONYMOUS"
6470
+ },
6471
+ {
6472
+ code: "048-000-000-000-000-000-003",
6473
+ key: "data_not_collected",
6474
+ title: "Data not collected",
6475
+ selectable: true,
6476
+ parentCode: "048-000-000-000-000-000-000",
6477
+ childCodes: [],
6478
+ definition: "Referral entity category not collected or no signal captured.",
6479
+ canonicalCode: "00-00-03-00",
6480
+ enumConstant: "EMPTY_RESPONSE_NOTCOLLECTED"
6481
+ },
6482
+ {
6483
+ code: "048-001-000-000-000-000-000",
6484
+ key: "self_referred",
6485
+ title: "Self-referred",
6486
+ selectable: true,
6487
+ parentCode: null,
6488
+ childCodes: [],
6489
+ definition: "Client initiated contact or presented for services without a third-party referrer.",
6490
+ canonicalCode: "01-00-01-00",
6491
+ enumConstant: "INDIVIDUAL_PERSON_SELFREFERRED"
6492
+ },
6493
+ {
6494
+ code: "048-002-000-000-000-000-000",
6495
+ key: "family_guardian_friend",
6496
+ title: "Family/guardian/friend/foster parent",
6497
+ selectable: true,
6498
+ parentCode: null,
6499
+ childCodes: [],
6500
+ definition: "A caregiver, family member, or close personal support person initiated the referral.",
6501
+ canonicalCode: "01-00-02-00",
6502
+ enumConstant: "INDIVIDUAL_PERSON_FAMILYGUARDIANFRIEND"
6503
+ },
6504
+ {
6505
+ code: "048-003-000-000-000-000-000",
6506
+ key: "peer",
6507
+ title: "Peer / another client",
6508
+ selectable: true,
6509
+ parentCode: null,
6510
+ childCodes: [],
6511
+ definition: "Another current or former client initiated or encouraged the referral.",
6512
+ canonicalCode: "01-00-03-00",
6513
+ enumConstant: "INDIVIDUAL_PERSON_PEER"
6514
+ },
6515
+ {
6516
+ code: "048-004-000-000-000-000-000",
6517
+ key: "other_individual",
6518
+ title: "Other individual",
6519
+ selectable: true,
6520
+ parentCode: null,
6521
+ childCodes: [],
6522
+ definition: "A non-family individual initiated the referral (e.g., neighbor, community member, clergy).",
6523
+ canonicalCode: "01-00-04-00",
6524
+ enumConstant: "INDIVIDUAL_PERSON_OTHER"
6525
+ },
6526
+ {
6527
+ code: "048-005-000-000-000-000-000",
6528
+ key: "housing_shelter_continuum",
6529
+ title: "Housing / Shelter continuum",
6530
+ selectable: false,
6531
+ parentCode: null,
6532
+ childCodes: [
6533
+ "048-005-001-000-000-000-000",
6534
+ "048-005-002-000-000-000-000",
6535
+ "048-005-003-000-000-000-000"
6536
+ ],
6537
+ definition: "Primary function is outreach engagement, emergency shelter, or residential shelter/housing programs.",
6538
+ canonicalCode: "02-01-00-00",
6539
+ enumConstant: "ORGANIZATION_HOUSING"
6540
+ },
6541
+ {
6542
+ code: "048-005-001-000-000-000-000",
6543
+ key: "outreach_project",
6544
+ title: "Outreach Project",
6545
+ selectable: true,
6546
+ parentCode: "048-005-000-000-000-000-000",
6547
+ childCodes: [],
6548
+ definition: "Street/community outreach program that engaged the client prior to enrollment.",
6549
+ canonicalCode: "02-01-01-00",
6550
+ enumConstant: "ORGANIZATION_HOUSING_OUTREACHPROJECT"
6551
+ },
6552
+ {
6553
+ code: "048-005-002-000-000-000-000",
6554
+ key: "temporary_shelter",
6555
+ title: "Temporary Shelter",
6556
+ selectable: true,
6557
+ parentCode: "048-005-000-000-000-000-000",
6558
+ childCodes: [],
6559
+ definition: "Emergency/crisis shelter or short-term temporary housing program.",
6560
+ canonicalCode: "02-01-02-00",
6561
+ enumConstant: "ORGANIZATION_HOUSING_TEMPORARYSHELTER"
6562
+ },
6563
+ {
6564
+ code: "048-005-003-000-000-000-000",
6565
+ key: "residential_project",
6566
+ title: "Residential Project",
6567
+ selectable: true,
6568
+ parentCode: "048-005-000-000-000-000-000",
6569
+ childCodes: [],
6570
+ definition: "Longer-term residential or transitional living program.",
6571
+ canonicalCode: "02-01-03-00",
6572
+ enumConstant: "ORGANIZATION_HOUSING_RESIDENTIALPROJECT"
6573
+ },
6574
+ {
6575
+ code: "048-006-000-000-000-000-000",
6576
+ key: "hotlines",
6577
+ title: "Hotlines",
6578
+ selectable: false,
6579
+ parentCode: null,
6580
+ childCodes: [
6581
+ "048-006-003-000-000-000-000"
6582
+ ],
6583
+ definition: "Crisis lines or call centers that connect a person to services.",
6584
+ canonicalCode: "02-02-00-00",
6585
+ enumConstant: "ORGANIZATION_CALLCENTERS"
6586
+ },
6587
+ {
6588
+ code: "048-006-001-000-000-000-000",
6589
+ key: "national_hotline",
6590
+ title: "National hotline",
6591
+ selectable: true,
6592
+ parentCode: "048-006-003-000-000-000-000",
6593
+ childCodes: [],
6594
+ definition: "National-level hotline network.",
6595
+ canonicalCode: "02-02-01-01",
6596
+ enumConstant: "ORGANIZATION_CALLCENTERS_HOTLINE_NATIONAL"
6597
+ },
6598
+ {
6599
+ code: "048-006-002-000-000-000-000",
6600
+ key: "local_other_hotline",
6601
+ title: "Local/other hotline",
6602
+ selectable: true,
6603
+ parentCode: "048-006-003-000-000-000-000",
6604
+ childCodes: [],
6605
+ definition: "Local/regional hotline or non-national hotline.",
6606
+ canonicalCode: "02-02-01-02",
6607
+ enumConstant: "ORGANIZATION_CALLCENTERS_HOTLINE_LOCAL"
6608
+ },
6609
+ {
6610
+ code: "048-006-003-000-000-000-000",
6611
+ key: "hotline",
6612
+ title: "Hotline",
6613
+ selectable: true,
6614
+ parentCode: "048-006-000-000-000-000-000",
6615
+ childCodes: [
6616
+ "048-006-001-000-000-000-000",
6617
+ "048-006-002-000-000-000-000"
6618
+ ],
6619
+ definition: "Crisis hotline or call center that connected the client to services.",
6620
+ canonicalCode: "02-02-01-00",
6621
+ enumConstant: "ORGANIZATION_CALLCENTERS_HOTLINE"
6622
+ },
6623
+ {
6624
+ code: "048-007-000-000-000-000-000",
6625
+ key: "justice_protective_systems",
6626
+ title: "Justice & Protective Systems",
6627
+ selectable: false,
6628
+ parentCode: null,
6629
+ childCodes: [
6630
+ "048-007-001-000-000-000-000",
6631
+ "048-007-002-000-000-000-000",
6632
+ "048-007-003-000-000-000-000",
6633
+ "048-007-004-000-000-000-000",
6634
+ "048-007-005-000-000-000-000",
6635
+ "048-007-006-000-000-000-000"
6636
+ ],
6637
+ definition: null,
6638
+ canonicalCode: "02-03-00-00",
6639
+ enumConstant: "ORGANIZATION_JUSTICE"
6640
+ },
6641
+ {
6642
+ code: "048-007-001-000-000-000-000",
6643
+ key: "child_welfare_cps",
6644
+ title: "Child Welfare / CPS",
6645
+ selectable: true,
6646
+ parentCode: "048-007-000-000-000-000-000",
6647
+ childCodes: [],
6648
+ definition: "Government child protection agency responsible for investigating child abuse/neglect and ensuring child safety.",
6649
+ canonicalCode: "02-03-01-00",
6650
+ enumConstant: "ORGANIZATION_JUSTICE_CHILDWELFARE"
6651
+ },
6652
+ {
6653
+ code: "048-007-002-000-000-000-000",
6654
+ key: "juvenile_justice",
6655
+ title: "Juvenile Justice",
6656
+ selectable: true,
6657
+ parentCode: "048-007-000-000-000-000-000",
6658
+ childCodes: [],
6659
+ definition: "Juvenile probation/detention/court-related juvenile justice system initiated the referral.",
6660
+ canonicalCode: "02-03-02-00",
6661
+ enumConstant: "ORGANIZATION_JUSTICE_JUVENILE"
6662
+ },
6663
+ {
6664
+ code: "048-007-003-000-000-000-000",
6665
+ key: "law_enforcement",
6666
+ title: "Law enforcement / Police",
6667
+ selectable: true,
6668
+ parentCode: "048-007-000-000-000-000-000",
6669
+ childCodes: [
6670
+ "048-007-003-001-000-000-000",
6671
+ "048-007-003-002-000-000-000",
6672
+ "048-007-003-003-000-000-000",
6673
+ "048-007-003-004-000-000-000",
6674
+ "048-007-003-005-000-000-000"
6675
+ ],
6676
+ definition: "Law enforcement agency initiated the referral (local/state/federal).",
6677
+ canonicalCode: "02-03-03-00",
6678
+ enumConstant: "ORGANIZATION_JUSTICE_LAWENFORCEMENT"
6679
+ },
6680
+ {
6681
+ code: "048-007-003-001-000-000-000",
6682
+ key: "local_law_enforcement",
6683
+ title: "Local law enforcement",
6684
+ selectable: true,
6685
+ parentCode: "048-007-003-000-000-000-000",
6686
+ childCodes: [],
6687
+ definition: "City/county police or sheriff.",
6688
+ canonicalCode: "02-03-03-01",
6689
+ enumConstant: "ORGANIZATION_JUSTICE_LAWENFORCEMENT_LOCAL"
6690
+ },
6691
+ {
6692
+ code: "048-007-003-002-000-000-000",
6693
+ key: "state_law_enforcement",
6694
+ title: "State law enforcement",
6695
+ selectable: true,
6696
+ parentCode: "048-007-003-000-000-000-000",
6697
+ childCodes: [],
6698
+ definition: "State-level law enforcement agency (e.g., state police/highway patrol/state bureau of investigation) acting in an official capacity.",
6699
+ canonicalCode: "02-03-03-02",
6700
+ enumConstant: "ORGANIZATION_JUSTICE_LAWENFORCEMENT_STATE"
6701
+ },
6702
+ {
6703
+ code: "048-007-003-003-000-000-000",
6704
+ key: "federal_law_enforcement",
6705
+ title: "Federal law enforcement",
6706
+ selectable: true,
6707
+ parentCode: "048-007-003-000-000-000-000",
6708
+ childCodes: [],
6709
+ definition: "Federal law enforcement agency (e.g., FBI, DHS/ICE).",
6710
+ canonicalCode: "02-03-03-03",
6711
+ enumConstant: "ORGANIZATION_JUSTICE_LAWENFORCEMENT_FEDERAL"
6712
+ },
6713
+ {
6714
+ code: "048-007-003-004-000-000-000",
6715
+ key: "tribal_law_enforcement",
6716
+ title: "Tribal law enforcement",
6717
+ selectable: true,
6718
+ parentCode: "048-007-003-000-000-000-000",
6719
+ childCodes: [],
6720
+ definition: "Tribal police.",
6721
+ canonicalCode: "02-03-03-04",
6722
+ enumConstant: "ORGANIZATION_JUSTICE_LAWENFORCEMENT_TRIBAL"
6723
+ },
6724
+ {
6725
+ code: "048-007-003-005-000-000-000",
6726
+ key: "other_law_enforcement",
6727
+ title: "Other/ unknown LE",
6728
+ selectable: true,
6729
+ parentCode: "048-007-003-000-000-000-000",
6730
+ childCodes: [],
6731
+ definition: "Other law enforcement entity, or law enforcement type is unknown.",
6732
+ canonicalCode: "02-03-03-05",
6733
+ enumConstant: "ORGANIZATION_JUSTICE_LAWENFORCEMENT_OTHER"
6734
+ },
6735
+ {
6736
+ code: "048-007-004-000-000-000-000",
6737
+ key: "courts_prosecution",
6738
+ title: "Courts or prosecution",
6739
+ selectable: true,
6740
+ parentCode: "048-007-000-000-000-000-000",
6741
+ childCodes: [],
6742
+ definition: "Court or prosecution entity (not law enforcement).",
6743
+ canonicalCode: "02-03-04-00",
6744
+ enumConstant: "ORGANIZATION_JUSTICE_COURTS"
6745
+ },
6746
+ {
6747
+ code: "048-007-005-000-000-000-000",
6748
+ key: "correction_probation",
6749
+ title: "Correction / probation",
6750
+ selectable: true,
6751
+ parentCode: "048-007-000-000-000-000-000",
6752
+ childCodes: [],
6753
+ definition: "Corrections, probation, parole, or community supervision entity (not law enforcement).",
6754
+ canonicalCode: "02-03-05-00",
6755
+ enumConstant: "ORGANIZATION_JUSTICE_CORRECTIONS"
6756
+ },
6757
+ {
6758
+ code: "048-007-006-000-000-000-000",
6759
+ key: "adult_protective_services",
6760
+ title: "Adult Protective Services (APS)",
6761
+ selectable: true,
6762
+ parentCode: "048-007-000-000-000-000-000",
6763
+ childCodes: [],
6764
+ definition: "Government adult protection agency responsible for investigating abuse, neglect, self-neglect, or exploitation of vulnerable or older adults and ensuring their safety. Adult analog of Child Welfare / CPS.",
6765
+ canonicalCode: "02-03-06-00",
6766
+ enumConstant: "ORGANIZATION_JUSTICE_ADULTPROTECTIVE"
6767
+ },
6768
+ {
6769
+ code: "048-008-000-000-000-000-000",
6770
+ key: "health_behavioral_health",
6771
+ title: "Health / behavioral health",
6772
+ selectable: false,
6773
+ parentCode: null,
6774
+ childCodes: [
6775
+ "048-008-001-000-000-000-000",
6776
+ "048-008-002-000-000-000-000"
6777
+ ],
6778
+ definition: "Hospitals and healthcare providers (including mental health inpatient facilities).",
6779
+ canonicalCode: "02-04-00-00",
6780
+ enumConstant: "ORGANIZATION_HEALTH"
6781
+ },
6782
+ {
6783
+ code: "048-008-001-000-000-000-000",
6784
+ key: "inpatient_psychiatric_facility",
6785
+ title: "Inpatient psychiatric facility",
6786
+ selectable: true,
6787
+ parentCode: "048-008-000-000-000-000-000",
6788
+ childCodes: [],
6789
+ definition: "Inpatient psychiatric hospital or psychiatric facility.",
6790
+ canonicalCode: "02-04-01-00",
6791
+ enumConstant: "ORGANIZATION_HEALTH_PSYCHIATRIC"
6792
+ },
6793
+ {
6794
+ code: "048-008-002-000-000-000-000",
6795
+ key: "healthcare_provider",
6796
+ title: "Healthcare provider (non-inpatient psychiatric)",
6797
+ selectable: true,
6798
+ parentCode: "048-008-000-000-000-000-000",
6799
+ childCodes: [],
6800
+ definition: "Any non-inpatient healthcare provider (clinic, hospital, outpatient provider, behavioral health clinic, SANE program, substance abuse clinic, etc.).",
6801
+ canonicalCode: "02-04-02-00",
6802
+ enumConstant: "ORGANIZATION_HEALTH_HEALTHCARE"
6803
+ },
6804
+ {
6805
+ code: "048-009-000-000-000-000-000",
6806
+ key: "education",
6807
+ title: "Education",
6808
+ selectable: false,
6809
+ parentCode: null,
6810
+ childCodes: [
6811
+ "048-009-001-000-000-000-000"
6812
+ ],
6813
+ definition: "Parent category for education-related institutions.",
6814
+ canonicalCode: "02-05-00-00",
6815
+ enumConstant: "ORGANIZATION_EDUCATION"
6816
+ },
6817
+ {
6818
+ code: "048-009-001-000-000-000-000",
6819
+ key: "school_academic_institution",
6820
+ title: "School / academic institution",
6821
+ selectable: true,
6822
+ parentCode: "048-009-000-000-000-000-000",
6823
+ childCodes: [],
6824
+ definition: "School system or educational institution.",
6825
+ canonicalCode: "02-05-01-00",
6826
+ enumConstant: "ORGANIZATION_EDUCATION_SCHOOL"
6827
+ },
6828
+ {
6829
+ code: "048-010-000-000-000-000-000",
6830
+ key: "victim_community_service_providers",
6831
+ title: "Victim + Community service providers",
6832
+ selectable: false,
6833
+ parentCode: null,
6834
+ childCodes: [
6835
+ "048-010-001-000-000-000-000",
6836
+ "048-010-002-000-000-000-000",
6837
+ "048-010-003-000-000-000-000",
6838
+ "048-010-004-000-000-000-000"
6839
+ ],
6840
+ definition: "Parent category for victim service providers and community-based service providers.",
6841
+ canonicalCode: "02-06-00-00",
6842
+ enumConstant: "ORGANIZATION_COMMUNITY"
6843
+ },
6844
+ {
6845
+ code: "048-010-001-000-000-000-000",
6846
+ key: "child_advocacy_center",
6847
+ title: "Child Advocacy Center (CAC)",
6848
+ selectable: true,
6849
+ parentCode: "048-010-000-000-000-000-000",
6850
+ childCodes: [],
6851
+ definition: "A child-centered multidisciplinary center coordinating investigation and services (forensic interview, coordination, referrals, sometimes medical or therapy) for child victims.",
6852
+ canonicalCode: "02-06-01-00",
6853
+ enumConstant: "ORGANIZATION_COMMUNITY_CHILDADVOCACYCENTER"
6854
+ },
6855
+ {
6856
+ code: "048-010-002-000-000-000-000",
6857
+ key: "victim_service_provider",
6858
+ title: "Victim service provider / advocacy program",
6859
+ selectable: true,
6860
+ parentCode: "048-010-000-000-000-000-000",
6861
+ childCodes: [],
6862
+ definition: "Organization whose primary mission is to provide services to victims/survivors of crime (VOCA-aligned breadth: rape crisis centers, DV/dating-violence/stalking programs, anti-trafficking programs, child victim centers, homicide-survivor organizations, and similar). Whether the organization is specifically a DV/SA victim service provider \u2014 the fact HMIS 2.01 needs (Comparable Database) \u2014 is a separate per-organization attribute, self-attested by the organization at onboarding (Platform survey / Agency Hub \u201CMy agency info\u201D), not part of this category.",
6863
+ canonicalCode: "02-06-02-00",
6864
+ enumConstant: "ORGANIZATION_COMMUNITY_VICTIMSERVICEPROVIDER"
6865
+ },
6866
+ {
6867
+ code: "048-010-003-000-000-000-000",
6868
+ key: "community_based_service_provider",
6869
+ title: "Community-based service provider (general social services)",
6870
+ selectable: true,
6871
+ parentCode: "048-010-000-000-000-000-000",
6872
+ childCodes: [],
6873
+ definition: "The residual community-based provider (\u201Cother community-based service provider\u201D): a non-VSP offering practical support services, navigation, or stabilization resources that is not primarily a VSP, a legal services provider, a housing/shelter project, a government justice agency, a healthcare provider, a school, a hotline, or a public benefits office. (Ex: youth drop-in center; food pantry; reentry program.)",
6874
+ canonicalCode: "02-06-03-00",
6875
+ enumConstant: "ORGANIZATION_COMMUNITY_COMMUNITYSERVICEPROVIDER"
6876
+ },
6877
+ {
6878
+ code: "048-010-004-000-000-000-000",
6879
+ key: "legal_services_provider",
6880
+ title: "Legal services provider",
6881
+ selectable: true,
6882
+ parentCode: "048-010-000-000-000-000-000",
6883
+ childCodes: [],
6884
+ definition: "Civil legal aid organization, immigration attorneys, victim-rights law clinic, or similar provider of legal help to the client. Distinct from Courts or prosecution (the justice-system entity itself): this is getting a lawyer's help, not being referred into proceedings.",
6885
+ canonicalCode: "02-06-04-00",
6886
+ enumConstant: "ORGANIZATION_COMMUNITY_LEGALSERVICES"
6887
+ },
6888
+ {
6889
+ code: "048-011-000-000-000-000-000",
6890
+ key: "coordination_governance",
6891
+ title: "Coordination & Governance",
6892
+ selectable: false,
6893
+ parentCode: null,
6894
+ childCodes: [
6895
+ "048-011-001-000-000-000-000",
6896
+ "048-011-002-000-000-000-000"
6897
+ ],
6898
+ definition: "Parent category for coordination and governance bodies (e.g., MDTs, coalitions).",
6899
+ canonicalCode: "02-07-00-00",
6900
+ enumConstant: "ORGANIZATION_GOVERNANCE"
6901
+ },
6902
+ {
6903
+ code: "048-011-001-000-000-000-000",
6904
+ key: "mdt",
6905
+ title: "Multidisciplinary team (MDT)",
6906
+ selectable: true,
6907
+ parentCode: "048-011-000-000-000-000-000",
6908
+ childCodes: [],
6909
+ definition: "A case-level team: professionals from multiple agencies (law enforcement, child welfare, medical, advocacy) who review and coordinate individual cases together; referrals arise out of case review. (E.g., a county trafficking MDT or a CAC-based team.)",
6910
+ canonicalCode: "02-07-01-00",
6911
+ enumConstant: "ORGANIZATION_GOVERNANCE_MDT"
6912
+ },
6913
+ {
6914
+ code: "048-011-002-000-000-000-000",
6915
+ key: "coalition",
6916
+ title: "Coalition (state/regional coalition)",
6917
+ selectable: true,
6918
+ parentCode: "048-011-000-000-000-000-000",
6919
+ childCodes: [],
6920
+ definition: "A state or regional membership body of organizations coordinating at the system level \u2014 training, standards, policy, funding \u2014 not individual cases; referrals from a coalition are typically warm handoffs to a member organization.",
6921
+ canonicalCode: "02-07-02-00",
6922
+ enumConstant: "ORGANIZATION_GOVERNANCE_COALITION"
6923
+ },
6924
+ {
6925
+ code: "048-012-000-000-000-000-000",
6926
+ key: "internal",
6927
+ title: "Internal",
6928
+ selectable: false,
6929
+ parentCode: null,
6930
+ childCodes: [
6931
+ "048-012-001-000-000-000-000"
6932
+ ],
6933
+ definition: "Parent category for internal referrals within the same umbrella agency.",
6934
+ canonicalCode: "02-08-00-00",
6935
+ enumConstant: "ORGANIZATION_INTERNAL"
6936
+ },
6937
+ {
6938
+ code: "048-012-001-000-000-000-000",
6939
+ key: "own_agency_internal",
6940
+ title: "Own agency / internal referral",
6941
+ selectable: true,
6942
+ parentCode: "048-012-000-000-000-000-000",
6943
+ childCodes: [],
6944
+ definition: "Client was referred from another program or unit within the same umbrella agency.",
6945
+ canonicalCode: "02-08-01-00",
6946
+ enumConstant: "ORGANIZATION_INTERNAL_OWNAGENCY"
6947
+ },
6948
+ {
6949
+ code: "048-013-000-000-000-000-000",
6950
+ key: "other_entity",
6951
+ title: "Other",
6952
+ selectable: false,
6953
+ parentCode: null,
6954
+ childCodes: [
6955
+ "048-013-001-000-000-000-000",
6956
+ "048-013-002-000-000-000-000",
6957
+ "048-013-003-000-000-000-000"
6958
+ ],
6959
+ definition: "Parent category for other organizations not captured by the primary sectors.",
6960
+ canonicalCode: "02-09-00-00",
6961
+ enumConstant: "ORGANIZATION_OTHER"
6962
+ },
6963
+ {
6964
+ code: "048-013-001-000-000-000-000",
6965
+ key: "employer",
6966
+ title: "Employer",
6967
+ selectable: true,
6968
+ parentCode: "048-013-000-000-000-000-000",
6969
+ childCodes: [],
6970
+ definition: "Employer, HR, or employee assistance program initiated the referral.",
6971
+ canonicalCode: "02-09-01-00",
6972
+ enumConstant: "ORGANIZATION_OTHER_EMPLOYER"
6973
+ },
6974
+ {
6975
+ code: "048-013-002-000-000-000-000",
6976
+ key: "benefits_public_assistance_office",
6977
+ title: "Benefits/public assistance office",
6978
+ selectable: true,
6979
+ parentCode: "048-013-000-000-000-000-000",
6980
+ childCodes: [],
6981
+ definition: "Government office administering public benefits or eligibility and enrollment (e.g., SNAP, TANF, Medicaid, SSA).",
6982
+ canonicalCode: "02-09-02-00",
6983
+ enumConstant: "ORGANIZATION_OTHER_PUBLICASSISTANCE"
6984
+ },
6985
+ {
6986
+ code: "048-013-003-000-000-000-000",
6987
+ key: "other_organization",
6988
+ title: "Other Organization",
6989
+ selectable: true,
6990
+ parentCode: "048-013-000-000-000-000-000",
6991
+ childCodes: [],
6992
+ definition: "Other organization not otherwise captured by the listed categories.",
6993
+ canonicalCode: "02-09-03-00",
6994
+ enumConstant: "ORGANIZATION_OTHER_UNSPECIFIED"
6995
+ }
6996
+ ]
6997
+ };
6998
+
6999
+ // src/constants/org-type.ts
7000
+ var ENTRIES = referralEntityCategory_v1_2_0_default.entries;
7001
+ var BY_KEY = new Map(ENTRIES.map((e) => [e.key, e]));
7002
+ var BY_CODE = new Map(ENTRIES.map((e) => [e.code, e]));
7003
+ var BY_CANON = new Map(
7004
+ ENTRIES.filter((e) => e.canonicalCode).map((e) => [
7005
+ e.canonicalCode,
7006
+ e
7007
+ ])
7008
+ );
7009
+ var BY_ENUM_CONSTANT = new Map(
7010
+ ENTRIES.filter((e) => e.enumConstant).map((e) => [
7011
+ e.enumConstant,
7012
+ e
7013
+ ])
7014
+ );
7015
+ var isOrgHalf = (e) => (e.canonicalCode ?? "").startsWith("02-");
7016
+ var isHeading = (e) => isOrgHalf(e) && !e.selectable && /^02-\d\d-00-00$/.test(e.canonicalCode ?? "");
7017
+ var ORG_TYPE_HEADING_KEYS = Object.freeze([
7018
+ "housing_shelter_continuum",
7019
+ "hotlines",
7020
+ "justice_protective_systems",
7021
+ "health_behavioral_health",
7022
+ "education",
7023
+ "victim_community_service_providers",
7024
+ "coordination_governance",
7025
+ "internal",
7026
+ "other_entity"
7027
+ ]);
7028
+ var ORG_TYPE_SELECTABLE_KEYS = Object.freeze([
7029
+ "outreach_project",
7030
+ "temporary_shelter",
7031
+ "residential_project",
7032
+ "national_hotline",
7033
+ "local_other_hotline",
7034
+ "hotline",
7035
+ "child_welfare_cps",
7036
+ "juvenile_justice",
7037
+ "law_enforcement",
7038
+ "local_law_enforcement",
7039
+ "state_law_enforcement",
7040
+ "federal_law_enforcement",
7041
+ "tribal_law_enforcement",
7042
+ "other_law_enforcement",
7043
+ "courts_prosecution",
7044
+ "correction_probation",
7045
+ "adult_protective_services",
7046
+ "inpatient_psychiatric_facility",
7047
+ "healthcare_provider",
7048
+ "school_academic_institution",
7049
+ "child_advocacy_center",
7050
+ "victim_service_provider",
7051
+ "community_based_service_provider",
7052
+ "legal_services_provider",
7053
+ "mdt",
7054
+ "coalition",
7055
+ "employer",
7056
+ "benefits_public_assistance_office",
7057
+ "other_organization"
7058
+ ]);
7059
+ var ORG_TYPE_NONPICKABLE_LEAF_KEYS = Object.freeze([
7060
+ "own_agency_internal"
7061
+ ]);
7062
+ var ORG_TYPE_KEYS = Object.freeze([
7063
+ ...ORG_TYPE_HEADING_KEYS,
7064
+ ...ORG_TYPE_SELECTABLE_KEYS,
7065
+ ...ORG_TYPE_NONPICKABLE_LEAF_KEYS
7066
+ ]);
7067
+ var AGENCY_TYPE_KEYS = Object.freeze([
7068
+ ...ORG_TYPE_SELECTABLE_KEYS,
7069
+ ...ORG_TYPE_NONPICKABLE_LEAF_KEYS,
7070
+ "unknown"
7071
+ ]);
7072
+ var ORG_TYPE_KEY_SET = new Set(ORG_TYPE_KEYS);
7073
+ var AGENCY_TYPE_KEY_SET = new Set(AGENCY_TYPE_KEYS);
7074
+ function isOrgTypeKey(value) {
7075
+ return typeof value === "string" && ORG_TYPE_KEY_SET.has(value);
7076
+ }
7077
+ function isAgencyTypeKey(value) {
7078
+ return typeof value === "string" && AGENCY_TYPE_KEY_SET.has(value);
7079
+ }
7080
+ function lookup(value) {
7081
+ if (typeof value !== "string") return null;
7082
+ const v = value.trim();
7083
+ if (!v) return null;
7084
+ return BY_KEY.get(v.toLowerCase()) ?? BY_ENUM_CONSTANT.get(v.toUpperCase()) ?? BY_CANON.get(v) ?? BY_CODE.get(v) ?? null;
7085
+ }
7086
+ function resolveOrgTypeKey(value) {
7087
+ const hit = lookup(value);
7088
+ return hit && isOrgTypeKey(hit.key) ? hit.key : null;
7089
+ }
7090
+ function resolveAgencyTypeKey(value) {
7091
+ const hit = lookup(value);
7092
+ return hit && isAgencyTypeKey(hit.key) ? hit.key : null;
7093
+ }
7094
+ var LEGACY_NUMERIC_TO_REFERRAL_ENTITY_KEY = Object.freeze({
7095
+ 0: "unknown",
7096
+ 1: "own_agency_internal",
7097
+ 2: "self_referred",
7098
+ 3: "family_guardian_friend",
7099
+ 4: "peer",
7100
+ 5: "other_individual",
7101
+ 10: "housing_shelter_continuum",
7102
+ 11: "hotline",
7103
+ 12: "justice_protective_systems",
7104
+ 13: "outreach_project",
7105
+ 14: "temporary_shelter",
7106
+ 15: "residential_project",
7107
+ 16: "health_behavioral_health",
7108
+ 17: "education",
7109
+ 18: "law_enforcement",
7110
+ 19: "other_entity",
7111
+ 20: "child_welfare_cps",
7112
+ 21: "juvenile_justice",
7113
+ 22: "courts_prosecution",
7114
+ 23: "correction_probation",
7115
+ 24: "inpatient_psychiatric_facility",
7116
+ 25: "healthcare_provider",
7117
+ 26: "victim_community_service_providers",
7118
+ 27: "child_advocacy_center",
7119
+ 28: "victim_service_provider",
7120
+ 29: "community_based_service_provider",
7121
+ 30: "employer",
7122
+ 31: "benefits_public_assistance_office"
7123
+ });
7124
+ function resolveReferralEntityKeyFromLegacyNumeric(value) {
7125
+ const n = typeof value === "number" ? value : typeof value === "string" && /^\s*\d{1,2}\s*$/.test(value) ? Number(value) : NaN;
7126
+ if (!Number.isInteger(n)) return null;
7127
+ const table = LEGACY_NUMERIC_TO_REFERRAL_ENTITY_KEY;
7128
+ return table[n] ?? null;
7129
+ }
7130
+ function resolveOrgTypeKeyFromLegacyNumeric(value) {
7131
+ const k = resolveReferralEntityKeyFromLegacyNumeric(value);
7132
+ return k && isOrgTypeKey(k) ? k : null;
7133
+ }
7134
+ function orgTypeEnumConstant(key) {
7135
+ return BY_KEY.get(key)?.enumConstant ?? null;
7136
+ }
7137
+ function orgTypeCanonicalCode(key) {
7138
+ return BY_KEY.get(key)?.canonicalCode ?? null;
7139
+ }
7140
+ function orgTypeLabel(key) {
7141
+ return BY_KEY.get(key)?.title ?? null;
7142
+ }
7143
+ function orgTypeAncestry(key) {
7144
+ const out = [];
7145
+ const seen = /* @__PURE__ */ new Set();
7146
+ let cursor = BY_KEY.get(key);
7147
+ while (cursor && !seen.has(cursor.code)) {
7148
+ seen.add(cursor.code);
7149
+ out.push(cursor.key);
7150
+ cursor = cursor.parentCode ? BY_CODE.get(cursor.parentCode) : void 0;
7151
+ }
7152
+ return out;
7153
+ }
7154
+ var ORG_TYPE_PARENT_KEY = Object.freeze(
7155
+ Object.fromEntries(
7156
+ ENTRIES.filter(isOrgHalf).map((e) => [
7157
+ e.key,
7158
+ e.parentCode ? BY_CODE.get(e.parentCode)?.key ?? null : null
7159
+ ])
7160
+ )
7161
+ );
7162
+ function orgTypeSector(key) {
7163
+ const chain = orgTypeAncestry(key);
7164
+ if (!chain.length) return null;
7165
+ const top = chain[chain.length - 1];
7166
+ const entry = BY_KEY.get(top);
7167
+ return entry && isHeading(entry) ? top : null;
7168
+ }
7169
+ var VICTIM_SERVING_ORG_TYPE_KEYS = Object.freeze([
7170
+ "victim_service_provider",
7171
+ "child_advocacy_center"
7172
+ ]);
7173
+ var LAW_ENFORCEMENT_ORG_TYPE_KEYS = Object.freeze([
7174
+ "law_enforcement",
7175
+ "local_law_enforcement",
7176
+ "state_law_enforcement",
7177
+ "federal_law_enforcement",
7178
+ "tribal_law_enforcement",
7179
+ "other_law_enforcement"
7180
+ ]);
7181
+ var LEGAL_ORG_TYPE_KEYS = Object.freeze([
7182
+ "courts_prosecution",
7183
+ "legal_services_provider"
7184
+ ]);
7185
+ var HEALTHCARE_ORG_TYPE_KEYS = Object.freeze([
7186
+ "health_behavioral_health",
7187
+ "inpatient_psychiatric_facility",
7188
+ "healthcare_provider"
7189
+ ]);
7190
+ var REPORT_AUTHORITY_ORG_TYPE_KEYS = Object.freeze([
7191
+ "justice_protective_systems",
7192
+ "child_welfare_cps",
7193
+ "juvenile_justice",
7194
+ "law_enforcement",
7195
+ "local_law_enforcement",
7196
+ "state_law_enforcement",
7197
+ "federal_law_enforcement",
7198
+ "tribal_law_enforcement",
7199
+ "other_law_enforcement",
7200
+ "courts_prosecution",
7201
+ "correction_probation",
7202
+ "adult_protective_services"
7203
+ ]);
7204
+ var NO_SECTOR_ORG_TYPE_KEYS = Object.freeze([
7205
+ "internal",
7206
+ "own_agency_internal",
7207
+ "unknown"
7208
+ ]);
7209
+ var asSet = (keys) => new Set(keys);
7210
+ var VICTIM_SERVING = asSet(VICTIM_SERVING_ORG_TYPE_KEYS);
7211
+ var LAW_ENFORCEMENT = asSet(LAW_ENFORCEMENT_ORG_TYPE_KEYS);
7212
+ var LEGAL = asSet(LEGAL_ORG_TYPE_KEYS);
7213
+ var HEALTHCARE = asSet(HEALTHCARE_ORG_TYPE_KEYS);
7214
+ var REPORT_AUTHORITY = asSet(REPORT_AUTHORITY_ORG_TYPE_KEYS);
7215
+ var NO_SECTOR = asSet(NO_SECTOR_ORG_TYPE_KEYS);
7216
+ function isVictimServingOrgType(type) {
7217
+ const k = resolveAgencyTypeKey(type);
7218
+ return !!k && VICTIM_SERVING.has(k);
7219
+ }
7220
+ function isLawEnforcementOrgType(type) {
7221
+ const k = resolveAgencyTypeKey(type);
7222
+ return !!k && LAW_ENFORCEMENT.has(k);
7223
+ }
7224
+ function isLegalOrgType(type) {
7225
+ const k = resolveAgencyTypeKey(type);
7226
+ return !!k && LEGAL.has(k);
7227
+ }
7228
+ function isHealthcareOrgType(type) {
7229
+ const k = resolveAgencyTypeKey(type);
7230
+ return !!k && HEALTHCARE.has(k);
7231
+ }
7232
+ function isReportAuthorityOrgType(type) {
7233
+ const k = resolveAgencyTypeKey(type);
7234
+ return !!k && REPORT_AUTHORITY.has(k);
7235
+ }
7236
+ function orgTypeDefaultVsp(type) {
7237
+ const k = resolveAgencyTypeKey(type);
7238
+ if (!k || NO_SECTOR.has(k) || k === "child_advocacy_center") return null;
7239
+ return k === "victim_service_provider";
7240
+ }
7241
+ function orgTypeDefaultSessionRole(type, vsp) {
7242
+ return orgTypeDefaultSessionRoleOrNull(type, vsp) ?? "vsp_staff";
7243
+ }
7244
+ function orgTypeDefaultSessionRoleOrNull(type, vsp) {
7245
+ if (vsp === true) return "vsp_staff";
7246
+ const k = resolveAgencyTypeKey(type);
7247
+ if (!k) return null;
7248
+ if (NO_SECTOR.has(k)) return "vsp_staff";
7249
+ if (VICTIM_SERVING.has(k)) return "vsp_staff";
7250
+ if (LAW_ENFORCEMENT.has(k)) return "law_enforcement_personnel";
7251
+ if (LEGAL.has(k)) return "legal_professional";
7252
+ if (HEALTHCARE.has(k)) return "healthcare_provider_staff";
7253
+ return "other_response_personnel";
7254
+ }
6335
7255
  // Annotate the CommonJS export names for ESM import in node:
6336
7256
  0 && (module.exports = {
6337
7257
  ACCOMMODATION_LABELS,
6338
7258
  ACCOMMODATION_OPTIONS,
6339
7259
  ACTIVE_CVC_136_CORE_INDICATOR_VALUES,
6340
7260
  ACTIVE_INCIDENT_PARTICIPATION_ROLE_VALUES,
7261
+ AGENCY_TYPE_KEYS,
6341
7262
  AGE_BIN_REPORTING,
6342
7263
  AGE_BIN_REPORTING_IS_MINOR,
6343
7264
  AGE_BIN_REPORTING_LABELS,
@@ -6503,6 +7424,7 @@ var FUNCTION_STATUS_LABELS = {
6503
7424
  FUNCTION_STATUS,
6504
7425
  FUNCTION_STATUS_LABELS,
6505
7426
  FUNCTION_STATUS_VALUES,
7427
+ HEALTHCARE_ORG_TYPE_KEYS,
6506
7428
  IC_13_CATEGORIES,
6507
7429
  IC_13_CATEGORY_ORDER,
6508
7430
  IC_13_LABELS,
@@ -6561,8 +7483,17 @@ var FUNCTION_STATUS_LABELS = {
6561
7483
  INTERACTION_TYPES,
6562
7484
  INTERACTION_TYPE_LABELS,
6563
7485
  INVOLVEMENT_ROLE_TO_PERSON_TYPE,
7486
+ LAW_ENFORCEMENT_ORG_TYPE_KEYS,
7487
+ LEGACY_NUMERIC_TO_REFERRAL_ENTITY_KEY,
7488
+ LEGAL_ORG_TYPE_KEYS,
6564
7489
  MINOR_ADULT_STATUS,
6565
7490
  MINOR_ADULT_STATUS_LABELS,
7491
+ NO_SECTOR_ORG_TYPE_KEYS,
7492
+ ORG_TYPE_HEADING_KEYS,
7493
+ ORG_TYPE_KEYS,
7494
+ ORG_TYPE_NONPICKABLE_LEAF_KEYS,
7495
+ ORG_TYPE_PARENT_KEY,
7496
+ ORG_TYPE_SELECTABLE_KEYS,
6566
7497
  PARTICIPATION_ROLE_CATEGORIES,
6567
7498
  PERMISSION_STATE,
6568
7499
  PERMISSION_STATE_DISPLAY,
@@ -6589,6 +7520,7 @@ var FUNCTION_STATUS_LABELS = {
6589
7520
  RELATIONSHIP_DYNAMICS,
6590
7521
  RELATIONSHIP_DYNAMICS_LABELS,
6591
7522
  RELATIONSHIP_DYNAMICS_VALUES,
7523
+ REPORT_AUTHORITY_ORG_TYPE_KEYS,
6592
7524
  ROLE_LEVEL,
6593
7525
  ROLE_LEVEL_LABELS,
6594
7526
  ROLE_LEVEL_VALUES,
@@ -6604,6 +7536,7 @@ var FUNCTION_STATUS_LABELS = {
6604
7536
  USER_STATUS_LABELS,
6605
7537
  VALID_INTERACTION_TYPES,
6606
7538
  VALID_RECORD_STATES,
7539
+ VICTIM_SERVING_ORG_TYPE_KEYS,
6607
7540
  canonicalCoreIndicator,
6608
7541
  canonicalIncidentParticipationRole,
6609
7542
  deriveAgeBinFromAge,
@@ -6619,14 +7552,33 @@ var FUNCTION_STATUS_LABELS = {
6619
7552
  getIC48TopicForCategory,
6620
7553
  getPersonTypeForRole,
6621
7554
  getRelationshipCategory,
7555
+ isAgencyTypeKey,
6622
7556
  isDeprecatedCoreIndicator,
6623
7557
  isDeprecatedIncidentParticipationRole,
7558
+ isHealthcareOrgType,
6624
7559
  isIC56Missingness,
6625
7560
  isIC56ValidChannel,
7561
+ isLawEnforcementOrgType,
7562
+ isLegalOrgType,
6626
7563
  isLgbtqOrientation,
7564
+ isOrgTypeKey,
6627
7565
  isProtectedRelationship,
7566
+ isReportAuthorityOrgType,
6628
7567
  isStructuredNameType,
6629
7568
  isTransgenderGenderIdentity,
7569
+ isVictimServingOrgType,
7570
+ orgTypeAncestry,
7571
+ orgTypeCanonicalCode,
7572
+ orgTypeDefaultSessionRole,
7573
+ orgTypeDefaultSessionRoleOrNull,
7574
+ orgTypeDefaultVsp,
7575
+ orgTypeEnumConstant,
7576
+ orgTypeLabel,
7577
+ orgTypeSector,
7578
+ resolveAgencyTypeKey,
7579
+ resolveOrgTypeKey,
7580
+ resolveOrgTypeKeyFromLegacyNumeric,
7581
+ resolveReferralEntityKeyFromLegacyNumeric,
6630
7582
  sortRelationshipsByPriority
6631
7583
  });
6632
7584
  //# sourceMappingURL=index.cjs.map