@openhi/constructs 0.0.145 → 0.0.146

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.
@@ -9410,7 +9410,6 @@ async function listAllergyIntolerancesOperation(params) {
9410
9410
  function buildOpenHiResourceUrn(opts) {
9411
9411
  return `urn:ohi:${opts.tenantId}:${opts.workspaceId}:${opts.resourceType}:${opts.resourceId}`;
9412
9412
  }
9413
- var REFERENCE_CONTAINMENT_SQL_FRAGMENT = "(resource @> :containmentRelative::jsonb OR resource @> :containmentUrn::jsonb)";
9414
9413
  function parseTypedReference(s) {
9415
9414
  const match = /^([A-Za-z][A-Za-z0-9_]*)\/([^\s/]+)$/.exec(s);
9416
9415
  if (!match) {
@@ -10117,6 +10116,89 @@ var APPOINTMENT_SEARCH_PARAMETERS = [
10117
10116
  { code: "slot", type: "reference", jsonbPath: "$.slot[*]" }
10118
10117
  ];
10119
10118
 
10119
+ // src/data/search/registry/chargeitem-search-parameters.ts
10120
+ var CHARGEITEM_SEARCH_PARAMETERS = [
10121
+ { code: "account", type: "reference", jsonbPath: "$.account[*]" },
10122
+ { code: "code", type: "token", jsonbPath: "$.code" },
10123
+ { code: "context", type: "reference", jsonbPath: "$.context" },
10124
+ { code: "entered-date", type: "date", jsonbPath: "$.enteredDate" },
10125
+ { code: "enterer", type: "reference", jsonbPath: "$.enterer" },
10126
+ {
10127
+ code: "factor-override",
10128
+ type: "string",
10129
+ jsonbPath: "$.factorOverride",
10130
+ modifiers: ["exact", "contains", "missing", "not"]
10131
+ },
10132
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
10133
+ { code: "occurrence", type: "date", jsonbPath: "$.occurrenceDateTime" },
10134
+ { code: "patient", type: "reference", jsonbPath: "$.subject" },
10135
+ {
10136
+ code: "performer-actor",
10137
+ type: "reference",
10138
+ jsonbPath: "$.performer[*].actor"
10139
+ },
10140
+ {
10141
+ code: "performer-function",
10142
+ type: "token",
10143
+ jsonbPath: "$.performer[*].function"
10144
+ },
10145
+ {
10146
+ code: "performing-organization",
10147
+ type: "reference",
10148
+ jsonbPath: "$.performingOrganization"
10149
+ },
10150
+ {
10151
+ code: "requesting-organization",
10152
+ type: "reference",
10153
+ jsonbPath: "$.requestingOrganization"
10154
+ },
10155
+ { code: "service", type: "reference", jsonbPath: "$.service[*]" },
10156
+ { code: "subject", type: "reference", jsonbPath: "$.subject" }
10157
+ ];
10158
+
10159
+ // src/data/search/registry/claim-search-parameters.ts
10160
+ var CLAIM_SEARCH_PARAMETERS = [
10161
+ {
10162
+ code: "care-team",
10163
+ type: "reference",
10164
+ jsonbPath: "$.careTeam[*].provider"
10165
+ },
10166
+ { code: "created", type: "date", jsonbPath: "$.created" },
10167
+ { code: "enterer", type: "reference", jsonbPath: "$.enterer" },
10168
+ { code: "facility", type: "reference", jsonbPath: "$.facility" },
10169
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
10170
+ { code: "insurer", type: "reference", jsonbPath: "$.insurer" },
10171
+ { code: "patient", type: "reference", jsonbPath: "$.patient" },
10172
+ { code: "priority", type: "token", jsonbPath: "$.priority" },
10173
+ { code: "provider", type: "reference", jsonbPath: "$.provider" },
10174
+ { code: "status", type: "token", jsonbPath: "$.status" },
10175
+ { code: "use", type: "token", jsonbPath: "$.use" }
10176
+ ];
10177
+
10178
+ // src/data/search/registry/composition-search-parameters.ts
10179
+ var COMPOSITION_SEARCH_PARAMETERS = [
10180
+ { code: "status", type: "token", jsonbPath: "$.status" },
10181
+ { code: "type", type: "token", jsonbPath: "$.type" },
10182
+ { code: "category", type: "token", jsonbPath: "$.category[*]" },
10183
+ { code: "subject", type: "reference", jsonbPath: "$.subject" },
10184
+ { code: "patient", type: "reference", jsonbPath: "$.subject" },
10185
+ { code: "encounter", type: "reference", jsonbPath: "$.encounter" },
10186
+ { code: "author", type: "reference", jsonbPath: "$.author[*]" },
10187
+ { code: "date", type: "date", jsonbPath: "$.date" },
10188
+ {
10189
+ code: "confidentiality",
10190
+ type: "token",
10191
+ jsonbPath: "$.confidentiality"
10192
+ },
10193
+ {
10194
+ code: "title",
10195
+ type: "string",
10196
+ jsonbPath: "$.title",
10197
+ modifiers: ["exact", "contains", "missing", "not"]
10198
+ },
10199
+ { code: "identifier", type: "token", jsonbPath: "$.identifier" }
10200
+ ];
10201
+
10120
10202
  // src/data/search/registry/condition-search-parameters.ts
10121
10203
  var CONDITION_SEARCH_PARAMETERS = [
10122
10204
  {
@@ -10143,6 +10225,121 @@ var CONDITION_SEARCH_PARAMETERS = [
10143
10225
  { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" }
10144
10226
  ];
10145
10227
 
10228
+ // src/data/search/registry/coverage-search-parameters.ts
10229
+ var COVERAGE_SEARCH_PARAMETERS = [
10230
+ { code: "beneficiary", type: "reference", jsonbPath: "$.beneficiary" },
10231
+ { code: "class-type", type: "token", jsonbPath: "$.class[*].type" },
10232
+ {
10233
+ code: "class-value",
10234
+ type: "string",
10235
+ jsonbPath: "$.class[*].value",
10236
+ modifiers: ["exact", "contains", "missing", "not"]
10237
+ },
10238
+ {
10239
+ code: "dependent",
10240
+ type: "string",
10241
+ jsonbPath: "$.dependent",
10242
+ modifiers: ["exact", "contains", "missing", "not"]
10243
+ },
10244
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
10245
+ { code: "patient", type: "reference", jsonbPath: "$.beneficiary" },
10246
+ { code: "payor", type: "reference", jsonbPath: "$.payor[*]" },
10247
+ {
10248
+ code: "policy-holder",
10249
+ type: "reference",
10250
+ jsonbPath: "$.policyHolder"
10251
+ },
10252
+ { code: "status", type: "token", jsonbPath: "$.status" },
10253
+ { code: "subscriber", type: "reference", jsonbPath: "$.subscriber" },
10254
+ { code: "type", type: "token", jsonbPath: "$.type" }
10255
+ ];
10256
+
10257
+ // src/data/search/registry/diagnosticreport-search-parameters.ts
10258
+ var DIAGNOSTICREPORT_SEARCH_PARAMETERS = [
10259
+ { code: "based-on", type: "reference", jsonbPath: "$.basedOn[*]" },
10260
+ { code: "category", type: "token", jsonbPath: "$.category[*]" },
10261
+ { code: "code", type: "token", jsonbPath: "$.code" },
10262
+ {
10263
+ code: "conclusion",
10264
+ type: "token",
10265
+ jsonbPath: "$.conclusionCode[*]"
10266
+ },
10267
+ { code: "date", type: "date", jsonbPath: "$.effectiveDateTime" },
10268
+ { code: "encounter", type: "reference", jsonbPath: "$.encounter" },
10269
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
10270
+ { code: "issued", type: "date", jsonbPath: "$.issued" },
10271
+ { code: "patient", type: "reference", jsonbPath: "$.subject" },
10272
+ { code: "performer", type: "reference", jsonbPath: "$.performer[*]" },
10273
+ { code: "result", type: "reference", jsonbPath: "$.result[*]" },
10274
+ {
10275
+ code: "results-interpreter",
10276
+ type: "reference",
10277
+ jsonbPath: "$.resultsInterpreter[*]"
10278
+ },
10279
+ { code: "specimen", type: "reference", jsonbPath: "$.specimen[*]" },
10280
+ { code: "status", type: "token", jsonbPath: "$.status" },
10281
+ { code: "subject", type: "reference", jsonbPath: "$.subject" }
10282
+ ];
10283
+
10284
+ // src/data/search/registry/documentmanifest-search-parameters.ts
10285
+ var DOCUMENTMANIFEST_SEARCH_PARAMETERS = [
10286
+ { code: "status", type: "token", jsonbPath: "$.status" },
10287
+ { code: "type", type: "token", jsonbPath: "$.type" },
10288
+ { code: "subject", type: "reference", jsonbPath: "$.subject" },
10289
+ { code: "patient", type: "reference", jsonbPath: "$.subject" },
10290
+ { code: "author", type: "reference", jsonbPath: "$.author[*]" },
10291
+ { code: "recipient", type: "reference", jsonbPath: "$.recipient[*]" },
10292
+ { code: "created", type: "date", jsonbPath: "$.created" },
10293
+ {
10294
+ code: "description",
10295
+ type: "string",
10296
+ jsonbPath: "$.description",
10297
+ modifiers: ["exact", "contains", "missing", "not"]
10298
+ },
10299
+ { code: "identifier", type: "token", jsonbPath: "$.identifier" },
10300
+ {
10301
+ code: "source",
10302
+ type: "string",
10303
+ jsonbPath: "$.source",
10304
+ modifiers: ["exact", "contains", "missing", "not"]
10305
+ },
10306
+ {
10307
+ code: "related-id",
10308
+ type: "token",
10309
+ jsonbPath: "$.related[*].identifier"
10310
+ },
10311
+ {
10312
+ code: "related-ref",
10313
+ type: "reference",
10314
+ jsonbPath: "$.related[*].ref"
10315
+ }
10316
+ ];
10317
+
10318
+ // src/data/search/registry/documentreference-search-parameters.ts
10319
+ var DOCUMENTREFERENCE_SEARCH_PARAMETERS = [
10320
+ { code: "status", type: "token", jsonbPath: "$.status" },
10321
+ { code: "docStatus", type: "token", jsonbPath: "$.docStatus" },
10322
+ { code: "type", type: "token", jsonbPath: "$.type" },
10323
+ { code: "category", type: "token", jsonbPath: "$.category[*]" },
10324
+ { code: "subject", type: "reference", jsonbPath: "$.subject" },
10325
+ { code: "patient", type: "reference", jsonbPath: "$.subject" },
10326
+ { code: "author", type: "reference", jsonbPath: "$.author[*]" },
10327
+ {
10328
+ code: "authenticator",
10329
+ type: "reference",
10330
+ jsonbPath: "$.authenticator"
10331
+ },
10332
+ { code: "custodian", type: "reference", jsonbPath: "$.custodian" },
10333
+ { code: "date", type: "date", jsonbPath: "$.date" },
10334
+ {
10335
+ code: "description",
10336
+ type: "string",
10337
+ jsonbPath: "$.description",
10338
+ modifiers: ["exact", "contains", "missing", "not"]
10339
+ },
10340
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" }
10341
+ ];
10342
+
10146
10343
  // src/data/search/registry/encounter-search-parameters.ts
10147
10344
  var ENCOUNTER_SEARCH_PARAMETERS = [
10148
10345
  { code: "status", type: "token", jsonbPath: "$.status" },
@@ -10169,6 +10366,61 @@ var ENCOUNTER_SEARCH_PARAMETERS = [
10169
10366
  }
10170
10367
  ];
10171
10368
 
10369
+ // src/data/search/registry/endpoint-search-parameters.ts
10370
+ var ENDPOINT_SEARCH_PARAMETERS = [
10371
+ {
10372
+ code: "connection-type",
10373
+ type: "token",
10374
+ jsonbPath: "$.connectionType"
10375
+ },
10376
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
10377
+ {
10378
+ code: "name",
10379
+ type: "string",
10380
+ jsonbPath: "$.name",
10381
+ modifiers: ["exact", "contains", "missing", "not"]
10382
+ },
10383
+ {
10384
+ code: "organization",
10385
+ type: "reference",
10386
+ jsonbPath: "$.managingOrganization"
10387
+ },
10388
+ {
10389
+ code: "payload-type",
10390
+ type: "token",
10391
+ jsonbPath: "$.payloadType[*]"
10392
+ },
10393
+ { code: "status", type: "token", jsonbPath: "$.status" }
10394
+ ];
10395
+
10396
+ // src/data/search/registry/explanationofbenefit-search-parameters.ts
10397
+ var EXPLANATIONOFBENEFIT_SEARCH_PARAMETERS = [
10398
+ {
10399
+ code: "care-team",
10400
+ type: "reference",
10401
+ jsonbPath: "$.careTeam[*].provider"
10402
+ },
10403
+ { code: "claim", type: "reference", jsonbPath: "$.claim" },
10404
+ {
10405
+ code: "coverage",
10406
+ type: "reference",
10407
+ jsonbPath: "$.insurance[*].coverage"
10408
+ },
10409
+ { code: "created", type: "date", jsonbPath: "$.created" },
10410
+ {
10411
+ code: "disposition",
10412
+ type: "string",
10413
+ jsonbPath: "$.disposition",
10414
+ modifiers: ["exact", "contains", "missing", "not"]
10415
+ },
10416
+ { code: "enterer", type: "reference", jsonbPath: "$.enterer" },
10417
+ { code: "facility", type: "reference", jsonbPath: "$.facility" },
10418
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
10419
+ { code: "patient", type: "reference", jsonbPath: "$.patient" },
10420
+ { code: "provider", type: "reference", jsonbPath: "$.provider" },
10421
+ { code: "status", type: "token", jsonbPath: "$.status" }
10422
+ ];
10423
+
10172
10424
  // src/data/search/registry/familymemberhistory-search-parameters.ts
10173
10425
  var FAMILYMEMBERHISTORY_SEARCH_PARAMETERS = [
10174
10426
  { code: "status", type: "token", jsonbPath: "$.status" },
@@ -10180,6 +10432,24 @@ var FAMILYMEMBERHISTORY_SEARCH_PARAMETERS = [
10180
10432
  { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" }
10181
10433
  ];
10182
10434
 
10435
+ // src/data/search/registry/imagingstudy-search-parameters.ts
10436
+ var IMAGINGSTUDY_SEARCH_PARAMETERS = [
10437
+ { code: "basedon", type: "reference", jsonbPath: "$.basedOn[*]" },
10438
+ { code: "bodysite", type: "token", jsonbPath: "$.series[*].bodySite" },
10439
+ { code: "encounter", type: "reference", jsonbPath: "$.encounter" },
10440
+ { code: "endpoint", type: "reference", jsonbPath: "$.endpoint[*]" },
10441
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
10442
+ { code: "interpreter", type: "reference", jsonbPath: "$.interpreter[*]" },
10443
+ { code: "modality", type: "token", jsonbPath: "$.series[*].modality" },
10444
+ { code: "patient", type: "reference", jsonbPath: "$.subject" },
10445
+ { code: "reason", type: "token", jsonbPath: "$.reasonCode[*]" },
10446
+ { code: "referrer", type: "reference", jsonbPath: "$.referrer" },
10447
+ { code: "series", type: "token", jsonbPath: "$.series[*].uid" },
10448
+ { code: "started", type: "date", jsonbPath: "$.started" },
10449
+ { code: "status", type: "token", jsonbPath: "$.status" },
10450
+ { code: "subject", type: "reference", jsonbPath: "$.subject" }
10451
+ ];
10452
+
10183
10453
  // src/data/search/registry/immunization-search-parameters.ts
10184
10454
  var IMMUNIZATION_SEARCH_PARAMETERS = [
10185
10455
  { code: "status", type: "token", jsonbPath: "$.status" },
@@ -10206,6 +10476,54 @@ var IMMUNIZATION_SEARCH_PARAMETERS = [
10206
10476
  { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" }
10207
10477
  ];
10208
10478
 
10479
+ // src/data/search/registry/invoice-search-parameters.ts
10480
+ var INVOICE_SEARCH_PARAMETERS = [
10481
+ { code: "account", type: "reference", jsonbPath: "$.account" },
10482
+ { code: "date", type: "date", jsonbPath: "$.date" },
10483
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
10484
+ { code: "issuer", type: "reference", jsonbPath: "$.issuer" },
10485
+ {
10486
+ code: "participant",
10487
+ type: "reference",
10488
+ jsonbPath: "$.participant[*].actor"
10489
+ },
10490
+ {
10491
+ code: "participant-role",
10492
+ type: "token",
10493
+ jsonbPath: "$.participant[*].role"
10494
+ },
10495
+ { code: "patient", type: "reference", jsonbPath: "$.subject" },
10496
+ { code: "recipient", type: "reference", jsonbPath: "$.recipient" },
10497
+ { code: "status", type: "token", jsonbPath: "$.status" },
10498
+ { code: "subject", type: "reference", jsonbPath: "$.subject" },
10499
+ { code: "type", type: "token", jsonbPath: "$.type" }
10500
+ ];
10501
+
10502
+ // src/data/search/registry/location-search-parameters.ts
10503
+ var LOCATION_SEARCH_PARAMETERS = [
10504
+ { code: "endpoint", type: "reference", jsonbPath: "$.endpoint[*]" },
10505
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
10506
+ {
10507
+ code: "name",
10508
+ type: "string",
10509
+ jsonbPath: "$.name",
10510
+ modifiers: ["exact", "contains", "missing", "not"]
10511
+ },
10512
+ {
10513
+ code: "operational-status",
10514
+ type: "token",
10515
+ jsonbPath: "$.operationalStatus"
10516
+ },
10517
+ {
10518
+ code: "organization",
10519
+ type: "reference",
10520
+ jsonbPath: "$.managingOrganization"
10521
+ },
10522
+ { code: "partof", type: "reference", jsonbPath: "$.partOf" },
10523
+ { code: "status", type: "token", jsonbPath: "$.status" },
10524
+ { code: "type", type: "token", jsonbPath: "$.type[*]" }
10525
+ ];
10526
+
10209
10527
  // src/data/search/registry/medicationrequest-search-parameters.ts
10210
10528
  var MEDICATIONREQUEST_SEARCH_PARAMETERS = [
10211
10529
  { code: "status", type: "token", jsonbPath: "$.status" },
@@ -10267,6 +10585,58 @@ var OBSERVATION_SEARCH_PARAMETERS = [
10267
10585
  { code: "part-of", type: "reference", jsonbPath: "$.partOf[*]" }
10268
10586
  ];
10269
10587
 
10588
+ // src/data/search/registry/organization-search-parameters.ts
10589
+ var ORGANIZATION_SEARCH_PARAMETERS = [
10590
+ { code: "active", type: "token", jsonbPath: "$.active" },
10591
+ {
10592
+ code: "address",
10593
+ type: "string",
10594
+ jsonbPath: "$.address[*].text",
10595
+ modifiers: ["exact", "contains", "missing", "not"]
10596
+ },
10597
+ {
10598
+ code: "address-city",
10599
+ type: "string",
10600
+ jsonbPath: "$.address[*].city",
10601
+ modifiers: ["exact", "contains", "missing", "not"]
10602
+ },
10603
+ {
10604
+ code: "address-country",
10605
+ type: "string",
10606
+ jsonbPath: "$.address[*].country",
10607
+ modifiers: ["exact", "contains", "missing", "not"]
10608
+ },
10609
+ {
10610
+ code: "address-postalcode",
10611
+ type: "string",
10612
+ jsonbPath: "$.address[*].postalCode",
10613
+ modifiers: ["exact", "contains", "missing", "not"]
10614
+ },
10615
+ {
10616
+ code: "address-state",
10617
+ type: "string",
10618
+ jsonbPath: "$.address[*].state",
10619
+ modifiers: ["exact", "contains", "missing", "not"]
10620
+ },
10621
+ { code: "address-use", type: "token", jsonbPath: "$.address[*].use" },
10622
+ { code: "endpoint", type: "reference", jsonbPath: "$.endpoint[*]" },
10623
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
10624
+ {
10625
+ code: "name",
10626
+ type: "string",
10627
+ jsonbPath: "$.name",
10628
+ modifiers: ["exact", "contains", "missing", "not"]
10629
+ },
10630
+ { code: "partof", type: "reference", jsonbPath: "$.partOf" },
10631
+ {
10632
+ code: "phonetic",
10633
+ type: "string",
10634
+ jsonbPath: "$.name",
10635
+ modifiers: ["exact", "contains", "missing", "not"]
10636
+ },
10637
+ { code: "type", type: "token", jsonbPath: "$.type[*]" }
10638
+ ];
10639
+
10270
10640
  // src/data/search/registry/patient-search-parameters.ts
10271
10641
  var PATIENT_SEARCH_PARAMETERS = [
10272
10642
  { code: "gender", type: "token", jsonbPath: "$.gender" },
@@ -10304,6 +10674,101 @@ var PATIENT_SEARCH_PARAMETERS = [
10304
10674
  }
10305
10675
  ];
10306
10676
 
10677
+ // src/data/search/registry/paymentnotice-search-parameters.ts
10678
+ var PAYMENTNOTICE_SEARCH_PARAMETERS = [
10679
+ { code: "created", type: "date", jsonbPath: "$.created" },
10680
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
10681
+ {
10682
+ code: "payment-status",
10683
+ type: "token",
10684
+ jsonbPath: "$.paymentStatus"
10685
+ },
10686
+ { code: "provider", type: "reference", jsonbPath: "$.provider" },
10687
+ { code: "request", type: "reference", jsonbPath: "$.request" },
10688
+ { code: "response", type: "reference", jsonbPath: "$.response" },
10689
+ { code: "status", type: "token", jsonbPath: "$.status" }
10690
+ ];
10691
+
10692
+ // src/data/search/registry/practitioner-search-parameters.ts
10693
+ var PRACTITIONER_SEARCH_PARAMETERS = [
10694
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
10695
+ {
10696
+ code: "name",
10697
+ type: "string",
10698
+ jsonbPath: "$.name[*].text",
10699
+ modifiers: ["exact", "contains", "missing", "not"]
10700
+ },
10701
+ {
10702
+ code: "family",
10703
+ type: "string",
10704
+ jsonbPath: "$.name[*].family",
10705
+ modifiers: ["exact", "contains", "missing", "not"]
10706
+ },
10707
+ {
10708
+ code: "given",
10709
+ type: "string",
10710
+ jsonbPath: "$.name[*].given",
10711
+ modifiers: ["exact", "contains", "missing", "not"]
10712
+ },
10713
+ { code: "active", type: "token", jsonbPath: "$.active" },
10714
+ { code: "gender", type: "token", jsonbPath: "$.gender" },
10715
+ { code: "email", type: "token", jsonbPath: "$.telecom[*]" },
10716
+ { code: "phone", type: "token", jsonbPath: "$.telecom[*]" },
10717
+ { code: "telecom", type: "token", jsonbPath: "$.telecom[*]" },
10718
+ {
10719
+ code: "address",
10720
+ type: "string",
10721
+ jsonbPath: "$.address[*].text",
10722
+ modifiers: ["exact", "contains", "missing", "not"]
10723
+ },
10724
+ {
10725
+ code: "address-city",
10726
+ type: "string",
10727
+ jsonbPath: "$.address[*].city",
10728
+ modifiers: ["exact", "contains", "missing", "not"]
10729
+ },
10730
+ {
10731
+ code: "address-country",
10732
+ type: "string",
10733
+ jsonbPath: "$.address[*].country",
10734
+ modifiers: ["exact", "contains", "missing", "not"]
10735
+ },
10736
+ {
10737
+ code: "address-postalcode",
10738
+ type: "string",
10739
+ jsonbPath: "$.address[*].postalCode",
10740
+ modifiers: ["exact", "contains", "missing", "not"]
10741
+ },
10742
+ {
10743
+ code: "address-state",
10744
+ type: "string",
10745
+ jsonbPath: "$.address[*].state",
10746
+ modifiers: ["exact", "contains", "missing", "not"]
10747
+ },
10748
+ { code: "communication", type: "token", jsonbPath: "$.communication[*]" }
10749
+ ];
10750
+
10751
+ // src/data/search/registry/practitionerrole-search-parameters.ts
10752
+ var PRACTITIONERROLE_SEARCH_PARAMETERS = [
10753
+ { code: "active", type: "token", jsonbPath: "$.active" },
10754
+ { code: "date", type: "date", jsonbPath: "$.period.start" },
10755
+ { code: "email", type: "token", jsonbPath: "$.telecom[*]" },
10756
+ { code: "phone", type: "token", jsonbPath: "$.telecom[*]" },
10757
+ { code: "telecom", type: "token", jsonbPath: "$.telecom[*]" },
10758
+ { code: "endpoint", type: "reference", jsonbPath: "$.endpoint[*]" },
10759
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
10760
+ { code: "location", type: "reference", jsonbPath: "$.location[*]" },
10761
+ { code: "organization", type: "reference", jsonbPath: "$.organization" },
10762
+ { code: "practitioner", type: "reference", jsonbPath: "$.practitioner" },
10763
+ { code: "role", type: "token", jsonbPath: "$.code[*]" },
10764
+ {
10765
+ code: "service",
10766
+ type: "reference",
10767
+ jsonbPath: "$.healthcareService[*]"
10768
+ },
10769
+ { code: "specialty", type: "token", jsonbPath: "$.specialty[*]" }
10770
+ ];
10771
+
10307
10772
  // src/data/search/registry/procedure-search-parameters.ts
10308
10773
  var PROCEDURE_SEARCH_PARAMETERS = [
10309
10774
  { code: "status", type: "token", jsonbPath: "$.status" },
@@ -10330,19 +10795,160 @@ var PROCEDURE_SEARCH_PARAMETERS = [
10330
10795
  }
10331
10796
  ];
10332
10797
 
10798
+ // src/data/search/registry/relatedperson-search-parameters.ts
10799
+ var RELATEDPERSON_SEARCH_PARAMETERS = [
10800
+ { code: "active", type: "token", jsonbPath: "$.active" },
10801
+ {
10802
+ code: "address",
10803
+ type: "string",
10804
+ jsonbPath: "$.address[*].text",
10805
+ modifiers: ["exact", "contains", "missing", "not"]
10806
+ },
10807
+ {
10808
+ code: "address-city",
10809
+ type: "string",
10810
+ jsonbPath: "$.address[*].city",
10811
+ modifiers: ["exact", "contains", "missing", "not"]
10812
+ },
10813
+ { code: "birthdate", type: "date", jsonbPath: "$.birthDate" },
10814
+ { code: "email", type: "token", jsonbPath: "$.telecom[*]" },
10815
+ { code: "phone", type: "token", jsonbPath: "$.telecom[*]" },
10816
+ { code: "telecom", type: "token", jsonbPath: "$.telecom[*]" },
10817
+ { code: "gender", type: "token", jsonbPath: "$.gender" },
10818
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
10819
+ {
10820
+ code: "name",
10821
+ type: "string",
10822
+ jsonbPath: "$.name[*].text",
10823
+ modifiers: ["exact", "contains", "missing", "not"]
10824
+ },
10825
+ { code: "patient", type: "reference", jsonbPath: "$.patient" },
10826
+ {
10827
+ code: "relationship",
10828
+ type: "token",
10829
+ jsonbPath: "$.relationship[*]"
10830
+ }
10831
+ ];
10832
+
10833
+ // src/data/search/registry/schedule-search-parameters.ts
10834
+ var SCHEDULE_SEARCH_PARAMETERS = [
10835
+ { code: "active", type: "token", jsonbPath: "$.active" },
10836
+ { code: "actor", type: "reference", jsonbPath: "$.actor[*]" },
10837
+ { code: "date", type: "date", jsonbPath: "$.planningHorizon.start" },
10838
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
10839
+ {
10840
+ code: "service-category",
10841
+ type: "token",
10842
+ jsonbPath: "$.serviceCategory[*]"
10843
+ },
10844
+ { code: "service-type", type: "token", jsonbPath: "$.serviceType[*]" },
10845
+ { code: "specialty", type: "token", jsonbPath: "$.specialty[*]" }
10846
+ ];
10847
+
10848
+ // src/data/search/registry/slot-search-parameters.ts
10849
+ var SLOT_SEARCH_PARAMETERS = [
10850
+ { code: "status", type: "token", jsonbPath: "$.status" },
10851
+ { code: "start", type: "date", jsonbPath: "$.start" },
10852
+ { code: "schedule", type: "reference", jsonbPath: "$.schedule" },
10853
+ {
10854
+ code: "appointment-type",
10855
+ type: "token",
10856
+ jsonbPath: "$.appointmentType"
10857
+ },
10858
+ {
10859
+ code: "service-category",
10860
+ type: "token",
10861
+ jsonbPath: "$.serviceCategory[*]"
10862
+ },
10863
+ { code: "service-type", type: "token", jsonbPath: "$.serviceType[*]" },
10864
+ { code: "specialty", type: "token", jsonbPath: "$.specialty[*]" },
10865
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" }
10866
+ ];
10867
+
10868
+ // src/data/search/registry/specimen-search-parameters.ts
10869
+ var SPECIMEN_SEARCH_PARAMETERS = [
10870
+ { code: "accession", type: "token", jsonbPath: "$.accessionIdentifier" },
10871
+ {
10872
+ code: "collected",
10873
+ type: "date",
10874
+ jsonbPath: "$.collection.collectedDateTime"
10875
+ },
10876
+ {
10877
+ code: "container-id",
10878
+ type: "token",
10879
+ jsonbPath: "$.container[*].identifier"
10880
+ },
10881
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
10882
+ { code: "parent", type: "reference", jsonbPath: "$.parent[*]" },
10883
+ { code: "patient", type: "reference", jsonbPath: "$.subject" },
10884
+ { code: "status", type: "token", jsonbPath: "$.status" },
10885
+ { code: "subject", type: "reference", jsonbPath: "$.subject" },
10886
+ { code: "type", type: "token", jsonbPath: "$.type" }
10887
+ ];
10888
+
10889
+ // src/data/search/registry/task-search-parameters.ts
10890
+ var TASK_SEARCH_PARAMETERS = [
10891
+ { code: "status", type: "token", jsonbPath: "$.status" },
10892
+ { code: "intent", type: "token", jsonbPath: "$.intent" },
10893
+ { code: "priority", type: "token", jsonbPath: "$.priority" },
10894
+ { code: "code", type: "token", jsonbPath: "$.code" },
10895
+ { code: "business-status", type: "token", jsonbPath: "$.businessStatus" },
10896
+ { code: "subject", type: "reference", jsonbPath: "$.for" },
10897
+ { code: "patient", type: "reference", jsonbPath: "$.for" },
10898
+ { code: "for", type: "reference", jsonbPath: "$.for" },
10899
+ { code: "encounter", type: "reference", jsonbPath: "$.encounter" },
10900
+ { code: "focus", type: "reference", jsonbPath: "$.focus" },
10901
+ { code: "owner", type: "reference", jsonbPath: "$.owner" },
10902
+ { code: "requester", type: "reference", jsonbPath: "$.requester" },
10903
+ { code: "performer", type: "token", jsonbPath: "$.performerType[*]" },
10904
+ { code: "based-on", type: "reference", jsonbPath: "$.basedOn[*]" },
10905
+ { code: "part-of", type: "reference", jsonbPath: "$.partOf[*]" },
10906
+ { code: "period", type: "date", jsonbPath: "$.executionPeriod.start" },
10907
+ { code: "authored-on", type: "date", jsonbPath: "$.authoredOn" },
10908
+ { code: "modified", type: "date", jsonbPath: "$.lastModified" },
10909
+ { code: "reason-code", type: "token", jsonbPath: "$.reasonCode" },
10910
+ {
10911
+ code: "reason-reference",
10912
+ type: "reference",
10913
+ jsonbPath: "$.reasonReference"
10914
+ },
10915
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" }
10916
+ ];
10917
+
10333
10918
  // src/data/search/registry/resolver.ts
10334
10919
  var STATIC_SEARCH_PARAMETER_MAP = {
10335
10920
  AllergyIntolerance: ALLERGYINTOLERANCE_SEARCH_PARAMETERS,
10336
10921
  Appointment: APPOINTMENT_SEARCH_PARAMETERS,
10922
+ ChargeItem: CHARGEITEM_SEARCH_PARAMETERS,
10923
+ Claim: CLAIM_SEARCH_PARAMETERS,
10924
+ Composition: COMPOSITION_SEARCH_PARAMETERS,
10337
10925
  Condition: CONDITION_SEARCH_PARAMETERS,
10926
+ Coverage: COVERAGE_SEARCH_PARAMETERS,
10927
+ DiagnosticReport: DIAGNOSTICREPORT_SEARCH_PARAMETERS,
10928
+ DocumentManifest: DOCUMENTMANIFEST_SEARCH_PARAMETERS,
10929
+ DocumentReference: DOCUMENTREFERENCE_SEARCH_PARAMETERS,
10338
10930
  Encounter: ENCOUNTER_SEARCH_PARAMETERS,
10931
+ Endpoint: ENDPOINT_SEARCH_PARAMETERS,
10932
+ ExplanationOfBenefit: EXPLANATIONOFBENEFIT_SEARCH_PARAMETERS,
10339
10933
  FamilyMemberHistory: FAMILYMEMBERHISTORY_SEARCH_PARAMETERS,
10934
+ ImagingStudy: IMAGINGSTUDY_SEARCH_PARAMETERS,
10340
10935
  Immunization: IMMUNIZATION_SEARCH_PARAMETERS,
10936
+ Invoice: INVOICE_SEARCH_PARAMETERS,
10937
+ Location: LOCATION_SEARCH_PARAMETERS,
10341
10938
  MedicationRequest: MEDICATIONREQUEST_SEARCH_PARAMETERS,
10342
10939
  MedicationStatement: MEDICATIONSTATEMENT_SEARCH_PARAMETERS,
10343
10940
  Observation: OBSERVATION_SEARCH_PARAMETERS,
10941
+ Organization: ORGANIZATION_SEARCH_PARAMETERS,
10344
10942
  Patient: PATIENT_SEARCH_PARAMETERS,
10345
- Procedure: PROCEDURE_SEARCH_PARAMETERS
10943
+ PaymentNotice: PAYMENTNOTICE_SEARCH_PARAMETERS,
10944
+ Practitioner: PRACTITIONER_SEARCH_PARAMETERS,
10945
+ PractitionerRole: PRACTITIONERROLE_SEARCH_PARAMETERS,
10946
+ Procedure: PROCEDURE_SEARCH_PARAMETERS,
10947
+ RelatedPerson: RELATEDPERSON_SEARCH_PARAMETERS,
10948
+ Schedule: SCHEDULE_SEARCH_PARAMETERS,
10949
+ Slot: SLOT_SEARCH_PARAMETERS,
10950
+ Specimen: SPECIMEN_SEARCH_PARAMETERS,
10951
+ Task: TASK_SEARCH_PARAMETERS
10346
10952
  };
10347
10953
  var defaultSearchParameterResolver = (resourceType, _tenantId) => STATIC_SEARCH_PARAMETER_MAP[resourceType] ?? [];
10348
10954
  function getRegisteredSearchParameters(resourceType) {
@@ -12733,63 +13339,159 @@ async function deleteChargeItemRoute(req, res) {
12733
13339
  } catch (err) {
12734
13340
  return sendOperationOutcome500(res, err, "DELETE ChargeItem error:");
12735
13341
  }
12736
- }
12737
-
12738
- // src/data/operations/data/chargeitem/chargeitem-get-by-id-operation.ts
12739
- async function getChargeItemByIdOperation(params) {
12740
- const { context, id, tableName } = params;
12741
- const { tenantId, workspaceId } = context;
12742
- const service = getDynamoDataService(tableName);
12743
- return getDataEntityById(
12744
- service.entities.chargeitem,
12745
- tenantId,
12746
- workspaceId,
12747
- id,
12748
- "ChargeItem"
13342
+ }
13343
+
13344
+ // src/data/operations/data/chargeitem/chargeitem-get-by-id-operation.ts
13345
+ async function getChargeItemByIdOperation(params) {
13346
+ const { context, id, tableName } = params;
13347
+ const { tenantId, workspaceId } = context;
13348
+ const service = getDynamoDataService(tableName);
13349
+ return getDataEntityById(
13350
+ service.entities.chargeitem,
13351
+ tenantId,
13352
+ workspaceId,
13353
+ id,
13354
+ "ChargeItem"
13355
+ );
13356
+ }
13357
+
13358
+ // src/data/rest-api/routes/data/chargeitem/chargeitem-get-by-id-route.ts
13359
+ async function getChargeItemByIdRoute(req, res) {
13360
+ const id = String(req.params.id);
13361
+ const ctx = req.openhiContext;
13362
+ try {
13363
+ const result = await getChargeItemByIdOperation({ context: ctx, id });
13364
+ return res.json(result.resource);
13365
+ } catch (err) {
13366
+ const status = domainErrorToHttpStatus(err);
13367
+ if (status === 404) {
13368
+ const diagnostics = err instanceof NotFoundError ? err.message : `ChargeItem ${id} not found`;
13369
+ return sendOperationOutcome404(res, diagnostics);
13370
+ }
13371
+ return sendOperationOutcome500(res, err, "GET ChargeItem error:");
13372
+ }
13373
+ }
13374
+
13375
+ // src/data/operations/data/chargeitem/chargeitem-list-operation.ts
13376
+ async function listChargeItemsOperation(params) {
13377
+ const { context, tableName, mode } = params;
13378
+ const { tenantId, workspaceId } = context;
13379
+ const service = getDynamoDataService(tableName);
13380
+ return listDataEntitiesByWorkspace(
13381
+ service.entities.chargeitem,
13382
+ tenantId,
13383
+ workspaceId,
13384
+ mode
13385
+ );
13386
+ }
13387
+
13388
+ // src/data/rest-api/routes/data/chargeitem/chargeitem-list-route.ts
13389
+ var CHARGEITEM_RESOURCE_TYPE = "ChargeItem";
13390
+ function stripModifier3(key) {
13391
+ const idx = key.indexOf(":");
13392
+ return idx === -1 ? key : key.slice(0, idx);
13393
+ }
13394
+ function isResultParameter3(key) {
13395
+ return key.startsWith("_");
13396
+ }
13397
+ function sendInvalidSearch4003(res, diagnostics) {
13398
+ return res.status(400).json({
13399
+ resourceType: "OperationOutcome",
13400
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
13401
+ });
13402
+ }
13403
+ function extractSearchParamKeys3(query) {
13404
+ const out = [];
13405
+ for (const rawKey of Object.keys(query)) {
13406
+ if (isResultParameter3(rawKey)) {
13407
+ continue;
13408
+ }
13409
+ out.push({ rawKey, code: stripModifier3(rawKey) });
13410
+ }
13411
+ return out;
13412
+ }
13413
+ function buildUnknownParamDiagnostics3(unknownCodes) {
13414
+ const validCodes = getRegisteredSearchParameters(CHARGEITEM_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
13415
+ const codes = unknownCodes.join(", ");
13416
+ const isPlural = unknownCodes.length !== 1;
13417
+ return [
13418
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for ChargeItem: ${codes}.`,
13419
+ `Valid codes: ${validCodes}.`
13420
+ ].join(" ");
13421
+ }
13422
+ function findMalformedReference3(query, searchParamKeys) {
13423
+ const referenceCodes = new Set(
13424
+ getRegisteredSearchParameters(CHARGEITEM_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
13425
+ );
13426
+ if (referenceCodes.size === 0) {
13427
+ return void 0;
13428
+ }
13429
+ for (const { rawKey, code } of searchParamKeys) {
13430
+ if (!referenceCodes.has(code)) {
13431
+ continue;
13432
+ }
13433
+ const raw = query[rawKey];
13434
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
13435
+ for (const v of values) {
13436
+ const trimmed = v.trim();
13437
+ if (trimmed.length === 0) {
13438
+ continue;
13439
+ }
13440
+ if (parseTypedReference(trimmed) === void 0) {
13441
+ return { rawKey, value: trimmed };
13442
+ }
13443
+ }
13444
+ }
13445
+ return void 0;
13446
+ }
13447
+ async function listChargeItemsRoute(req, res) {
13448
+ const searchParamKeys = extractSearchParamKeys3(
13449
+ req.query
13450
+ );
13451
+ if (searchParamKeys.length === 0) {
13452
+ return handleListRoute({
13453
+ req,
13454
+ res,
13455
+ basePath: BASE_PATH.CHARGEITEM,
13456
+ listOperation: listChargeItemsOperation,
13457
+ errorLogContext: "GET /ChargeItem list error:"
13458
+ });
13459
+ }
13460
+ const registered = getRegisteredSearchParameters(CHARGEITEM_RESOURCE_TYPE);
13461
+ const validCodes = new Set(registered.map((p) => p.code));
13462
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
13463
+ if (unknownCodes.length > 0) {
13464
+ return sendInvalidSearch4003(
13465
+ res,
13466
+ buildUnknownParamDiagnostics3([...new Set(unknownCodes)])
13467
+ );
13468
+ }
13469
+ const malformedRef = findMalformedReference3(
13470
+ req.query,
13471
+ searchParamKeys
12749
13472
  );
12750
- }
12751
-
12752
- // src/data/rest-api/routes/data/chargeitem/chargeitem-get-by-id-route.ts
12753
- async function getChargeItemByIdRoute(req, res) {
12754
- const id = String(req.params.id);
13473
+ if (malformedRef !== void 0) {
13474
+ return sendInvalidSearch4003(
13475
+ res,
13476
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
13477
+ );
13478
+ }
12755
13479
  const ctx = req.openhiContext;
12756
13480
  try {
12757
- const result = await getChargeItemByIdOperation({ context: ctx, id });
12758
- return res.json(result.resource);
13481
+ const result = await genericSearchOperation({
13482
+ resourceType: CHARGEITEM_RESOURCE_TYPE,
13483
+ tenantId: ctx.tenantId,
13484
+ workspaceId: ctx.workspaceId,
13485
+ query: req.query,
13486
+ resolver: defaultSearchParameterResolver
13487
+ });
13488
+ const bundle = buildSearchsetBundle(BASE_PATH.CHARGEITEM, result.entries);
13489
+ return res.json(bundle);
12759
13490
  } catch (err) {
12760
- const status = domainErrorToHttpStatus(err);
12761
- if (status === 404) {
12762
- const diagnostics = err instanceof NotFoundError ? err.message : `ChargeItem ${id} not found`;
12763
- return sendOperationOutcome404(res, diagnostics);
12764
- }
12765
- return sendOperationOutcome500(res, err, "GET ChargeItem error:");
13491
+ return sendOperationOutcome500(res, err, "GET /ChargeItem search error:");
12766
13492
  }
12767
13493
  }
12768
13494
 
12769
- // src/data/operations/data/chargeitem/chargeitem-list-operation.ts
12770
- async function listChargeItemsOperation(params) {
12771
- const { context, tableName, mode } = params;
12772
- const { tenantId, workspaceId } = context;
12773
- const service = getDynamoDataService(tableName);
12774
- return listDataEntitiesByWorkspace(
12775
- service.entities.chargeitem,
12776
- tenantId,
12777
- workspaceId,
12778
- mode
12779
- );
12780
- }
12781
-
12782
- // src/data/rest-api/routes/data/chargeitem/chargeitem-list-route.ts
12783
- async function listChargeItemsRoute(req, res) {
12784
- return handleListRoute({
12785
- req,
12786
- res,
12787
- basePath: BASE_PATH.CHARGEITEM,
12788
- listOperation: listChargeItemsOperation,
12789
- errorLogContext: "GET /ChargeItem list error:"
12790
- });
12791
- }
12792
-
12793
13495
  // src/data/operations/data/chargeitem/chargeitem-update-operation.ts
12794
13496
  async function updateChargeItemOperation(params) {
12795
13497
  const { context, id, body, tableName } = params;
@@ -13191,15 +13893,111 @@ async function listClaimsOperation(params) {
13191
13893
  }
13192
13894
 
13193
13895
  // src/data/rest-api/routes/data/claim/claim-list-route.ts
13194
- async function listClaimsRoute(req, res) {
13195
- return handleListRoute({
13196
- req,
13197
- res,
13198
- basePath: BASE_PATH.CLAIM,
13199
- listOperation: listClaimsOperation,
13200
- errorLogContext: "GET /Claim list error:"
13896
+ var CLAIM_RESOURCE_TYPE = "Claim";
13897
+ function stripModifier4(key) {
13898
+ const idx = key.indexOf(":");
13899
+ return idx === -1 ? key : key.slice(0, idx);
13900
+ }
13901
+ function isResultParameter4(key) {
13902
+ return key.startsWith("_");
13903
+ }
13904
+ function sendInvalidSearch4004(res, diagnostics) {
13905
+ return res.status(400).json({
13906
+ resourceType: "OperationOutcome",
13907
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
13201
13908
  });
13202
13909
  }
13910
+ function extractSearchParamKeys4(query) {
13911
+ const out = [];
13912
+ for (const rawKey of Object.keys(query)) {
13913
+ if (isResultParameter4(rawKey)) {
13914
+ continue;
13915
+ }
13916
+ out.push({ rawKey, code: stripModifier4(rawKey) });
13917
+ }
13918
+ return out;
13919
+ }
13920
+ function buildUnknownParamDiagnostics4(unknownCodes) {
13921
+ const validCodes = getRegisteredSearchParameters(CLAIM_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
13922
+ const codes = unknownCodes.join(", ");
13923
+ const isPlural = unknownCodes.length !== 1;
13924
+ return [
13925
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Claim: ${codes}.`,
13926
+ `Valid codes: ${validCodes}.`
13927
+ ].join(" ");
13928
+ }
13929
+ function findMalformedReference4(query, searchParamKeys) {
13930
+ const referenceCodes = new Set(
13931
+ getRegisteredSearchParameters(CLAIM_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
13932
+ );
13933
+ if (referenceCodes.size === 0) {
13934
+ return void 0;
13935
+ }
13936
+ for (const { rawKey, code } of searchParamKeys) {
13937
+ if (!referenceCodes.has(code)) {
13938
+ continue;
13939
+ }
13940
+ const raw = query[rawKey];
13941
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
13942
+ for (const v of values) {
13943
+ const trimmed = v.trim();
13944
+ if (trimmed.length === 0) {
13945
+ continue;
13946
+ }
13947
+ if (parseTypedReference(trimmed) === void 0) {
13948
+ return { rawKey, value: trimmed };
13949
+ }
13950
+ }
13951
+ }
13952
+ return void 0;
13953
+ }
13954
+ async function listClaimsRoute(req, res) {
13955
+ const searchParamKeys = extractSearchParamKeys4(
13956
+ req.query
13957
+ );
13958
+ if (searchParamKeys.length === 0) {
13959
+ return handleListRoute({
13960
+ req,
13961
+ res,
13962
+ basePath: BASE_PATH.CLAIM,
13963
+ listOperation: listClaimsOperation,
13964
+ errorLogContext: "GET /Claim list error:"
13965
+ });
13966
+ }
13967
+ const registered = getRegisteredSearchParameters(CLAIM_RESOURCE_TYPE);
13968
+ const validCodes = new Set(registered.map((p) => p.code));
13969
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
13970
+ if (unknownCodes.length > 0) {
13971
+ return sendInvalidSearch4004(
13972
+ res,
13973
+ buildUnknownParamDiagnostics4([...new Set(unknownCodes)])
13974
+ );
13975
+ }
13976
+ const malformedRef = findMalformedReference4(
13977
+ req.query,
13978
+ searchParamKeys
13979
+ );
13980
+ if (malformedRef !== void 0) {
13981
+ return sendInvalidSearch4004(
13982
+ res,
13983
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
13984
+ );
13985
+ }
13986
+ const ctx = req.openhiContext;
13987
+ try {
13988
+ const result = await genericSearchOperation({
13989
+ resourceType: CLAIM_RESOURCE_TYPE,
13990
+ tenantId: ctx.tenantId,
13991
+ workspaceId: ctx.workspaceId,
13992
+ query: req.query,
13993
+ resolver: defaultSearchParameterResolver
13994
+ });
13995
+ const bundle = buildSearchsetBundle(BASE_PATH.CLAIM, result.entries);
13996
+ return res.json(bundle);
13997
+ } catch (err) {
13998
+ return sendOperationOutcome500(res, err, "GET /Claim search error:");
13999
+ }
14000
+ }
13203
14001
 
13204
14002
  // src/data/operations/data/claim/claim-update-operation.ts
13205
14003
  async function updateClaimOperation(params) {
@@ -14628,15 +15426,111 @@ async function listCompositionsOperation(params) {
14628
15426
  }
14629
15427
 
14630
15428
  // src/data/rest-api/routes/data/composition/composition-list-route.ts
14631
- async function listCompositionsRoute(req, res) {
14632
- return handleListRoute({
14633
- req,
14634
- res,
14635
- basePath: BASE_PATH.COMPOSITION,
14636
- listOperation: listCompositionsOperation,
14637
- errorLogContext: "GET /Composition list error:"
15429
+ var COMPOSITION_RESOURCE_TYPE = "Composition";
15430
+ function stripModifier5(key) {
15431
+ const idx = key.indexOf(":");
15432
+ return idx === -1 ? key : key.slice(0, idx);
15433
+ }
15434
+ function isResultParameter5(key) {
15435
+ return key.startsWith("_");
15436
+ }
15437
+ function sendInvalidSearch4005(res, diagnostics) {
15438
+ return res.status(400).json({
15439
+ resourceType: "OperationOutcome",
15440
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
14638
15441
  });
14639
15442
  }
15443
+ function extractSearchParamKeys5(query) {
15444
+ const out = [];
15445
+ for (const rawKey of Object.keys(query)) {
15446
+ if (isResultParameter5(rawKey)) {
15447
+ continue;
15448
+ }
15449
+ out.push({ rawKey, code: stripModifier5(rawKey) });
15450
+ }
15451
+ return out;
15452
+ }
15453
+ function buildUnknownParamDiagnostics5(unknownCodes) {
15454
+ const validCodes = getRegisteredSearchParameters(COMPOSITION_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
15455
+ const codes = unknownCodes.join(", ");
15456
+ const isPlural = unknownCodes.length !== 1;
15457
+ return [
15458
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Composition: ${codes}.`,
15459
+ `Valid codes: ${validCodes}.`
15460
+ ].join(" ");
15461
+ }
15462
+ function findMalformedReference5(query, searchParamKeys) {
15463
+ const referenceCodes = new Set(
15464
+ getRegisteredSearchParameters(COMPOSITION_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
15465
+ );
15466
+ if (referenceCodes.size === 0) {
15467
+ return void 0;
15468
+ }
15469
+ for (const { rawKey, code } of searchParamKeys) {
15470
+ if (!referenceCodes.has(code)) {
15471
+ continue;
15472
+ }
15473
+ const raw = query[rawKey];
15474
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
15475
+ for (const v of values) {
15476
+ const trimmed = v.trim();
15477
+ if (trimmed.length === 0) {
15478
+ continue;
15479
+ }
15480
+ if (parseTypedReference(trimmed) === void 0) {
15481
+ return { rawKey, value: trimmed };
15482
+ }
15483
+ }
15484
+ }
15485
+ return void 0;
15486
+ }
15487
+ async function listCompositionsRoute(req, res) {
15488
+ const searchParamKeys = extractSearchParamKeys5(
15489
+ req.query
15490
+ );
15491
+ if (searchParamKeys.length === 0) {
15492
+ return handleListRoute({
15493
+ req,
15494
+ res,
15495
+ basePath: BASE_PATH.COMPOSITION,
15496
+ listOperation: listCompositionsOperation,
15497
+ errorLogContext: "GET /Composition list error:"
15498
+ });
15499
+ }
15500
+ const registered = getRegisteredSearchParameters(COMPOSITION_RESOURCE_TYPE);
15501
+ const validCodes = new Set(registered.map((p) => p.code));
15502
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
15503
+ if (unknownCodes.length > 0) {
15504
+ return sendInvalidSearch4005(
15505
+ res,
15506
+ buildUnknownParamDiagnostics5([...new Set(unknownCodes)])
15507
+ );
15508
+ }
15509
+ const malformedRef = findMalformedReference5(
15510
+ req.query,
15511
+ searchParamKeys
15512
+ );
15513
+ if (malformedRef !== void 0) {
15514
+ return sendInvalidSearch4005(
15515
+ res,
15516
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
15517
+ );
15518
+ }
15519
+ const ctx = req.openhiContext;
15520
+ try {
15521
+ const result = await genericSearchOperation({
15522
+ resourceType: COMPOSITION_RESOURCE_TYPE,
15523
+ tenantId: ctx.tenantId,
15524
+ workspaceId: ctx.workspaceId,
15525
+ query: req.query,
15526
+ resolver: defaultSearchParameterResolver
15527
+ });
15528
+ const bundle = buildSearchsetBundle(BASE_PATH.COMPOSITION, result.entries);
15529
+ return res.json(bundle);
15530
+ } catch (err) {
15531
+ return sendOperationOutcome500(res, err, "GET /Composition search error:");
15532
+ }
15533
+ }
14640
15534
 
14641
15535
  // src/data/operations/data/composition/composition-update-operation.ts
14642
15536
  async function updateCompositionOperation(params) {
@@ -15029,30 +15923,30 @@ async function listConditionsOperation(params) {
15029
15923
 
15030
15924
  // src/data/rest-api/routes/data/condition/condition-list-route.ts
15031
15925
  var CONDITION_RESOURCE_TYPE = "Condition";
15032
- function stripModifier3(key) {
15926
+ function stripModifier6(key) {
15033
15927
  const idx = key.indexOf(":");
15034
15928
  return idx === -1 ? key : key.slice(0, idx);
15035
15929
  }
15036
- function isResultParameter3(key) {
15930
+ function isResultParameter6(key) {
15037
15931
  return key.startsWith("_");
15038
15932
  }
15039
- function sendInvalidSearch4003(res, diagnostics) {
15933
+ function sendInvalidSearch4006(res, diagnostics) {
15040
15934
  return res.status(400).json({
15041
15935
  resourceType: "OperationOutcome",
15042
15936
  issue: [{ severity: "error", code: "invalid", diagnostics }]
15043
15937
  });
15044
15938
  }
15045
- function extractSearchParamKeys3(query) {
15939
+ function extractSearchParamKeys6(query) {
15046
15940
  const out = [];
15047
15941
  for (const rawKey of Object.keys(query)) {
15048
- if (isResultParameter3(rawKey)) {
15942
+ if (isResultParameter6(rawKey)) {
15049
15943
  continue;
15050
15944
  }
15051
- out.push({ rawKey, code: stripModifier3(rawKey) });
15945
+ out.push({ rawKey, code: stripModifier6(rawKey) });
15052
15946
  }
15053
15947
  return out;
15054
15948
  }
15055
- function buildUnknownParamDiagnostics3(unknownCodes) {
15949
+ function buildUnknownParamDiagnostics6(unknownCodes) {
15056
15950
  const validCodes = getRegisteredSearchParameters(CONDITION_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
15057
15951
  const codes = unknownCodes.join(", ");
15058
15952
  const isPlural = unknownCodes.length !== 1;
@@ -15061,7 +15955,7 @@ function buildUnknownParamDiagnostics3(unknownCodes) {
15061
15955
  `Valid codes: ${validCodes}.`
15062
15956
  ].join(" ");
15063
15957
  }
15064
- function findMalformedReference3(query, searchParamKeys) {
15958
+ function findMalformedReference6(query, searchParamKeys) {
15065
15959
  const referenceCodes = new Set(
15066
15960
  getRegisteredSearchParameters(CONDITION_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
15067
15961
  );
@@ -15084,7 +15978,7 @@ function findMalformedReference3(query, searchParamKeys) {
15084
15978
  return void 0;
15085
15979
  }
15086
15980
  async function listConditionsRoute(req, res) {
15087
- const searchParamKeys = extractSearchParamKeys3(
15981
+ const searchParamKeys = extractSearchParamKeys6(
15088
15982
  req.query
15089
15983
  );
15090
15984
  if (searchParamKeys.length === 0) {
@@ -15100,17 +15994,17 @@ async function listConditionsRoute(req, res) {
15100
15994
  const validCodes = new Set(registered.map((p) => p.code));
15101
15995
  const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
15102
15996
  if (unknownCodes.length > 0) {
15103
- return sendInvalidSearch4003(
15997
+ return sendInvalidSearch4006(
15104
15998
  res,
15105
- buildUnknownParamDiagnostics3([...new Set(unknownCodes)])
15999
+ buildUnknownParamDiagnostics6([...new Set(unknownCodes)])
15106
16000
  );
15107
16001
  }
15108
- const malformedRef = findMalformedReference3(
16002
+ const malformedRef = findMalformedReference6(
15109
16003
  req.query,
15110
16004
  searchParamKeys
15111
16005
  );
15112
16006
  if (malformedRef !== void 0) {
15113
- return sendInvalidSearch4003(
16007
+ return sendInvalidSearch4006(
15114
16008
  res,
15115
16009
  `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
15116
16010
  );
@@ -15724,15 +16618,120 @@ async function listCoveragesOperation(params) {
15724
16618
  }
15725
16619
 
15726
16620
  // src/data/rest-api/routes/data/coverage/coverage-list-route.ts
15727
- async function listCoveragesRoute(req, res) {
15728
- return handleListRoute({
15729
- req,
15730
- res,
15731
- basePath: BASE_PATH.COVERAGE,
15732
- listOperation: listCoveragesOperation,
15733
- errorLogContext: "GET /Coverage list error:"
16621
+ var COVERAGE_RESOURCE_TYPE = "Coverage";
16622
+ function stripModifier7(key) {
16623
+ const idx = key.indexOf(":");
16624
+ return idx === -1 ? key : key.slice(0, idx);
16625
+ }
16626
+ function isResultParameter7(key) {
16627
+ return key.startsWith("_");
16628
+ }
16629
+ function sendInvalidSearch4007(res, diagnostics) {
16630
+ return res.status(400).json({
16631
+ resourceType: "OperationOutcome",
16632
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
15734
16633
  });
15735
16634
  }
16635
+ function extractSearchParamKeys7(query) {
16636
+ const out = [];
16637
+ for (const rawKey of Object.keys(query)) {
16638
+ if (isResultParameter7(rawKey)) {
16639
+ continue;
16640
+ }
16641
+ out.push({ rawKey, code: stripModifier7(rawKey) });
16642
+ }
16643
+ return out;
16644
+ }
16645
+ function buildUnknownParamDiagnostics7(unknownCodes) {
16646
+ const validCodes = getRegisteredSearchParameters(COVERAGE_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
16647
+ const codes = unknownCodes.join(", ");
16648
+ const isPlural = unknownCodes.length !== 1;
16649
+ return [
16650
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Coverage: ${codes}.`,
16651
+ `Valid codes: ${validCodes}.`
16652
+ ].join(" ");
16653
+ }
16654
+ function findMalformedReference7(query, searchParamKeys) {
16655
+ const referenceCodes = new Set(
16656
+ getRegisteredSearchParameters(COVERAGE_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
16657
+ );
16658
+ if (referenceCodes.size === 0) {
16659
+ return void 0;
16660
+ }
16661
+ for (const { rawKey, code } of searchParamKeys) {
16662
+ if (!referenceCodes.has(code)) {
16663
+ continue;
16664
+ }
16665
+ const raw = query[rawKey];
16666
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
16667
+ for (const v of values) {
16668
+ const trimmed = v.trim();
16669
+ if (trimmed.length === 0) {
16670
+ continue;
16671
+ }
16672
+ if (parseTypedReference(trimmed) === void 0) {
16673
+ return { rawKey, value: trimmed };
16674
+ }
16675
+ }
16676
+ }
16677
+ return void 0;
16678
+ }
16679
+ async function listCoveragesRoute(req, res) {
16680
+ const searchParamKeys = extractSearchParamKeys7(
16681
+ req.query
16682
+ );
16683
+ if (searchParamKeys.length === 0) {
16684
+ return handleListRoute({
16685
+ req,
16686
+ res,
16687
+ basePath: BASE_PATH.COVERAGE,
16688
+ listOperation: listCoveragesOperation,
16689
+ errorLogContext: "GET /Coverage list error:"
16690
+ });
16691
+ }
16692
+ const registered = getRegisteredSearchParameters(
16693
+ COVERAGE_RESOURCE_TYPE
16694
+ );
16695
+ const validCodes = new Set(registered.map((p) => p.code));
16696
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
16697
+ if (unknownCodes.length > 0) {
16698
+ return sendInvalidSearch4007(
16699
+ res,
16700
+ buildUnknownParamDiagnostics7([...new Set(unknownCodes)])
16701
+ );
16702
+ }
16703
+ const malformedRef = findMalformedReference7(
16704
+ req.query,
16705
+ searchParamKeys
16706
+ );
16707
+ if (malformedRef !== void 0) {
16708
+ return sendInvalidSearch4007(
16709
+ res,
16710
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
16711
+ );
16712
+ }
16713
+ const ctx = req.openhiContext;
16714
+ try {
16715
+ const result = await genericSearchOperation({
16716
+ resourceType: COVERAGE_RESOURCE_TYPE,
16717
+ tenantId: ctx.tenantId,
16718
+ workspaceId: ctx.workspaceId,
16719
+ query: req.query,
16720
+ resolver: defaultSearchParameterResolver
16721
+ });
16722
+ const bundle = buildSearchsetBundle(
16723
+ BASE_PATH.COVERAGE,
16724
+ result.entries
16725
+ );
16726
+ return res.json(bundle);
16727
+ } catch (err) {
16728
+ return sendOperationOutcome500(
16729
+ res,
16730
+ err,
16731
+ "GET /Coverage search error:"
16732
+ );
16733
+ }
16734
+ }
15736
16735
 
15737
16736
  // src/data/operations/data/coverage/coverage-update-operation.ts
15738
16737
  async function updateCoverageOperation(params) {
@@ -17546,39 +18545,146 @@ async function getDiagnosticReportByIdRoute(req, res) {
17546
18545
  const result = await getDiagnosticReportByIdOperation({ context: ctx, id });
17547
18546
  return res.json(result.resource);
17548
18547
  } catch (err) {
17549
- const status = domainErrorToHttpStatus(err);
17550
- if (status === 404) {
17551
- const diagnostics = err instanceof NotFoundError ? err.message : `DiagnosticReport ${id} not found`;
17552
- return sendOperationOutcome404(res, diagnostics);
17553
- }
17554
- return sendOperationOutcome500(res, err, "GET DiagnosticReport error:");
18548
+ const status = domainErrorToHttpStatus(err);
18549
+ if (status === 404) {
18550
+ const diagnostics = err instanceof NotFoundError ? err.message : `DiagnosticReport ${id} not found`;
18551
+ return sendOperationOutcome404(res, diagnostics);
18552
+ }
18553
+ return sendOperationOutcome500(res, err, "GET DiagnosticReport error:");
18554
+ }
18555
+ }
18556
+
18557
+ // src/data/operations/data/diagnosticreport/diagnosticreport-list-operation.ts
18558
+ async function listDiagnosticReportsOperation(params) {
18559
+ const { context, tableName, mode } = params;
18560
+ const { tenantId, workspaceId } = context;
18561
+ const service = getDynamoDataService(tableName);
18562
+ return listDataEntitiesByWorkspace(
18563
+ service.entities.diagnosticreport,
18564
+ tenantId,
18565
+ workspaceId,
18566
+ mode
18567
+ );
18568
+ }
18569
+
18570
+ // src/data/rest-api/routes/data/diagnosticreport/diagnosticreport-list-route.ts
18571
+ var DIAGNOSTICREPORT_RESOURCE_TYPE = "DiagnosticReport";
18572
+ function stripModifier8(key) {
18573
+ const idx = key.indexOf(":");
18574
+ return idx === -1 ? key : key.slice(0, idx);
18575
+ }
18576
+ function isResultParameter8(key) {
18577
+ return key.startsWith("_");
18578
+ }
18579
+ function sendInvalidSearch4008(res, diagnostics) {
18580
+ return res.status(400).json({
18581
+ resourceType: "OperationOutcome",
18582
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
18583
+ });
18584
+ }
18585
+ function extractSearchParamKeys8(query) {
18586
+ const out = [];
18587
+ for (const rawKey of Object.keys(query)) {
18588
+ if (isResultParameter8(rawKey)) {
18589
+ continue;
18590
+ }
18591
+ out.push({ rawKey, code: stripModifier8(rawKey) });
18592
+ }
18593
+ return out;
18594
+ }
18595
+ function buildUnknownParamDiagnostics8(unknownCodes) {
18596
+ const validCodes = getRegisteredSearchParameters(
18597
+ DIAGNOSTICREPORT_RESOURCE_TYPE
18598
+ ).map((p) => p.code).sort().join(", ");
18599
+ const codes = unknownCodes.join(", ");
18600
+ const isPlural = unknownCodes.length !== 1;
18601
+ return [
18602
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for DiagnosticReport: ${codes}.`,
18603
+ `Valid codes: ${validCodes}.`
18604
+ ].join(" ");
18605
+ }
18606
+ function findMalformedReference8(query, searchParamKeys) {
18607
+ const referenceCodes = new Set(
18608
+ getRegisteredSearchParameters(DIAGNOSTICREPORT_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
18609
+ );
18610
+ if (referenceCodes.size === 0) {
18611
+ return void 0;
18612
+ }
18613
+ for (const { rawKey, code } of searchParamKeys) {
18614
+ if (!referenceCodes.has(code)) {
18615
+ continue;
18616
+ }
18617
+ const raw = query[rawKey];
18618
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
18619
+ for (const v of values) {
18620
+ const trimmed = v.trim();
18621
+ if (trimmed.length === 0) {
18622
+ continue;
18623
+ }
18624
+ if (parseTypedReference(trimmed) === void 0) {
18625
+ return { rawKey, value: trimmed };
18626
+ }
18627
+ }
18628
+ }
18629
+ return void 0;
18630
+ }
18631
+ async function listDiagnosticReportsRoute(req, res) {
18632
+ const searchParamKeys = extractSearchParamKeys8(
18633
+ req.query
18634
+ );
18635
+ if (searchParamKeys.length === 0) {
18636
+ return handleListRoute({
18637
+ req,
18638
+ res,
18639
+ basePath: BASE_PATH.DIAGNOSTICREPORT,
18640
+ listOperation: listDiagnosticReportsOperation,
18641
+ errorLogContext: "GET /DiagnosticReport list error:"
18642
+ });
18643
+ }
18644
+ const registered = getRegisteredSearchParameters(
18645
+ DIAGNOSTICREPORT_RESOURCE_TYPE
18646
+ );
18647
+ const validCodes = new Set(registered.map((p) => p.code));
18648
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
18649
+ if (unknownCodes.length > 0) {
18650
+ return sendInvalidSearch4008(
18651
+ res,
18652
+ buildUnknownParamDiagnostics8([...new Set(unknownCodes)])
18653
+ );
18654
+ }
18655
+ const malformedRef = findMalformedReference8(
18656
+ req.query,
18657
+ searchParamKeys
18658
+ );
18659
+ if (malformedRef !== void 0) {
18660
+ return sendInvalidSearch4008(
18661
+ res,
18662
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
18663
+ );
18664
+ }
18665
+ const ctx = req.openhiContext;
18666
+ try {
18667
+ const result = await genericSearchOperation({
18668
+ resourceType: DIAGNOSTICREPORT_RESOURCE_TYPE,
18669
+ tenantId: ctx.tenantId,
18670
+ workspaceId: ctx.workspaceId,
18671
+ query: req.query,
18672
+ resolver: defaultSearchParameterResolver
18673
+ });
18674
+ const bundle = buildSearchsetBundle(
18675
+ BASE_PATH.DIAGNOSTICREPORT,
18676
+ result.entries
18677
+ );
18678
+ return res.json(bundle);
18679
+ } catch (err) {
18680
+ return sendOperationOutcome500(
18681
+ res,
18682
+ err,
18683
+ "GET /DiagnosticReport search error:"
18684
+ );
17555
18685
  }
17556
18686
  }
17557
18687
 
17558
- // src/data/operations/data/diagnosticreport/diagnosticreport-list-operation.ts
17559
- async function listDiagnosticReportsOperation(params) {
17560
- const { context, tableName, mode } = params;
17561
- const { tenantId, workspaceId } = context;
17562
- const service = getDynamoDataService(tableName);
17563
- return listDataEntitiesByWorkspace(
17564
- service.entities.diagnosticreport,
17565
- tenantId,
17566
- workspaceId,
17567
- mode
17568
- );
17569
- }
17570
-
17571
- // src/data/rest-api/routes/data/diagnosticreport/diagnosticreport-list-route.ts
17572
- async function listDiagnosticReportsRoute(req, res) {
17573
- return handleListRoute({
17574
- req,
17575
- res,
17576
- basePath: BASE_PATH.DIAGNOSTICREPORT,
17577
- listOperation: listDiagnosticReportsOperation,
17578
- errorLogContext: "GET /DiagnosticReport list error:"
17579
- });
17580
- }
17581
-
17582
18688
  // src/data/operations/data/diagnosticreport/diagnosticreport-update-operation.ts
17583
18689
  async function updateDiagnosticReportOperation(params) {
17584
18690
  const { context, id, body, tableName } = params;
@@ -17769,15 +18875,122 @@ async function listDocumentManifestsOperation(params) {
17769
18875
  }
17770
18876
 
17771
18877
  // src/data/rest-api/routes/data/documentmanifest/documentmanifest-list-route.ts
17772
- async function listDocumentManifestsRoute(req, res) {
17773
- return handleListRoute({
17774
- req,
17775
- res,
17776
- basePath: BASE_PATH.DOCUMENTMANIFEST,
17777
- listOperation: listDocumentManifestsOperation,
17778
- errorLogContext: "GET /DocumentManifest list error:"
18878
+ var DOCUMENTMANIFEST_RESOURCE_TYPE = "DocumentManifest";
18879
+ function stripModifier9(key) {
18880
+ const idx = key.indexOf(":");
18881
+ return idx === -1 ? key : key.slice(0, idx);
18882
+ }
18883
+ function isResultParameter9(key) {
18884
+ return key.startsWith("_");
18885
+ }
18886
+ function sendInvalidSearch4009(res, diagnostics) {
18887
+ return res.status(400).json({
18888
+ resourceType: "OperationOutcome",
18889
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
17779
18890
  });
17780
18891
  }
18892
+ function extractSearchParamKeys9(query) {
18893
+ const out = [];
18894
+ for (const rawKey of Object.keys(query)) {
18895
+ if (isResultParameter9(rawKey)) {
18896
+ continue;
18897
+ }
18898
+ out.push({ rawKey, code: stripModifier9(rawKey) });
18899
+ }
18900
+ return out;
18901
+ }
18902
+ function buildUnknownParamDiagnostics9(unknownCodes) {
18903
+ const validCodes = getRegisteredSearchParameters(
18904
+ DOCUMENTMANIFEST_RESOURCE_TYPE
18905
+ ).map((p) => p.code).sort().join(", ");
18906
+ const codes = unknownCodes.join(", ");
18907
+ const isPlural = unknownCodes.length !== 1;
18908
+ return [
18909
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for DocumentManifest: ${codes}.`,
18910
+ `Valid codes: ${validCodes}.`
18911
+ ].join(" ");
18912
+ }
18913
+ function findMalformedReference9(query, searchParamKeys) {
18914
+ const referenceCodes = new Set(
18915
+ getRegisteredSearchParameters(DOCUMENTMANIFEST_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
18916
+ );
18917
+ if (referenceCodes.size === 0) {
18918
+ return void 0;
18919
+ }
18920
+ for (const { rawKey, code } of searchParamKeys) {
18921
+ if (!referenceCodes.has(code)) {
18922
+ continue;
18923
+ }
18924
+ const raw = query[rawKey];
18925
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
18926
+ for (const v of values) {
18927
+ const trimmed = v.trim();
18928
+ if (trimmed.length === 0) {
18929
+ continue;
18930
+ }
18931
+ if (parseTypedReference(trimmed) === void 0) {
18932
+ return { rawKey, value: trimmed };
18933
+ }
18934
+ }
18935
+ }
18936
+ return void 0;
18937
+ }
18938
+ async function listDocumentManifestsRoute(req, res) {
18939
+ const searchParamKeys = extractSearchParamKeys9(
18940
+ req.query
18941
+ );
18942
+ if (searchParamKeys.length === 0) {
18943
+ return handleListRoute({
18944
+ req,
18945
+ res,
18946
+ basePath: BASE_PATH.DOCUMENTMANIFEST,
18947
+ listOperation: listDocumentManifestsOperation,
18948
+ errorLogContext: "GET /DocumentManifest list error:"
18949
+ });
18950
+ }
18951
+ const registered = getRegisteredSearchParameters(
18952
+ DOCUMENTMANIFEST_RESOURCE_TYPE
18953
+ );
18954
+ const validCodes = new Set(registered.map((p) => p.code));
18955
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
18956
+ if (unknownCodes.length > 0) {
18957
+ return sendInvalidSearch4009(
18958
+ res,
18959
+ buildUnknownParamDiagnostics9([...new Set(unknownCodes)])
18960
+ );
18961
+ }
18962
+ const malformedRef = findMalformedReference9(
18963
+ req.query,
18964
+ searchParamKeys
18965
+ );
18966
+ if (malformedRef !== void 0) {
18967
+ return sendInvalidSearch4009(
18968
+ res,
18969
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
18970
+ );
18971
+ }
18972
+ const ctx = req.openhiContext;
18973
+ try {
18974
+ const result = await genericSearchOperation({
18975
+ resourceType: DOCUMENTMANIFEST_RESOURCE_TYPE,
18976
+ tenantId: ctx.tenantId,
18977
+ workspaceId: ctx.workspaceId,
18978
+ query: req.query,
18979
+ resolver: defaultSearchParameterResolver
18980
+ });
18981
+ const bundle = buildSearchsetBundle(
18982
+ BASE_PATH.DOCUMENTMANIFEST,
18983
+ result.entries
18984
+ );
18985
+ return res.json(bundle);
18986
+ } catch (err) {
18987
+ return sendOperationOutcome500(
18988
+ res,
18989
+ err,
18990
+ "GET /DocumentManifest search error:"
18991
+ );
18992
+ }
18993
+ }
17781
18994
 
17782
18995
  // src/data/operations/data/documentmanifest/documentmanifest-update-operation.ts
17783
18996
  async function updateDocumentManifestOperation(params) {
@@ -17943,45 +19156,152 @@ async function getDocumentReferenceByIdRoute(req, res) {
17943
19156
  const id = String(req.params.id);
17944
19157
  const ctx = req.openhiContext;
17945
19158
  try {
17946
- const result = await getDocumentReferenceByIdOperation({
17947
- context: ctx,
17948
- id
19159
+ const result = await getDocumentReferenceByIdOperation({
19160
+ context: ctx,
19161
+ id
19162
+ });
19163
+ return res.json(result.resource);
19164
+ } catch (err) {
19165
+ const status = domainErrorToHttpStatus(err);
19166
+ if (status === 404) {
19167
+ const diagnostics = err instanceof NotFoundError ? err.message : `DocumentReference ${id} not found`;
19168
+ return sendOperationOutcome404(res, diagnostics);
19169
+ }
19170
+ return sendOperationOutcome500(res, err, "GET DocumentReference error:");
19171
+ }
19172
+ }
19173
+
19174
+ // src/data/operations/data/documentreference/documentreference-list-operation.ts
19175
+ async function listDocumentReferencesOperation(params) {
19176
+ const { context, tableName, mode } = params;
19177
+ const { tenantId, workspaceId } = context;
19178
+ const service = getDynamoDataService(tableName);
19179
+ return listDataEntitiesByWorkspace(
19180
+ service.entities.documentreference,
19181
+ tenantId,
19182
+ workspaceId,
19183
+ mode
19184
+ );
19185
+ }
19186
+
19187
+ // src/data/rest-api/routes/data/documentreference/documentreference-list-route.ts
19188
+ var DOCUMENTREFERENCE_RESOURCE_TYPE = "DocumentReference";
19189
+ function stripModifier10(key) {
19190
+ const idx = key.indexOf(":");
19191
+ return idx === -1 ? key : key.slice(0, idx);
19192
+ }
19193
+ function isResultParameter10(key) {
19194
+ return key.startsWith("_");
19195
+ }
19196
+ function sendInvalidSearch40010(res, diagnostics) {
19197
+ return res.status(400).json({
19198
+ resourceType: "OperationOutcome",
19199
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
19200
+ });
19201
+ }
19202
+ function extractSearchParamKeys10(query) {
19203
+ const out = [];
19204
+ for (const rawKey of Object.keys(query)) {
19205
+ if (isResultParameter10(rawKey)) {
19206
+ continue;
19207
+ }
19208
+ out.push({ rawKey, code: stripModifier10(rawKey) });
19209
+ }
19210
+ return out;
19211
+ }
19212
+ function buildUnknownParamDiagnostics10(unknownCodes) {
19213
+ const validCodes = getRegisteredSearchParameters(
19214
+ DOCUMENTREFERENCE_RESOURCE_TYPE
19215
+ ).map((p) => p.code).sort().join(", ");
19216
+ const codes = unknownCodes.join(", ");
19217
+ const isPlural = unknownCodes.length !== 1;
19218
+ return [
19219
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for DocumentReference: ${codes}.`,
19220
+ `Valid codes: ${validCodes}.`
19221
+ ].join(" ");
19222
+ }
19223
+ function findMalformedReference10(query, searchParamKeys) {
19224
+ const referenceCodes = new Set(
19225
+ getRegisteredSearchParameters(DOCUMENTREFERENCE_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
19226
+ );
19227
+ if (referenceCodes.size === 0) {
19228
+ return void 0;
19229
+ }
19230
+ for (const { rawKey, code } of searchParamKeys) {
19231
+ if (!referenceCodes.has(code)) {
19232
+ continue;
19233
+ }
19234
+ const raw = query[rawKey];
19235
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
19236
+ for (const v of values) {
19237
+ const trimmed = v.trim();
19238
+ if (trimmed.length === 0) {
19239
+ continue;
19240
+ }
19241
+ if (parseTypedReference(trimmed) === void 0) {
19242
+ return { rawKey, value: trimmed };
19243
+ }
19244
+ }
19245
+ }
19246
+ return void 0;
19247
+ }
19248
+ async function listDocumentReferencesRoute(req, res) {
19249
+ const searchParamKeys = extractSearchParamKeys10(
19250
+ req.query
19251
+ );
19252
+ if (searchParamKeys.length === 0) {
19253
+ return handleListRoute({
19254
+ req,
19255
+ res,
19256
+ basePath: BASE_PATH.DOCUMENTREFERENCE,
19257
+ listOperation: listDocumentReferencesOperation,
19258
+ errorLogContext: "GET /DocumentReference list error:"
19259
+ });
19260
+ }
19261
+ const registered = getRegisteredSearchParameters(
19262
+ DOCUMENTREFERENCE_RESOURCE_TYPE
19263
+ );
19264
+ const validCodes = new Set(registered.map((p) => p.code));
19265
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
19266
+ if (unknownCodes.length > 0) {
19267
+ return sendInvalidSearch40010(
19268
+ res,
19269
+ buildUnknownParamDiagnostics10([...new Set(unknownCodes)])
19270
+ );
19271
+ }
19272
+ const malformedRef = findMalformedReference10(
19273
+ req.query,
19274
+ searchParamKeys
19275
+ );
19276
+ if (malformedRef !== void 0) {
19277
+ return sendInvalidSearch40010(
19278
+ res,
19279
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
19280
+ );
19281
+ }
19282
+ const ctx = req.openhiContext;
19283
+ try {
19284
+ const result = await genericSearchOperation({
19285
+ resourceType: DOCUMENTREFERENCE_RESOURCE_TYPE,
19286
+ tenantId: ctx.tenantId,
19287
+ workspaceId: ctx.workspaceId,
19288
+ query: req.query,
19289
+ resolver: defaultSearchParameterResolver
17949
19290
  });
17950
- return res.json(result.resource);
19291
+ const bundle = buildSearchsetBundle(
19292
+ BASE_PATH.DOCUMENTREFERENCE,
19293
+ result.entries
19294
+ );
19295
+ return res.json(bundle);
17951
19296
  } catch (err) {
17952
- const status = domainErrorToHttpStatus(err);
17953
- if (status === 404) {
17954
- const diagnostics = err instanceof NotFoundError ? err.message : `DocumentReference ${id} not found`;
17955
- return sendOperationOutcome404(res, diagnostics);
17956
- }
17957
- return sendOperationOutcome500(res, err, "GET DocumentReference error:");
19297
+ return sendOperationOutcome500(
19298
+ res,
19299
+ err,
19300
+ "GET /DocumentReference search error:"
19301
+ );
17958
19302
  }
17959
19303
  }
17960
19304
 
17961
- // src/data/operations/data/documentreference/documentreference-list-operation.ts
17962
- async function listDocumentReferencesOperation(params) {
17963
- const { context, tableName, mode } = params;
17964
- const { tenantId, workspaceId } = context;
17965
- const service = getDynamoDataService(tableName);
17966
- return listDataEntitiesByWorkspace(
17967
- service.entities.documentreference,
17968
- tenantId,
17969
- workspaceId,
17970
- mode
17971
- );
17972
- }
17973
-
17974
- // src/data/rest-api/routes/data/documentreference/documentreference-list-route.ts
17975
- async function listDocumentReferencesRoute(req, res) {
17976
- return handleListRoute({
17977
- req,
17978
- res,
17979
- basePath: BASE_PATH.DOCUMENTREFERENCE,
17980
- listOperation: listDocumentReferencesOperation,
17981
- errorLogContext: "GET /DocumentReference list error:"
17982
- });
17983
- }
17984
-
17985
19305
  // src/data/operations/data/documentreference/documentreference-update-operation.ts
17986
19306
  async function updateDocumentReferenceOperation(params) {
17987
19307
  const { context, id, body, tableName } = params;
@@ -18392,30 +19712,30 @@ async function listEncountersOperation(params) {
18392
19712
 
18393
19713
  // src/data/rest-api/routes/data/encounter/encounter-list-route.ts
18394
19714
  var ENCOUNTER_RESOURCE_TYPE = "Encounter";
18395
- function stripModifier4(key) {
19715
+ function stripModifier11(key) {
18396
19716
  const idx = key.indexOf(":");
18397
19717
  return idx === -1 ? key : key.slice(0, idx);
18398
19718
  }
18399
- function isResultParameter4(key) {
19719
+ function isResultParameter11(key) {
18400
19720
  return key.startsWith("_");
18401
19721
  }
18402
- function sendInvalidSearch4004(res, diagnostics) {
19722
+ function sendInvalidSearch40011(res, diagnostics) {
18403
19723
  return res.status(400).json({
18404
19724
  resourceType: "OperationOutcome",
18405
19725
  issue: [{ severity: "error", code: "invalid", diagnostics }]
18406
19726
  });
18407
19727
  }
18408
- function extractSearchParamKeys4(query) {
19728
+ function extractSearchParamKeys11(query) {
18409
19729
  const out = [];
18410
19730
  for (const rawKey of Object.keys(query)) {
18411
- if (isResultParameter4(rawKey)) {
19731
+ if (isResultParameter11(rawKey)) {
18412
19732
  continue;
18413
19733
  }
18414
- out.push({ rawKey, code: stripModifier4(rawKey) });
19734
+ out.push({ rawKey, code: stripModifier11(rawKey) });
18415
19735
  }
18416
19736
  return out;
18417
19737
  }
18418
- function buildUnknownParamDiagnostics4(unknownCodes) {
19738
+ function buildUnknownParamDiagnostics11(unknownCodes) {
18419
19739
  const validCodes = getRegisteredSearchParameters(ENCOUNTER_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
18420
19740
  const codes = unknownCodes.join(", ");
18421
19741
  const isPlural = unknownCodes.length !== 1;
@@ -18424,7 +19744,7 @@ function buildUnknownParamDiagnostics4(unknownCodes) {
18424
19744
  `Valid codes: ${validCodes}.`
18425
19745
  ].join(" ");
18426
19746
  }
18427
- function findMalformedReference4(query, searchParamKeys) {
19747
+ function findMalformedReference11(query, searchParamKeys) {
18428
19748
  const referenceCodes = new Set(
18429
19749
  getRegisteredSearchParameters(ENCOUNTER_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
18430
19750
  );
@@ -18447,7 +19767,7 @@ function findMalformedReference4(query, searchParamKeys) {
18447
19767
  return void 0;
18448
19768
  }
18449
19769
  async function listEncountersRoute(req, res) {
18450
- const searchParamKeys = extractSearchParamKeys4(
19770
+ const searchParamKeys = extractSearchParamKeys11(
18451
19771
  req.query
18452
19772
  );
18453
19773
  if (searchParamKeys.length === 0) {
@@ -18463,17 +19783,17 @@ async function listEncountersRoute(req, res) {
18463
19783
  const validCodes = new Set(registered.map((p) => p.code));
18464
19784
  const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
18465
19785
  if (unknownCodes.length > 0) {
18466
- return sendInvalidSearch4004(
19786
+ return sendInvalidSearch40011(
18467
19787
  res,
18468
- buildUnknownParamDiagnostics4([...new Set(unknownCodes)])
19788
+ buildUnknownParamDiagnostics11([...new Set(unknownCodes)])
18469
19789
  );
18470
19790
  }
18471
- const malformedRef = findMalformedReference4(
19791
+ const malformedRef = findMalformedReference11(
18472
19792
  req.query,
18473
19793
  searchParamKeys
18474
19794
  );
18475
19795
  if (malformedRef !== void 0) {
18476
- return sendInvalidSearch4004(
19796
+ return sendInvalidSearch40011(
18477
19797
  res,
18478
19798
  `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
18479
19799
  );
@@ -18689,15 +20009,111 @@ async function listEndpointsOperation(params) {
18689
20009
  }
18690
20010
 
18691
20011
  // src/data/rest-api/routes/data/endpoint/endpoint-list-route.ts
18692
- async function listEndpointsRoute(req, res) {
18693
- return handleListRoute({
18694
- req,
18695
- res,
18696
- basePath: BASE_PATH.ENDPOINT,
18697
- listOperation: listEndpointsOperation,
18698
- errorLogContext: "GET /Endpoint list error:"
20012
+ var ENDPOINT_RESOURCE_TYPE = "Endpoint";
20013
+ function stripModifier12(key) {
20014
+ const idx = key.indexOf(":");
20015
+ return idx === -1 ? key : key.slice(0, idx);
20016
+ }
20017
+ function isResultParameter12(key) {
20018
+ return key.startsWith("_");
20019
+ }
20020
+ function sendInvalidSearch40012(res, diagnostics) {
20021
+ return res.status(400).json({
20022
+ resourceType: "OperationOutcome",
20023
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
18699
20024
  });
18700
20025
  }
20026
+ function extractSearchParamKeys12(query) {
20027
+ const out = [];
20028
+ for (const rawKey of Object.keys(query)) {
20029
+ if (isResultParameter12(rawKey)) {
20030
+ continue;
20031
+ }
20032
+ out.push({ rawKey, code: stripModifier12(rawKey) });
20033
+ }
20034
+ return out;
20035
+ }
20036
+ function buildUnknownParamDiagnostics12(unknownCodes) {
20037
+ const validCodes = getRegisteredSearchParameters(ENDPOINT_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
20038
+ const codes = unknownCodes.join(", ");
20039
+ const isPlural = unknownCodes.length !== 1;
20040
+ return [
20041
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Endpoint: ${codes}.`,
20042
+ `Valid codes: ${validCodes}.`
20043
+ ].join(" ");
20044
+ }
20045
+ function findMalformedReference12(query, searchParamKeys) {
20046
+ const referenceCodes = new Set(
20047
+ getRegisteredSearchParameters(ENDPOINT_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
20048
+ );
20049
+ if (referenceCodes.size === 0) {
20050
+ return void 0;
20051
+ }
20052
+ for (const { rawKey, code } of searchParamKeys) {
20053
+ if (!referenceCodes.has(code)) {
20054
+ continue;
20055
+ }
20056
+ const raw = query[rawKey];
20057
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
20058
+ for (const v of values) {
20059
+ const trimmed = v.trim();
20060
+ if (trimmed.length === 0) {
20061
+ continue;
20062
+ }
20063
+ if (parseTypedReference(trimmed) === void 0) {
20064
+ return { rawKey, value: trimmed };
20065
+ }
20066
+ }
20067
+ }
20068
+ return void 0;
20069
+ }
20070
+ async function listEndpointsRoute(req, res) {
20071
+ const searchParamKeys = extractSearchParamKeys12(
20072
+ req.query
20073
+ );
20074
+ if (searchParamKeys.length === 0) {
20075
+ return handleListRoute({
20076
+ req,
20077
+ res,
20078
+ basePath: BASE_PATH.ENDPOINT,
20079
+ listOperation: listEndpointsOperation,
20080
+ errorLogContext: "GET /Endpoint list error:"
20081
+ });
20082
+ }
20083
+ const registered = getRegisteredSearchParameters(ENDPOINT_RESOURCE_TYPE);
20084
+ const validCodes = new Set(registered.map((p) => p.code));
20085
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
20086
+ if (unknownCodes.length > 0) {
20087
+ return sendInvalidSearch40012(
20088
+ res,
20089
+ buildUnknownParamDiagnostics12([...new Set(unknownCodes)])
20090
+ );
20091
+ }
20092
+ const malformedRef = findMalformedReference12(
20093
+ req.query,
20094
+ searchParamKeys
20095
+ );
20096
+ if (malformedRef !== void 0) {
20097
+ return sendInvalidSearch40012(
20098
+ res,
20099
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
20100
+ );
20101
+ }
20102
+ const ctx = req.openhiContext;
20103
+ try {
20104
+ const result = await genericSearchOperation({
20105
+ resourceType: ENDPOINT_RESOURCE_TYPE,
20106
+ tenantId: ctx.tenantId,
20107
+ workspaceId: ctx.workspaceId,
20108
+ query: req.query,
20109
+ resolver: defaultSearchParameterResolver
20110
+ });
20111
+ const bundle = buildSearchsetBundle(BASE_PATH.ENDPOINT, result.entries);
20112
+ return res.json(bundle);
20113
+ } catch (err) {
20114
+ return sendOperationOutcome500(res, err, "GET /Endpoint search error:");
20115
+ }
20116
+ }
18701
20117
 
18702
20118
  // src/data/operations/data/endpoint/endpoint-update-operation.ts
18703
20119
  async function updateEndpointOperation(params) {
@@ -20274,52 +21690,159 @@ async function getExplanationOfBenefitByIdOperation(params) {
20274
21690
  id,
20275
21691
  "ExplanationOfBenefit"
20276
21692
  );
20277
- }
20278
-
20279
- // src/data/rest-api/routes/data/explanationofbenefit/explanationofbenefit-get-by-id-route.ts
20280
- async function getExplanationOfBenefitByIdRoute(req, res) {
20281
- const id = String(req.params.id);
21693
+ }
21694
+
21695
+ // src/data/rest-api/routes/data/explanationofbenefit/explanationofbenefit-get-by-id-route.ts
21696
+ async function getExplanationOfBenefitByIdRoute(req, res) {
21697
+ const id = String(req.params.id);
21698
+ const ctx = req.openhiContext;
21699
+ try {
21700
+ const result = await getExplanationOfBenefitByIdOperation({
21701
+ context: ctx,
21702
+ id
21703
+ });
21704
+ return res.json(result.resource);
21705
+ } catch (err) {
21706
+ const status = domainErrorToHttpStatus(err);
21707
+ if (status === 404) {
21708
+ const diagnostics = err instanceof NotFoundError ? err.message : `ExplanationOfBenefit ${id} not found`;
21709
+ return sendOperationOutcome404(res, diagnostics);
21710
+ }
21711
+ return sendOperationOutcome500(res, err, "GET ExplanationOfBenefit error:");
21712
+ }
21713
+ }
21714
+
21715
+ // src/data/operations/data/explanationofbenefit/explanationofbenefit-list-operation.ts
21716
+ async function listExplanationOfBenefitsOperation(params) {
21717
+ const { context, tableName, mode } = params;
21718
+ const { tenantId, workspaceId } = context;
21719
+ const service = getDynamoDataService(tableName);
21720
+ return listDataEntitiesByWorkspace(
21721
+ service.entities.explanationofbenefit,
21722
+ tenantId,
21723
+ workspaceId,
21724
+ mode
21725
+ );
21726
+ }
21727
+
21728
+ // src/data/rest-api/routes/data/explanationofbenefit/explanationofbenefit-list-route.ts
21729
+ var EXPLANATIONOFBENEFIT_RESOURCE_TYPE = "ExplanationOfBenefit";
21730
+ function stripModifier13(key) {
21731
+ const idx = key.indexOf(":");
21732
+ return idx === -1 ? key : key.slice(0, idx);
21733
+ }
21734
+ function isResultParameter13(key) {
21735
+ return key.startsWith("_");
21736
+ }
21737
+ function sendInvalidSearch40013(res, diagnostics) {
21738
+ return res.status(400).json({
21739
+ resourceType: "OperationOutcome",
21740
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
21741
+ });
21742
+ }
21743
+ function extractSearchParamKeys13(query) {
21744
+ const out = [];
21745
+ for (const rawKey of Object.keys(query)) {
21746
+ if (isResultParameter13(rawKey)) {
21747
+ continue;
21748
+ }
21749
+ out.push({ rawKey, code: stripModifier13(rawKey) });
21750
+ }
21751
+ return out;
21752
+ }
21753
+ function buildUnknownParamDiagnostics13(unknownCodes) {
21754
+ const validCodes = getRegisteredSearchParameters(
21755
+ EXPLANATIONOFBENEFIT_RESOURCE_TYPE
21756
+ ).map((p) => p.code).sort().join(", ");
21757
+ const codes = unknownCodes.join(", ");
21758
+ const isPlural = unknownCodes.length !== 1;
21759
+ return [
21760
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for ExplanationOfBenefit: ${codes}.`,
21761
+ `Valid codes: ${validCodes}.`
21762
+ ].join(" ");
21763
+ }
21764
+ function findMalformedReference13(query, searchParamKeys) {
21765
+ const referenceCodes = new Set(
21766
+ getRegisteredSearchParameters(EXPLANATIONOFBENEFIT_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
21767
+ );
21768
+ if (referenceCodes.size === 0) {
21769
+ return void 0;
21770
+ }
21771
+ for (const { rawKey, code } of searchParamKeys) {
21772
+ if (!referenceCodes.has(code)) {
21773
+ continue;
21774
+ }
21775
+ const raw = query[rawKey];
21776
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
21777
+ for (const v of values) {
21778
+ const trimmed = v.trim();
21779
+ if (trimmed.length === 0) {
21780
+ continue;
21781
+ }
21782
+ if (parseTypedReference(trimmed) === void 0) {
21783
+ return { rawKey, value: trimmed };
21784
+ }
21785
+ }
21786
+ }
21787
+ return void 0;
21788
+ }
21789
+ async function listExplanationOfBenefitsRoute(req, res) {
21790
+ const searchParamKeys = extractSearchParamKeys13(
21791
+ req.query
21792
+ );
21793
+ if (searchParamKeys.length === 0) {
21794
+ return handleListRoute({
21795
+ req,
21796
+ res,
21797
+ basePath: BASE_PATH.EXPLANATIONOFBENEFIT,
21798
+ listOperation: listExplanationOfBenefitsOperation,
21799
+ errorLogContext: "GET /ExplanationOfBenefit list error:"
21800
+ });
21801
+ }
21802
+ const registered = getRegisteredSearchParameters(
21803
+ EXPLANATIONOFBENEFIT_RESOURCE_TYPE
21804
+ );
21805
+ const validCodes = new Set(registered.map((p) => p.code));
21806
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
21807
+ if (unknownCodes.length > 0) {
21808
+ return sendInvalidSearch40013(
21809
+ res,
21810
+ buildUnknownParamDiagnostics13([...new Set(unknownCodes)])
21811
+ );
21812
+ }
21813
+ const malformedRef = findMalformedReference13(
21814
+ req.query,
21815
+ searchParamKeys
21816
+ );
21817
+ if (malformedRef !== void 0) {
21818
+ return sendInvalidSearch40013(
21819
+ res,
21820
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
21821
+ );
21822
+ }
20282
21823
  const ctx = req.openhiContext;
20283
21824
  try {
20284
- const result = await getExplanationOfBenefitByIdOperation({
20285
- context: ctx,
20286
- id
21825
+ const result = await genericSearchOperation({
21826
+ resourceType: EXPLANATIONOFBENEFIT_RESOURCE_TYPE,
21827
+ tenantId: ctx.tenantId,
21828
+ workspaceId: ctx.workspaceId,
21829
+ query: req.query,
21830
+ resolver: defaultSearchParameterResolver
20287
21831
  });
20288
- return res.json(result.resource);
21832
+ const bundle = buildSearchsetBundle(
21833
+ BASE_PATH.EXPLANATIONOFBENEFIT,
21834
+ result.entries
21835
+ );
21836
+ return res.json(bundle);
20289
21837
  } catch (err) {
20290
- const status = domainErrorToHttpStatus(err);
20291
- if (status === 404) {
20292
- const diagnostics = err instanceof NotFoundError ? err.message : `ExplanationOfBenefit ${id} not found`;
20293
- return sendOperationOutcome404(res, diagnostics);
20294
- }
20295
- return sendOperationOutcome500(res, err, "GET ExplanationOfBenefit error:");
21838
+ return sendOperationOutcome500(
21839
+ res,
21840
+ err,
21841
+ "GET /ExplanationOfBenefit search error:"
21842
+ );
20296
21843
  }
20297
21844
  }
20298
21845
 
20299
- // src/data/operations/data/explanationofbenefit/explanationofbenefit-list-operation.ts
20300
- async function listExplanationOfBenefitsOperation(params) {
20301
- const { context, tableName, mode } = params;
20302
- const { tenantId, workspaceId } = context;
20303
- const service = getDynamoDataService(tableName);
20304
- return listDataEntitiesByWorkspace(
20305
- service.entities.explanationofbenefit,
20306
- tenantId,
20307
- workspaceId,
20308
- mode
20309
- );
20310
- }
20311
-
20312
- // src/data/rest-api/routes/data/explanationofbenefit/explanationofbenefit-list-route.ts
20313
- async function listExplanationOfBenefitsRoute(req, res) {
20314
- return handleListRoute({
20315
- req,
20316
- res,
20317
- basePath: BASE_PATH.EXPLANATIONOFBENEFIT,
20318
- listOperation: listExplanationOfBenefitsOperation,
20319
- errorLogContext: "GET /ExplanationOfBenefit list error:"
20320
- });
20321
- }
20322
-
20323
21846
  // src/data/operations/data/explanationofbenefit/explanationofbenefit-update-operation.ts
20324
21847
  async function updateExplanationOfBenefitOperation(params) {
20325
21848
  const { context, id, body, tableName } = params;
@@ -20518,30 +22041,30 @@ async function listFamilyMemberHistorysOperation(params) {
20518
22041
 
20519
22042
  // src/data/rest-api/routes/data/familymemberhistory/familymemberhistory-list-route.ts
20520
22043
  var FAMILYMEMBERHISTORY_RESOURCE_TYPE = "FamilyMemberHistory";
20521
- function stripModifier5(key) {
22044
+ function stripModifier14(key) {
20522
22045
  const idx = key.indexOf(":");
20523
22046
  return idx === -1 ? key : key.slice(0, idx);
20524
22047
  }
20525
- function isResultParameter5(key) {
22048
+ function isResultParameter14(key) {
20526
22049
  return key.startsWith("_");
20527
22050
  }
20528
- function sendInvalidSearch4005(res, diagnostics) {
22051
+ function sendInvalidSearch40014(res, diagnostics) {
20529
22052
  return res.status(400).json({
20530
22053
  resourceType: "OperationOutcome",
20531
22054
  issue: [{ severity: "error", code: "invalid", diagnostics }]
20532
22055
  });
20533
22056
  }
20534
- function extractSearchParamKeys5(query) {
22057
+ function extractSearchParamKeys14(query) {
20535
22058
  const out = [];
20536
22059
  for (const rawKey of Object.keys(query)) {
20537
- if (isResultParameter5(rawKey)) {
22060
+ if (isResultParameter14(rawKey)) {
20538
22061
  continue;
20539
22062
  }
20540
- out.push({ rawKey, code: stripModifier5(rawKey) });
22063
+ out.push({ rawKey, code: stripModifier14(rawKey) });
20541
22064
  }
20542
22065
  return out;
20543
22066
  }
20544
- function buildUnknownParamDiagnostics5(unknownCodes) {
22067
+ function buildUnknownParamDiagnostics14(unknownCodes) {
20545
22068
  const validCodes = getRegisteredSearchParameters(
20546
22069
  FAMILYMEMBERHISTORY_RESOURCE_TYPE
20547
22070
  ).map((p) => p.code).sort().join(", ");
@@ -20552,7 +22075,7 @@ function buildUnknownParamDiagnostics5(unknownCodes) {
20552
22075
  `Valid codes: ${validCodes}.`
20553
22076
  ].join(" ");
20554
22077
  }
20555
- function findMalformedReference5(query, searchParamKeys) {
22078
+ function findMalformedReference14(query, searchParamKeys) {
20556
22079
  const referenceCodes = new Set(
20557
22080
  getRegisteredSearchParameters(FAMILYMEMBERHISTORY_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
20558
22081
  );
@@ -20575,7 +22098,7 @@ function findMalformedReference5(query, searchParamKeys) {
20575
22098
  return void 0;
20576
22099
  }
20577
22100
  async function listFamilyMemberHistorysRoute(req, res) {
20578
- const searchParamKeys = extractSearchParamKeys5(
22101
+ const searchParamKeys = extractSearchParamKeys14(
20579
22102
  req.query
20580
22103
  );
20581
22104
  if (searchParamKeys.length === 0) {
@@ -20593,17 +22116,17 @@ async function listFamilyMemberHistorysRoute(req, res) {
20593
22116
  const validCodes = new Set(registered.map((p) => p.code));
20594
22117
  const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
20595
22118
  if (unknownCodes.length > 0) {
20596
- return sendInvalidSearch4005(
22119
+ return sendInvalidSearch40014(
20597
22120
  res,
20598
- buildUnknownParamDiagnostics5([...new Set(unknownCodes)])
22121
+ buildUnknownParamDiagnostics14([...new Set(unknownCodes)])
20599
22122
  );
20600
22123
  }
20601
- const malformedRef = findMalformedReference5(
22124
+ const malformedRef = findMalformedReference14(
20602
22125
  req.query,
20603
22126
  searchParamKeys
20604
22127
  );
20605
22128
  if (malformedRef !== void 0) {
20606
- return sendInvalidSearch4005(
22129
+ return sendInvalidSearch40014(
20607
22130
  res,
20608
22131
  `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
20609
22132
  );
@@ -22024,15 +23547,111 @@ async function listImagingStudysOperation(params) {
22024
23547
  }
22025
23548
 
22026
23549
  // src/data/rest-api/routes/data/imagingstudy/imagingstudy-list-route.ts
22027
- async function listImagingStudysRoute(req, res) {
22028
- return handleListRoute({
22029
- req,
22030
- res,
22031
- basePath: BASE_PATH.IMAGINGSTUDY,
22032
- listOperation: listImagingStudysOperation,
22033
- errorLogContext: "GET /ImagingStudy list error:"
23550
+ var IMAGINGSTUDY_RESOURCE_TYPE = "ImagingStudy";
23551
+ function stripModifier15(key) {
23552
+ const idx = key.indexOf(":");
23553
+ return idx === -1 ? key : key.slice(0, idx);
23554
+ }
23555
+ function isResultParameter15(key) {
23556
+ return key.startsWith("_");
23557
+ }
23558
+ function sendInvalidSearch40015(res, diagnostics) {
23559
+ return res.status(400).json({
23560
+ resourceType: "OperationOutcome",
23561
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
22034
23562
  });
22035
23563
  }
23564
+ function extractSearchParamKeys15(query) {
23565
+ const out = [];
23566
+ for (const rawKey of Object.keys(query)) {
23567
+ if (isResultParameter15(rawKey)) {
23568
+ continue;
23569
+ }
23570
+ out.push({ rawKey, code: stripModifier15(rawKey) });
23571
+ }
23572
+ return out;
23573
+ }
23574
+ function buildUnknownParamDiagnostics15(unknownCodes) {
23575
+ const validCodes = getRegisteredSearchParameters(IMAGINGSTUDY_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
23576
+ const codes = unknownCodes.join(", ");
23577
+ const isPlural = unknownCodes.length !== 1;
23578
+ return [
23579
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for ImagingStudy: ${codes}.`,
23580
+ `Valid codes: ${validCodes}.`
23581
+ ].join(" ");
23582
+ }
23583
+ function findMalformedReference15(query, searchParamKeys) {
23584
+ const referenceCodes = new Set(
23585
+ getRegisteredSearchParameters(IMAGINGSTUDY_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
23586
+ );
23587
+ if (referenceCodes.size === 0) {
23588
+ return void 0;
23589
+ }
23590
+ for (const { rawKey, code } of searchParamKeys) {
23591
+ if (!referenceCodes.has(code)) {
23592
+ continue;
23593
+ }
23594
+ const raw = query[rawKey];
23595
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
23596
+ for (const v of values) {
23597
+ const trimmed = v.trim();
23598
+ if (trimmed.length === 0) {
23599
+ continue;
23600
+ }
23601
+ if (parseTypedReference(trimmed) === void 0) {
23602
+ return { rawKey, value: trimmed };
23603
+ }
23604
+ }
23605
+ }
23606
+ return void 0;
23607
+ }
23608
+ async function listImagingStudysRoute(req, res) {
23609
+ const searchParamKeys = extractSearchParamKeys15(
23610
+ req.query
23611
+ );
23612
+ if (searchParamKeys.length === 0) {
23613
+ return handleListRoute({
23614
+ req,
23615
+ res,
23616
+ basePath: BASE_PATH.IMAGINGSTUDY,
23617
+ listOperation: listImagingStudysOperation,
23618
+ errorLogContext: "GET /ImagingStudy list error:"
23619
+ });
23620
+ }
23621
+ const registered = getRegisteredSearchParameters(IMAGINGSTUDY_RESOURCE_TYPE);
23622
+ const validCodes = new Set(registered.map((p) => p.code));
23623
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
23624
+ if (unknownCodes.length > 0) {
23625
+ return sendInvalidSearch40015(
23626
+ res,
23627
+ buildUnknownParamDiagnostics15([...new Set(unknownCodes)])
23628
+ );
23629
+ }
23630
+ const malformedRef = findMalformedReference15(
23631
+ req.query,
23632
+ searchParamKeys
23633
+ );
23634
+ if (malformedRef !== void 0) {
23635
+ return sendInvalidSearch40015(
23636
+ res,
23637
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
23638
+ );
23639
+ }
23640
+ const ctx = req.openhiContext;
23641
+ try {
23642
+ const result = await genericSearchOperation({
23643
+ resourceType: IMAGINGSTUDY_RESOURCE_TYPE,
23644
+ tenantId: ctx.tenantId,
23645
+ workspaceId: ctx.workspaceId,
23646
+ query: req.query,
23647
+ resolver: defaultSearchParameterResolver
23648
+ });
23649
+ const bundle = buildSearchsetBundle(BASE_PATH.IMAGINGSTUDY, result.entries);
23650
+ return res.json(bundle);
23651
+ } catch (err) {
23652
+ return sendOperationOutcome500(res, err, "GET /ImagingStudy search error:");
23653
+ }
23654
+ }
22036
23655
 
22037
23656
  // src/data/operations/data/imagingstudy/imagingstudy-update-operation.ts
22038
23657
  async function updateImagingStudyOperation(params) {
@@ -22225,30 +23844,30 @@ async function listImmunizationsOperation(params) {
22225
23844
 
22226
23845
  // src/data/rest-api/routes/data/immunization/immunization-list-route.ts
22227
23846
  var IMMUNIZATION_RESOURCE_TYPE = "Immunization";
22228
- function stripModifier6(key) {
23847
+ function stripModifier16(key) {
22229
23848
  const idx = key.indexOf(":");
22230
23849
  return idx === -1 ? key : key.slice(0, idx);
22231
23850
  }
22232
- function isResultParameter6(key) {
23851
+ function isResultParameter16(key) {
22233
23852
  return key.startsWith("_");
22234
23853
  }
22235
- function sendInvalidSearch4006(res, diagnostics) {
23854
+ function sendInvalidSearch40016(res, diagnostics) {
22236
23855
  return res.status(400).json({
22237
23856
  resourceType: "OperationOutcome",
22238
23857
  issue: [{ severity: "error", code: "invalid", diagnostics }]
22239
23858
  });
22240
23859
  }
22241
- function extractSearchParamKeys6(query) {
23860
+ function extractSearchParamKeys16(query) {
22242
23861
  const out = [];
22243
23862
  for (const rawKey of Object.keys(query)) {
22244
- if (isResultParameter6(rawKey)) {
23863
+ if (isResultParameter16(rawKey)) {
22245
23864
  continue;
22246
23865
  }
22247
- out.push({ rawKey, code: stripModifier6(rawKey) });
23866
+ out.push({ rawKey, code: stripModifier16(rawKey) });
22248
23867
  }
22249
23868
  return out;
22250
23869
  }
22251
- function buildUnknownParamDiagnostics6(unknownCodes) {
23870
+ function buildUnknownParamDiagnostics16(unknownCodes) {
22252
23871
  const validCodes = getRegisteredSearchParameters(IMMUNIZATION_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
22253
23872
  const codes = unknownCodes.join(", ");
22254
23873
  const isPlural = unknownCodes.length !== 1;
@@ -22257,7 +23876,7 @@ function buildUnknownParamDiagnostics6(unknownCodes) {
22257
23876
  `Valid codes: ${validCodes}.`
22258
23877
  ].join(" ");
22259
23878
  }
22260
- function findMalformedReference6(query, searchParamKeys) {
23879
+ function findMalformedReference16(query, searchParamKeys) {
22261
23880
  const referenceCodes = new Set(
22262
23881
  getRegisteredSearchParameters(IMMUNIZATION_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
22263
23882
  );
@@ -22280,7 +23899,7 @@ function findMalformedReference6(query, searchParamKeys) {
22280
23899
  return void 0;
22281
23900
  }
22282
23901
  async function listImmunizationsRoute(req, res) {
22283
- const searchParamKeys = extractSearchParamKeys6(
23902
+ const searchParamKeys = extractSearchParamKeys16(
22284
23903
  req.query
22285
23904
  );
22286
23905
  if (searchParamKeys.length === 0) {
@@ -22296,17 +23915,17 @@ async function listImmunizationsRoute(req, res) {
22296
23915
  const validCodes = new Set(registered.map((p) => p.code));
22297
23916
  const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
22298
23917
  if (unknownCodes.length > 0) {
22299
- return sendInvalidSearch4006(
23918
+ return sendInvalidSearch40016(
22300
23919
  res,
22301
- buildUnknownParamDiagnostics6([...new Set(unknownCodes)])
23920
+ buildUnknownParamDiagnostics16([...new Set(unknownCodes)])
22302
23921
  );
22303
23922
  }
22304
- const malformedRef = findMalformedReference6(
23923
+ const malformedRef = findMalformedReference16(
22305
23924
  req.query,
22306
23925
  searchParamKeys
22307
23926
  );
22308
23927
  if (malformedRef !== void 0) {
22309
- return sendInvalidSearch4006(
23928
+ return sendInvalidSearch40016(
22310
23929
  res,
22311
23930
  `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
22312
23931
  );
@@ -23336,42 +24955,138 @@ async function getInvoiceByIdRoute(req, res) {
23336
24955
  const id = String(req.params.id);
23337
24956
  const ctx = req.openhiContext;
23338
24957
  try {
23339
- const result = await getInvoiceByIdOperation({ context: ctx, id });
23340
- return res.json(result.resource);
24958
+ const result = await getInvoiceByIdOperation({ context: ctx, id });
24959
+ return res.json(result.resource);
24960
+ } catch (err) {
24961
+ const status = domainErrorToHttpStatus(err);
24962
+ if (status === 404) {
24963
+ const diagnostics = err instanceof NotFoundError ? err.message : `Invoice ${id} not found`;
24964
+ return sendOperationOutcome404(res, diagnostics);
24965
+ }
24966
+ return sendOperationOutcome500(res, err, "GET Invoice error:");
24967
+ }
24968
+ }
24969
+
24970
+ // src/data/operations/data/invoice/invoice-list-operation.ts
24971
+ async function listInvoicesOperation(params) {
24972
+ const { context, tableName, mode } = params;
24973
+ const { tenantId, workspaceId } = context;
24974
+ const service = getDynamoDataService(tableName);
24975
+ return listDataEntitiesByWorkspace(
24976
+ service.entities.invoice,
24977
+ tenantId,
24978
+ workspaceId,
24979
+ mode
24980
+ );
24981
+ }
24982
+
24983
+ // src/data/rest-api/routes/data/invoice/invoice-list-route.ts
24984
+ var INVOICE_RESOURCE_TYPE = "Invoice";
24985
+ function stripModifier17(key) {
24986
+ const idx = key.indexOf(":");
24987
+ return idx === -1 ? key : key.slice(0, idx);
24988
+ }
24989
+ function isResultParameter17(key) {
24990
+ return key.startsWith("_");
24991
+ }
24992
+ function sendInvalidSearch40017(res, diagnostics) {
24993
+ return res.status(400).json({
24994
+ resourceType: "OperationOutcome",
24995
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
24996
+ });
24997
+ }
24998
+ function extractSearchParamKeys17(query) {
24999
+ const out = [];
25000
+ for (const rawKey of Object.keys(query)) {
25001
+ if (isResultParameter17(rawKey)) {
25002
+ continue;
25003
+ }
25004
+ out.push({ rawKey, code: stripModifier17(rawKey) });
25005
+ }
25006
+ return out;
25007
+ }
25008
+ function buildUnknownParamDiagnostics17(unknownCodes) {
25009
+ const validCodes = getRegisteredSearchParameters(INVOICE_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
25010
+ const codes = unknownCodes.join(", ");
25011
+ const isPlural = unknownCodes.length !== 1;
25012
+ return [
25013
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Invoice: ${codes}.`,
25014
+ `Valid codes: ${validCodes}.`
25015
+ ].join(" ");
25016
+ }
25017
+ function findMalformedReference17(query, searchParamKeys) {
25018
+ const referenceCodes = new Set(
25019
+ getRegisteredSearchParameters(INVOICE_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
25020
+ );
25021
+ if (referenceCodes.size === 0) {
25022
+ return void 0;
25023
+ }
25024
+ for (const { rawKey, code } of searchParamKeys) {
25025
+ if (!referenceCodes.has(code)) {
25026
+ continue;
25027
+ }
25028
+ const raw = query[rawKey];
25029
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
25030
+ for (const v of values) {
25031
+ const trimmed = v.trim();
25032
+ if (trimmed.length === 0) {
25033
+ continue;
25034
+ }
25035
+ if (parseTypedReference(trimmed) === void 0) {
25036
+ return { rawKey, value: trimmed };
25037
+ }
25038
+ }
25039
+ }
25040
+ return void 0;
25041
+ }
25042
+ async function listInvoicesRoute(req, res) {
25043
+ const searchParamKeys = extractSearchParamKeys17(
25044
+ req.query
25045
+ );
25046
+ if (searchParamKeys.length === 0) {
25047
+ return handleListRoute({
25048
+ req,
25049
+ res,
25050
+ basePath: BASE_PATH.INVOICE,
25051
+ listOperation: listInvoicesOperation,
25052
+ errorLogContext: "GET /Invoice list error:"
25053
+ });
25054
+ }
25055
+ const registered = getRegisteredSearchParameters(INVOICE_RESOURCE_TYPE);
25056
+ const validCodes = new Set(registered.map((p) => p.code));
25057
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
25058
+ if (unknownCodes.length > 0) {
25059
+ return sendInvalidSearch40017(
25060
+ res,
25061
+ buildUnknownParamDiagnostics17([...new Set(unknownCodes)])
25062
+ );
25063
+ }
25064
+ const malformedRef = findMalformedReference17(
25065
+ req.query,
25066
+ searchParamKeys
25067
+ );
25068
+ if (malformedRef !== void 0) {
25069
+ return sendInvalidSearch40017(
25070
+ res,
25071
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
25072
+ );
25073
+ }
25074
+ const ctx = req.openhiContext;
25075
+ try {
25076
+ const result = await genericSearchOperation({
25077
+ resourceType: INVOICE_RESOURCE_TYPE,
25078
+ tenantId: ctx.tenantId,
25079
+ workspaceId: ctx.workspaceId,
25080
+ query: req.query,
25081
+ resolver: defaultSearchParameterResolver
25082
+ });
25083
+ const bundle = buildSearchsetBundle(BASE_PATH.INVOICE, result.entries);
25084
+ return res.json(bundle);
23341
25085
  } catch (err) {
23342
- const status = domainErrorToHttpStatus(err);
23343
- if (status === 404) {
23344
- const diagnostics = err instanceof NotFoundError ? err.message : `Invoice ${id} not found`;
23345
- return sendOperationOutcome404(res, diagnostics);
23346
- }
23347
- return sendOperationOutcome500(res, err, "GET Invoice error:");
25086
+ return sendOperationOutcome500(res, err, "GET /Invoice search error:");
23348
25087
  }
23349
25088
  }
23350
25089
 
23351
- // src/data/operations/data/invoice/invoice-list-operation.ts
23352
- async function listInvoicesOperation(params) {
23353
- const { context, tableName, mode } = params;
23354
- const { tenantId, workspaceId } = context;
23355
- const service = getDynamoDataService(tableName);
23356
- return listDataEntitiesByWorkspace(
23357
- service.entities.invoice,
23358
- tenantId,
23359
- workspaceId,
23360
- mode
23361
- );
23362
- }
23363
-
23364
- // src/data/rest-api/routes/data/invoice/invoice-list-route.ts
23365
- async function listInvoicesRoute(req, res) {
23366
- return handleListRoute({
23367
- req,
23368
- res,
23369
- basePath: BASE_PATH.INVOICE,
23370
- listOperation: listInvoicesOperation,
23371
- errorLogContext: "GET /Invoice list error:"
23372
- });
23373
- }
23374
-
23375
25090
  // src/data/operations/data/invoice/invoice-update-operation.ts
23376
25091
  async function updateInvoiceOperation(params) {
23377
25092
  const { context, id, body, tableName } = params;
@@ -24162,15 +25877,111 @@ async function listLocationsOperation(params) {
24162
25877
  }
24163
25878
 
24164
25879
  // src/data/rest-api/routes/data/location/location-list-route.ts
24165
- async function listLocationsRoute(req, res) {
24166
- return handleListRoute({
24167
- req,
24168
- res,
24169
- basePath: BASE_PATH.LOCATION,
24170
- listOperation: listLocationsOperation,
24171
- errorLogContext: "GET /Location list error:"
25880
+ var LOCATION_RESOURCE_TYPE = "Location";
25881
+ function stripModifier18(key) {
25882
+ const idx = key.indexOf(":");
25883
+ return idx === -1 ? key : key.slice(0, idx);
25884
+ }
25885
+ function isResultParameter18(key) {
25886
+ return key.startsWith("_");
25887
+ }
25888
+ function sendInvalidSearch40018(res, diagnostics) {
25889
+ return res.status(400).json({
25890
+ resourceType: "OperationOutcome",
25891
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
24172
25892
  });
24173
25893
  }
25894
+ function extractSearchParamKeys18(query) {
25895
+ const out = [];
25896
+ for (const rawKey of Object.keys(query)) {
25897
+ if (isResultParameter18(rawKey)) {
25898
+ continue;
25899
+ }
25900
+ out.push({ rawKey, code: stripModifier18(rawKey) });
25901
+ }
25902
+ return out;
25903
+ }
25904
+ function buildUnknownParamDiagnostics18(unknownCodes) {
25905
+ const validCodes = getRegisteredSearchParameters(LOCATION_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
25906
+ const codes = unknownCodes.join(", ");
25907
+ const isPlural = unknownCodes.length !== 1;
25908
+ return [
25909
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Location: ${codes}.`,
25910
+ `Valid codes: ${validCodes}.`
25911
+ ].join(" ");
25912
+ }
25913
+ function findMalformedReference18(query, searchParamKeys) {
25914
+ const referenceCodes = new Set(
25915
+ getRegisteredSearchParameters(LOCATION_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
25916
+ );
25917
+ if (referenceCodes.size === 0) {
25918
+ return void 0;
25919
+ }
25920
+ for (const { rawKey, code } of searchParamKeys) {
25921
+ if (!referenceCodes.has(code)) {
25922
+ continue;
25923
+ }
25924
+ const raw = query[rawKey];
25925
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
25926
+ for (const v of values) {
25927
+ const trimmed = v.trim();
25928
+ if (trimmed.length === 0) {
25929
+ continue;
25930
+ }
25931
+ if (parseTypedReference(trimmed) === void 0) {
25932
+ return { rawKey, value: trimmed };
25933
+ }
25934
+ }
25935
+ }
25936
+ return void 0;
25937
+ }
25938
+ async function listLocationsRoute(req, res) {
25939
+ const searchParamKeys = extractSearchParamKeys18(
25940
+ req.query
25941
+ );
25942
+ if (searchParamKeys.length === 0) {
25943
+ return handleListRoute({
25944
+ req,
25945
+ res,
25946
+ basePath: BASE_PATH.LOCATION,
25947
+ listOperation: listLocationsOperation,
25948
+ errorLogContext: "GET /Location list error:"
25949
+ });
25950
+ }
25951
+ const registered = getRegisteredSearchParameters(LOCATION_RESOURCE_TYPE);
25952
+ const validCodes = new Set(registered.map((p) => p.code));
25953
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
25954
+ if (unknownCodes.length > 0) {
25955
+ return sendInvalidSearch40018(
25956
+ res,
25957
+ buildUnknownParamDiagnostics18([...new Set(unknownCodes)])
25958
+ );
25959
+ }
25960
+ const malformedRef = findMalformedReference18(
25961
+ req.query,
25962
+ searchParamKeys
25963
+ );
25964
+ if (malformedRef !== void 0) {
25965
+ return sendInvalidSearch40018(
25966
+ res,
25967
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
25968
+ );
25969
+ }
25970
+ const ctx = req.openhiContext;
25971
+ try {
25972
+ const result = await genericSearchOperation({
25973
+ resourceType: LOCATION_RESOURCE_TYPE,
25974
+ tenantId: ctx.tenantId,
25975
+ workspaceId: ctx.workspaceId,
25976
+ query: req.query,
25977
+ resolver: defaultSearchParameterResolver
25978
+ });
25979
+ const bundle = buildSearchsetBundle(BASE_PATH.LOCATION, result.entries);
25980
+ return res.json(bundle);
25981
+ } catch (err) {
25982
+ return sendOperationOutcome500(res, err, "GET /Location search error:");
25983
+ }
25984
+ }
24174
25985
 
24175
25986
  // src/data/operations/data/location/location-update-operation.ts
24176
25987
  async function updateLocationOperation(params) {
@@ -25799,30 +27610,30 @@ async function listMedicationRequestsOperation(params) {
25799
27610
 
25800
27611
  // src/data/rest-api/routes/data/medicationrequest/medicationrequest-list-route.ts
25801
27612
  var MEDICATIONREQUEST_RESOURCE_TYPE = "MedicationRequest";
25802
- function stripModifier7(key) {
27613
+ function stripModifier19(key) {
25803
27614
  const idx = key.indexOf(":");
25804
27615
  return idx === -1 ? key : key.slice(0, idx);
25805
27616
  }
25806
- function isResultParameter7(key) {
27617
+ function isResultParameter19(key) {
25807
27618
  return key.startsWith("_");
25808
27619
  }
25809
- function sendInvalidSearch4007(res, diagnostics) {
27620
+ function sendInvalidSearch40019(res, diagnostics) {
25810
27621
  return res.status(400).json({
25811
27622
  resourceType: "OperationOutcome",
25812
27623
  issue: [{ severity: "error", code: "invalid", diagnostics }]
25813
27624
  });
25814
27625
  }
25815
- function extractSearchParamKeys7(query) {
27626
+ function extractSearchParamKeys19(query) {
25816
27627
  const out = [];
25817
27628
  for (const rawKey of Object.keys(query)) {
25818
- if (isResultParameter7(rawKey)) {
27629
+ if (isResultParameter19(rawKey)) {
25819
27630
  continue;
25820
27631
  }
25821
- out.push({ rawKey, code: stripModifier7(rawKey) });
27632
+ out.push({ rawKey, code: stripModifier19(rawKey) });
25822
27633
  }
25823
27634
  return out;
25824
27635
  }
25825
- function buildUnknownParamDiagnostics7(unknownCodes) {
27636
+ function buildUnknownParamDiagnostics19(unknownCodes) {
25826
27637
  const validCodes = getRegisteredSearchParameters(
25827
27638
  MEDICATIONREQUEST_RESOURCE_TYPE
25828
27639
  ).map((p) => p.code).sort().join(", ");
@@ -25833,7 +27644,7 @@ function buildUnknownParamDiagnostics7(unknownCodes) {
25833
27644
  `Valid codes: ${validCodes}.`
25834
27645
  ].join(" ");
25835
27646
  }
25836
- function findMalformedReference7(query, searchParamKeys) {
27647
+ function findMalformedReference19(query, searchParamKeys) {
25837
27648
  const referenceCodes = new Set(
25838
27649
  getRegisteredSearchParameters(MEDICATIONREQUEST_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
25839
27650
  );
@@ -25856,7 +27667,7 @@ function findMalformedReference7(query, searchParamKeys) {
25856
27667
  return void 0;
25857
27668
  }
25858
27669
  async function listMedicationRequestsRoute(req, res) {
25859
- const searchParamKeys = extractSearchParamKeys7(
27670
+ const searchParamKeys = extractSearchParamKeys19(
25860
27671
  req.query
25861
27672
  );
25862
27673
  if (searchParamKeys.length === 0) {
@@ -25874,17 +27685,17 @@ async function listMedicationRequestsRoute(req, res) {
25874
27685
  const validCodes = new Set(registered.map((p) => p.code));
25875
27686
  const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
25876
27687
  if (unknownCodes.length > 0) {
25877
- return sendInvalidSearch4007(
27688
+ return sendInvalidSearch40019(
25878
27689
  res,
25879
- buildUnknownParamDiagnostics7([...new Set(unknownCodes)])
27690
+ buildUnknownParamDiagnostics19([...new Set(unknownCodes)])
25880
27691
  );
25881
27692
  }
25882
- const malformedRef = findMalformedReference7(
27693
+ const malformedRef = findMalformedReference19(
25883
27694
  req.query,
25884
27695
  searchParamKeys
25885
27696
  );
25886
27697
  if (malformedRef !== void 0) {
25887
- return sendInvalidSearch4007(
27698
+ return sendInvalidSearch40019(
25888
27699
  res,
25889
27700
  `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
25890
27701
  );
@@ -26110,30 +27921,30 @@ async function listMedicationStatementsOperation(params) {
26110
27921
 
26111
27922
  // src/data/rest-api/routes/data/medicationstatement/medicationstatement-list-route.ts
26112
27923
  var MEDICATIONSTATEMENT_RESOURCE_TYPE = "MedicationStatement";
26113
- function stripModifier8(key) {
27924
+ function stripModifier20(key) {
26114
27925
  const idx = key.indexOf(":");
26115
27926
  return idx === -1 ? key : key.slice(0, idx);
26116
27927
  }
26117
- function isResultParameter8(key) {
27928
+ function isResultParameter20(key) {
26118
27929
  return key.startsWith("_");
26119
27930
  }
26120
- function sendInvalidSearch4008(res, diagnostics) {
27931
+ function sendInvalidSearch40020(res, diagnostics) {
26121
27932
  return res.status(400).json({
26122
27933
  resourceType: "OperationOutcome",
26123
27934
  issue: [{ severity: "error", code: "invalid", diagnostics }]
26124
27935
  });
26125
27936
  }
26126
- function extractSearchParamKeys8(query) {
27937
+ function extractSearchParamKeys20(query) {
26127
27938
  const out = [];
26128
27939
  for (const rawKey of Object.keys(query)) {
26129
- if (isResultParameter8(rawKey)) {
27940
+ if (isResultParameter20(rawKey)) {
26130
27941
  continue;
26131
27942
  }
26132
- out.push({ rawKey, code: stripModifier8(rawKey) });
27943
+ out.push({ rawKey, code: stripModifier20(rawKey) });
26133
27944
  }
26134
27945
  return out;
26135
27946
  }
26136
- function buildUnknownParamDiagnostics8(unknownCodes) {
27947
+ function buildUnknownParamDiagnostics20(unknownCodes) {
26137
27948
  const validCodes = getRegisteredSearchParameters(
26138
27949
  MEDICATIONSTATEMENT_RESOURCE_TYPE
26139
27950
  ).map((p) => p.code).sort().join(", ");
@@ -26144,7 +27955,7 @@ function buildUnknownParamDiagnostics8(unknownCodes) {
26144
27955
  `Valid codes: ${validCodes}.`
26145
27956
  ].join(" ");
26146
27957
  }
26147
- function findMalformedReference8(query, searchParamKeys) {
27958
+ function findMalformedReference20(query, searchParamKeys) {
26148
27959
  const referenceCodes = new Set(
26149
27960
  getRegisteredSearchParameters(MEDICATIONSTATEMENT_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
26150
27961
  );
@@ -26167,7 +27978,7 @@ function findMalformedReference8(query, searchParamKeys) {
26167
27978
  return void 0;
26168
27979
  }
26169
27980
  async function listMedicationStatementsRoute(req, res) {
26170
- const searchParamKeys = extractSearchParamKeys8(
27981
+ const searchParamKeys = extractSearchParamKeys20(
26171
27982
  req.query
26172
27983
  );
26173
27984
  if (searchParamKeys.length === 0) {
@@ -26185,17 +27996,17 @@ async function listMedicationStatementsRoute(req, res) {
26185
27996
  const validCodes = new Set(registered.map((p) => p.code));
26186
27997
  const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
26187
27998
  if (unknownCodes.length > 0) {
26188
- return sendInvalidSearch4008(
27999
+ return sendInvalidSearch40020(
26189
28000
  res,
26190
- buildUnknownParamDiagnostics8([...new Set(unknownCodes)])
28001
+ buildUnknownParamDiagnostics20([...new Set(unknownCodes)])
26191
28002
  );
26192
28003
  }
26193
- const malformedRef = findMalformedReference8(
28004
+ const malformedRef = findMalformedReference20(
26194
28005
  req.query,
26195
28006
  searchParamKeys
26196
28007
  );
26197
28008
  if (malformedRef !== void 0) {
26198
- return sendInvalidSearch4008(
28009
+ return sendInvalidSearch40020(
26199
28010
  res,
26200
28011
  `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
26201
28012
  );
@@ -29612,30 +31423,30 @@ async function listObservationsOperation(params) {
29612
31423
 
29613
31424
  // src/data/rest-api/routes/data/observation/observation-list-route.ts
29614
31425
  var OBSERVATION_RESOURCE_TYPE = "Observation";
29615
- function stripModifier9(key) {
31426
+ function stripModifier21(key) {
29616
31427
  const idx = key.indexOf(":");
29617
31428
  return idx === -1 ? key : key.slice(0, idx);
29618
31429
  }
29619
- function isResultParameter9(key) {
31430
+ function isResultParameter21(key) {
29620
31431
  return key.startsWith("_");
29621
31432
  }
29622
- function sendInvalidSearch4009(res, diagnostics) {
31433
+ function sendInvalidSearch40021(res, diagnostics) {
29623
31434
  return res.status(400).json({
29624
31435
  resourceType: "OperationOutcome",
29625
31436
  issue: [{ severity: "error", code: "invalid", diagnostics }]
29626
31437
  });
29627
31438
  }
29628
- function extractSearchParamKeys9(query) {
31439
+ function extractSearchParamKeys21(query) {
29629
31440
  const out = [];
29630
31441
  for (const rawKey of Object.keys(query)) {
29631
- if (isResultParameter9(rawKey)) {
31442
+ if (isResultParameter21(rawKey)) {
29632
31443
  continue;
29633
31444
  }
29634
- out.push({ rawKey, code: stripModifier9(rawKey) });
31445
+ out.push({ rawKey, code: stripModifier21(rawKey) });
29635
31446
  }
29636
31447
  return out;
29637
31448
  }
29638
- function buildUnknownParamDiagnostics9(unknownCodes) {
31449
+ function buildUnknownParamDiagnostics21(unknownCodes) {
29639
31450
  const validCodes = getRegisteredSearchParameters(OBSERVATION_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
29640
31451
  const codes = unknownCodes.join(", ");
29641
31452
  const isPlural = unknownCodes.length !== 1;
@@ -29644,7 +31455,7 @@ function buildUnknownParamDiagnostics9(unknownCodes) {
29644
31455
  `Valid codes: ${validCodes}.`
29645
31456
  ].join(" ");
29646
31457
  }
29647
- function findMalformedReference9(query, searchParamKeys) {
31458
+ function findMalformedReference21(query, searchParamKeys) {
29648
31459
  const referenceCodes = new Set(
29649
31460
  getRegisteredSearchParameters(OBSERVATION_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
29650
31461
  );
@@ -29667,7 +31478,7 @@ function findMalformedReference9(query, searchParamKeys) {
29667
31478
  return void 0;
29668
31479
  }
29669
31480
  async function listObservationsRoute(req, res) {
29670
- const searchParamKeys = extractSearchParamKeys9(
31481
+ const searchParamKeys = extractSearchParamKeys21(
29671
31482
  req.query
29672
31483
  );
29673
31484
  if (searchParamKeys.length === 0) {
@@ -29683,17 +31494,17 @@ async function listObservationsRoute(req, res) {
29683
31494
  const validCodes = new Set(registered.map((p) => p.code));
29684
31495
  const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
29685
31496
  if (unknownCodes.length > 0) {
29686
- return sendInvalidSearch4009(
31497
+ return sendInvalidSearch40021(
29687
31498
  res,
29688
- buildUnknownParamDiagnostics9([...new Set(unknownCodes)])
31499
+ buildUnknownParamDiagnostics21([...new Set(unknownCodes)])
29689
31500
  );
29690
31501
  }
29691
- const malformedRef = findMalformedReference9(
31502
+ const malformedRef = findMalformedReference21(
29692
31503
  req.query,
29693
31504
  searchParamKeys
29694
31505
  );
29695
31506
  if (malformedRef !== void 0) {
29696
- return sendInvalidSearch4009(
31507
+ return sendInvalidSearch40021(
29697
31508
  res,
29698
31509
  `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
29699
31510
  );
@@ -30270,49 +32081,145 @@ async function deleteOrganizationRoute(req, res) {
30270
32081
  } catch (err) {
30271
32082
  return sendOperationOutcome500(res, err, "DELETE Organization error:");
30272
32083
  }
30273
- }
30274
-
30275
- // src/data/rest-api/routes/data/organization/organization-get-by-id-route.ts
30276
- async function getOrganizationByIdRoute(req, res) {
30277
- const id = String(req.params.id);
32084
+ }
32085
+
32086
+ // src/data/rest-api/routes/data/organization/organization-get-by-id-route.ts
32087
+ async function getOrganizationByIdRoute(req, res) {
32088
+ const id = String(req.params.id);
32089
+ const ctx = req.openhiContext;
32090
+ try {
32091
+ const result = await getOrganizationByIdOperation({ context: ctx, id });
32092
+ return res.json(result.resource);
32093
+ } catch (err) {
32094
+ const status = domainErrorToHttpStatus(err);
32095
+ if (status === 404) {
32096
+ const diagnostics = err instanceof NotFoundError ? err.message : `Organization ${id} not found`;
32097
+ return sendOperationOutcome404(res, diagnostics);
32098
+ }
32099
+ return sendOperationOutcome500(res, err, "GET Organization error:");
32100
+ }
32101
+ }
32102
+
32103
+ // src/data/operations/data/organization/organization-list-operation.ts
32104
+ async function listOrganizationsOperation(params) {
32105
+ const { context, tableName, mode } = params;
32106
+ const { tenantId, workspaceId } = context;
32107
+ const service = getDynamoDataService(tableName);
32108
+ return listDataEntitiesByWorkspace(
32109
+ service.entities.organization,
32110
+ tenantId,
32111
+ workspaceId,
32112
+ mode
32113
+ );
32114
+ }
32115
+
32116
+ // src/data/rest-api/routes/data/organization/organization-list-route.ts
32117
+ var ORGANIZATION_RESOURCE_TYPE = "Organization";
32118
+ function stripModifier22(key) {
32119
+ const idx = key.indexOf(":");
32120
+ return idx === -1 ? key : key.slice(0, idx);
32121
+ }
32122
+ function isResultParameter22(key) {
32123
+ return key.startsWith("_");
32124
+ }
32125
+ function sendInvalidSearch40022(res, diagnostics) {
32126
+ return res.status(400).json({
32127
+ resourceType: "OperationOutcome",
32128
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
32129
+ });
32130
+ }
32131
+ function extractSearchParamKeys22(query) {
32132
+ const out = [];
32133
+ for (const rawKey of Object.keys(query)) {
32134
+ if (isResultParameter22(rawKey)) {
32135
+ continue;
32136
+ }
32137
+ out.push({ rawKey, code: stripModifier22(rawKey) });
32138
+ }
32139
+ return out;
32140
+ }
32141
+ function buildUnknownParamDiagnostics22(unknownCodes) {
32142
+ const validCodes = getRegisteredSearchParameters(ORGANIZATION_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
32143
+ const codes = unknownCodes.join(", ");
32144
+ const isPlural = unknownCodes.length !== 1;
32145
+ return [
32146
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Organization: ${codes}.`,
32147
+ `Valid codes: ${validCodes}.`
32148
+ ].join(" ");
32149
+ }
32150
+ function findMalformedReference22(query, searchParamKeys) {
32151
+ const referenceCodes = new Set(
32152
+ getRegisteredSearchParameters(ORGANIZATION_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
32153
+ );
32154
+ if (referenceCodes.size === 0) {
32155
+ return void 0;
32156
+ }
32157
+ for (const { rawKey, code } of searchParamKeys) {
32158
+ if (!referenceCodes.has(code)) {
32159
+ continue;
32160
+ }
32161
+ const raw = query[rawKey];
32162
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
32163
+ for (const v of values) {
32164
+ const trimmed = v.trim();
32165
+ if (trimmed.length === 0) {
32166
+ continue;
32167
+ }
32168
+ if (parseTypedReference(trimmed) === void 0) {
32169
+ return { rawKey, value: trimmed };
32170
+ }
32171
+ }
32172
+ }
32173
+ return void 0;
32174
+ }
32175
+ async function listOrganizationsRoute(req, res) {
32176
+ const searchParamKeys = extractSearchParamKeys22(
32177
+ req.query
32178
+ );
32179
+ if (searchParamKeys.length === 0) {
32180
+ return handleListRoute({
32181
+ req,
32182
+ res,
32183
+ basePath: BASE_PATH.ORGANIZATION,
32184
+ listOperation: listOrganizationsOperation,
32185
+ errorLogContext: "GET /Organization list error:"
32186
+ });
32187
+ }
32188
+ const registered = getRegisteredSearchParameters(ORGANIZATION_RESOURCE_TYPE);
32189
+ const validCodes = new Set(registered.map((p) => p.code));
32190
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
32191
+ if (unknownCodes.length > 0) {
32192
+ return sendInvalidSearch40022(
32193
+ res,
32194
+ buildUnknownParamDiagnostics22([...new Set(unknownCodes)])
32195
+ );
32196
+ }
32197
+ const malformedRef = findMalformedReference22(
32198
+ req.query,
32199
+ searchParamKeys
32200
+ );
32201
+ if (malformedRef !== void 0) {
32202
+ return sendInvalidSearch40022(
32203
+ res,
32204
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
32205
+ );
32206
+ }
30278
32207
  const ctx = req.openhiContext;
30279
32208
  try {
30280
- const result = await getOrganizationByIdOperation({ context: ctx, id });
30281
- return res.json(result.resource);
32209
+ const result = await genericSearchOperation({
32210
+ resourceType: ORGANIZATION_RESOURCE_TYPE,
32211
+ tenantId: ctx.tenantId,
32212
+ workspaceId: ctx.workspaceId,
32213
+ query: req.query,
32214
+ resolver: defaultSearchParameterResolver
32215
+ });
32216
+ const bundle = buildSearchsetBundle(BASE_PATH.ORGANIZATION, result.entries);
32217
+ return res.json(bundle);
30282
32218
  } catch (err) {
30283
- const status = domainErrorToHttpStatus(err);
30284
- if (status === 404) {
30285
- const diagnostics = err instanceof NotFoundError ? err.message : `Organization ${id} not found`;
30286
- return sendOperationOutcome404(res, diagnostics);
30287
- }
30288
- return sendOperationOutcome500(res, err, "GET Organization error:");
32219
+ return sendOperationOutcome500(res, err, "GET /Organization search error:");
30289
32220
  }
30290
32221
  }
30291
32222
 
30292
- // src/data/operations/data/organization/organization-list-operation.ts
30293
- async function listOrganizationsOperation(params) {
30294
- const { context, tableName, mode } = params;
30295
- const { tenantId, workspaceId } = context;
30296
- const service = getDynamoDataService(tableName);
30297
- return listDataEntitiesByWorkspace(
30298
- service.entities.organization,
30299
- tenantId,
30300
- workspaceId,
30301
- mode
30302
- );
30303
- }
30304
-
30305
- // src/data/rest-api/routes/data/organization/organization-list-route.ts
30306
- async function listOrganizationsRoute(req, res) {
30307
- return handleListRoute({
30308
- req,
30309
- res,
30310
- basePath: BASE_PATH.ORGANIZATION,
30311
- listOperation: listOrganizationsOperation,
30312
- errorLogContext: "GET /Organization list error:"
30313
- });
30314
- }
30315
-
30316
32223
  // src/data/operations/data/organization/organization-update-operation.ts
30317
32224
  async function updateOrganizationOperation(params) {
30318
32225
  const { context, id, body, tableName } = params;
@@ -30723,30 +32630,30 @@ async function listPatientsOperation(params) {
30723
32630
 
30724
32631
  // src/data/rest-api/routes/data/patient/patient-list-route.ts
30725
32632
  var PATIENT_RESOURCE_TYPE = "Patient";
30726
- function stripModifier10(key) {
32633
+ function stripModifier23(key) {
30727
32634
  const idx = key.indexOf(":");
30728
32635
  return idx === -1 ? key : key.slice(0, idx);
30729
32636
  }
30730
- function isResultParameter10(key) {
32637
+ function isResultParameter23(key) {
30731
32638
  return key.startsWith("_");
30732
32639
  }
30733
- function sendInvalidSearch40010(res, diagnostics) {
32640
+ function sendInvalidSearch40023(res, diagnostics) {
30734
32641
  return res.status(400).json({
30735
32642
  resourceType: "OperationOutcome",
30736
32643
  issue: [{ severity: "error", code: "invalid", diagnostics }]
30737
32644
  });
30738
32645
  }
30739
- function extractSearchParamKeys10(query) {
32646
+ function extractSearchParamKeys23(query) {
30740
32647
  const out = [];
30741
32648
  for (const rawKey of Object.keys(query)) {
30742
- if (isResultParameter10(rawKey)) {
32649
+ if (isResultParameter23(rawKey)) {
30743
32650
  continue;
30744
32651
  }
30745
- out.push({ rawKey, code: stripModifier10(rawKey) });
32652
+ out.push({ rawKey, code: stripModifier23(rawKey) });
30746
32653
  }
30747
32654
  return out;
30748
32655
  }
30749
- function buildUnknownParamDiagnostics10(unknownCodes) {
32656
+ function buildUnknownParamDiagnostics23(unknownCodes) {
30750
32657
  const validCodes = getRegisteredSearchParameters(PATIENT_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
30751
32658
  const codes = unknownCodes.join(", ");
30752
32659
  const isPlural = unknownCodes.length !== 1;
@@ -30755,7 +32662,7 @@ function buildUnknownParamDiagnostics10(unknownCodes) {
30755
32662
  `Valid codes: ${validCodes}.`
30756
32663
  ].join(" ");
30757
32664
  }
30758
- function findMalformedReference10(query, searchParamKeys) {
32665
+ function findMalformedReference23(query, searchParamKeys) {
30759
32666
  const referenceCodes = new Set(
30760
32667
  getRegisteredSearchParameters(PATIENT_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
30761
32668
  );
@@ -30778,7 +32685,7 @@ function findMalformedReference10(query, searchParamKeys) {
30778
32685
  return void 0;
30779
32686
  }
30780
32687
  async function listPatientsRoute(req, res) {
30781
- const searchParamKeys = extractSearchParamKeys10(
32688
+ const searchParamKeys = extractSearchParamKeys23(
30782
32689
  req.query
30783
32690
  );
30784
32691
  if (searchParamKeys.length === 0) {
@@ -30794,17 +32701,17 @@ async function listPatientsRoute(req, res) {
30794
32701
  const validCodes = new Set(registered.map((p) => p.code));
30795
32702
  const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
30796
32703
  if (unknownCodes.length > 0) {
30797
- return sendInvalidSearch40010(
32704
+ return sendInvalidSearch40023(
30798
32705
  res,
30799
- buildUnknownParamDiagnostics10([...new Set(unknownCodes)])
32706
+ buildUnknownParamDiagnostics23([...new Set(unknownCodes)])
30800
32707
  );
30801
32708
  }
30802
- const malformedRef = findMalformedReference10(
32709
+ const malformedRef = findMalformedReference23(
30803
32710
  req.query,
30804
32711
  searchParamKeys
30805
32712
  );
30806
32713
  if (malformedRef !== void 0) {
30807
- return sendInvalidSearch40010(
32714
+ return sendInvalidSearch40023(
30808
32715
  res,
30809
32716
  `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
30810
32717
  );
@@ -31015,15 +32922,118 @@ async function listPaymentNoticesOperation(params) {
31015
32922
  }
31016
32923
 
31017
32924
  // src/data/rest-api/routes/data/paymentnotice/paymentnotice-list-route.ts
31018
- async function listPaymentNoticesRoute(req, res) {
31019
- return handleListRoute({
31020
- req,
31021
- res,
31022
- basePath: BASE_PATH.PAYMENTNOTICE,
31023
- listOperation: listPaymentNoticesOperation,
31024
- errorLogContext: "GET /PaymentNotice list error:"
32925
+ var PAYMENTNOTICE_RESOURCE_TYPE = "PaymentNotice";
32926
+ function stripModifier24(key) {
32927
+ const idx = key.indexOf(":");
32928
+ return idx === -1 ? key : key.slice(0, idx);
32929
+ }
32930
+ function isResultParameter24(key) {
32931
+ return key.startsWith("_");
32932
+ }
32933
+ function sendInvalidSearch40024(res, diagnostics) {
32934
+ return res.status(400).json({
32935
+ resourceType: "OperationOutcome",
32936
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
31025
32937
  });
31026
32938
  }
32939
+ function extractSearchParamKeys24(query) {
32940
+ const out = [];
32941
+ for (const rawKey of Object.keys(query)) {
32942
+ if (isResultParameter24(rawKey)) {
32943
+ continue;
32944
+ }
32945
+ out.push({ rawKey, code: stripModifier24(rawKey) });
32946
+ }
32947
+ return out;
32948
+ }
32949
+ function buildUnknownParamDiagnostics24(unknownCodes) {
32950
+ const validCodes = getRegisteredSearchParameters(PAYMENTNOTICE_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
32951
+ const codes = unknownCodes.join(", ");
32952
+ const isPlural = unknownCodes.length !== 1;
32953
+ return [
32954
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for PaymentNotice: ${codes}.`,
32955
+ `Valid codes: ${validCodes}.`
32956
+ ].join(" ");
32957
+ }
32958
+ function findMalformedReference24(query, searchParamKeys) {
32959
+ const referenceCodes = new Set(
32960
+ getRegisteredSearchParameters(PAYMENTNOTICE_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
32961
+ );
32962
+ if (referenceCodes.size === 0) {
32963
+ return void 0;
32964
+ }
32965
+ for (const { rawKey, code } of searchParamKeys) {
32966
+ if (!referenceCodes.has(code)) {
32967
+ continue;
32968
+ }
32969
+ const raw = query[rawKey];
32970
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
32971
+ for (const v of values) {
32972
+ const trimmed = v.trim();
32973
+ if (trimmed.length === 0) {
32974
+ continue;
32975
+ }
32976
+ if (parseTypedReference(trimmed) === void 0) {
32977
+ return { rawKey, value: trimmed };
32978
+ }
32979
+ }
32980
+ }
32981
+ return void 0;
32982
+ }
32983
+ async function listPaymentNoticesRoute(req, res) {
32984
+ const searchParamKeys = extractSearchParamKeys24(
32985
+ req.query
32986
+ );
32987
+ if (searchParamKeys.length === 0) {
32988
+ return handleListRoute({
32989
+ req,
32990
+ res,
32991
+ basePath: BASE_PATH.PAYMENTNOTICE,
32992
+ listOperation: listPaymentNoticesOperation,
32993
+ errorLogContext: "GET /PaymentNotice list error:"
32994
+ });
32995
+ }
32996
+ const registered = getRegisteredSearchParameters(PAYMENTNOTICE_RESOURCE_TYPE);
32997
+ const validCodes = new Set(registered.map((p) => p.code));
32998
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
32999
+ if (unknownCodes.length > 0) {
33000
+ return sendInvalidSearch40024(
33001
+ res,
33002
+ buildUnknownParamDiagnostics24([...new Set(unknownCodes)])
33003
+ );
33004
+ }
33005
+ const malformedRef = findMalformedReference24(
33006
+ req.query,
33007
+ searchParamKeys
33008
+ );
33009
+ if (malformedRef !== void 0) {
33010
+ return sendInvalidSearch40024(
33011
+ res,
33012
+ `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
33013
+ );
33014
+ }
33015
+ const ctx = req.openhiContext;
33016
+ try {
33017
+ const result = await genericSearchOperation({
33018
+ resourceType: PAYMENTNOTICE_RESOURCE_TYPE,
33019
+ tenantId: ctx.tenantId,
33020
+ workspaceId: ctx.workspaceId,
33021
+ query: req.query,
33022
+ resolver: defaultSearchParameterResolver
33023
+ });
33024
+ const bundle = buildSearchsetBundle(
33025
+ BASE_PATH.PAYMENTNOTICE,
33026
+ result.entries
33027
+ );
33028
+ return res.json(bundle);
33029
+ } catch (err) {
33030
+ return sendOperationOutcome500(
33031
+ res,
33032
+ err,
33033
+ "GET /PaymentNotice search error:"
33034
+ );
33035
+ }
33036
+ }
31027
33037
 
31028
33038
  // src/data/operations/data/paymentnotice/paymentnotice-update-operation.ts
31029
33039
  async function updatePaymentNoticeOperation(params) {
@@ -31787,63 +33797,159 @@ async function deletePractitionerRoute(req, res) {
31787
33797
  } catch (err) {
31788
33798
  return sendOperationOutcome500(res, err, "DELETE Practitioner error:");
31789
33799
  }
31790
- }
31791
-
31792
- // src/data/operations/data/practitioner/practitioner-get-by-id-operation.ts
31793
- async function getPractitionerByIdOperation(params) {
31794
- const { context, id, tableName } = params;
31795
- const { tenantId, workspaceId } = context;
31796
- const service = getDynamoDataService(tableName);
31797
- return getDataEntityById(
31798
- service.entities.practitioner,
31799
- tenantId,
31800
- workspaceId,
31801
- id,
31802
- "Practitioner"
33800
+ }
33801
+
33802
+ // src/data/operations/data/practitioner/practitioner-get-by-id-operation.ts
33803
+ async function getPractitionerByIdOperation(params) {
33804
+ const { context, id, tableName } = params;
33805
+ const { tenantId, workspaceId } = context;
33806
+ const service = getDynamoDataService(tableName);
33807
+ return getDataEntityById(
33808
+ service.entities.practitioner,
33809
+ tenantId,
33810
+ workspaceId,
33811
+ id,
33812
+ "Practitioner"
33813
+ );
33814
+ }
33815
+
33816
+ // src/data/rest-api/routes/data/practitioner/practitioner-get-by-id-route.ts
33817
+ async function getPractitionerByIdRoute(req, res) {
33818
+ const id = String(req.params.id);
33819
+ const ctx = req.openhiContext;
33820
+ try {
33821
+ const result = await getPractitionerByIdOperation({ context: ctx, id });
33822
+ return res.json(result.resource);
33823
+ } catch (err) {
33824
+ const status = domainErrorToHttpStatus(err);
33825
+ if (status === 404) {
33826
+ const diagnostics = err instanceof NotFoundError ? err.message : `Practitioner ${id} not found`;
33827
+ return sendOperationOutcome404(res, diagnostics);
33828
+ }
33829
+ return sendOperationOutcome500(res, err, "GET Practitioner error:");
33830
+ }
33831
+ }
33832
+
33833
+ // src/data/operations/data/practitioner/practitioner-list-operation.ts
33834
+ async function listPractitionersOperation(params) {
33835
+ const { context, tableName, mode } = params;
33836
+ const { tenantId, workspaceId } = context;
33837
+ const service = getDynamoDataService(tableName);
33838
+ return listDataEntitiesByWorkspace(
33839
+ service.entities.practitioner,
33840
+ tenantId,
33841
+ workspaceId,
33842
+ mode
33843
+ );
33844
+ }
33845
+
33846
+ // src/data/rest-api/routes/data/practitioner/practitioner-list-route.ts
33847
+ var PRACTITIONER_RESOURCE_TYPE = "Practitioner";
33848
+ function stripModifier25(key) {
33849
+ const idx = key.indexOf(":");
33850
+ return idx === -1 ? key : key.slice(0, idx);
33851
+ }
33852
+ function isResultParameter25(key) {
33853
+ return key.startsWith("_");
33854
+ }
33855
+ function sendInvalidSearch40025(res, diagnostics) {
33856
+ return res.status(400).json({
33857
+ resourceType: "OperationOutcome",
33858
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
33859
+ });
33860
+ }
33861
+ function extractSearchParamKeys25(query) {
33862
+ const out = [];
33863
+ for (const rawKey of Object.keys(query)) {
33864
+ if (isResultParameter25(rawKey)) {
33865
+ continue;
33866
+ }
33867
+ out.push({ rawKey, code: stripModifier25(rawKey) });
33868
+ }
33869
+ return out;
33870
+ }
33871
+ function buildUnknownParamDiagnostics25(unknownCodes) {
33872
+ const validCodes = getRegisteredSearchParameters(PRACTITIONER_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
33873
+ const codes = unknownCodes.join(", ");
33874
+ const isPlural = unknownCodes.length !== 1;
33875
+ return [
33876
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Practitioner: ${codes}.`,
33877
+ `Valid codes: ${validCodes}.`
33878
+ ].join(" ");
33879
+ }
33880
+ function findMalformedReference25(query, searchParamKeys) {
33881
+ const referenceCodes = new Set(
33882
+ getRegisteredSearchParameters(PRACTITIONER_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
33883
+ );
33884
+ if (referenceCodes.size === 0) {
33885
+ return void 0;
33886
+ }
33887
+ for (const { rawKey, code } of searchParamKeys) {
33888
+ if (!referenceCodes.has(code)) {
33889
+ continue;
33890
+ }
33891
+ const raw = query[rawKey];
33892
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
33893
+ for (const v of values) {
33894
+ const trimmed = v.trim();
33895
+ if (trimmed.length === 0) {
33896
+ continue;
33897
+ }
33898
+ if (parseTypedReference(trimmed) === void 0) {
33899
+ return { rawKey, value: trimmed };
33900
+ }
33901
+ }
33902
+ }
33903
+ return void 0;
33904
+ }
33905
+ async function listPractitionersRoute(req, res) {
33906
+ const searchParamKeys = extractSearchParamKeys25(
33907
+ req.query
33908
+ );
33909
+ if (searchParamKeys.length === 0) {
33910
+ return handleListRoute({
33911
+ req,
33912
+ res,
33913
+ basePath: BASE_PATH.PRACTITIONER,
33914
+ listOperation: listPractitionersOperation,
33915
+ errorLogContext: "GET /Practitioner list error:"
33916
+ });
33917
+ }
33918
+ const registered = getRegisteredSearchParameters(PRACTITIONER_RESOURCE_TYPE);
33919
+ const validCodes = new Set(registered.map((p) => p.code));
33920
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
33921
+ if (unknownCodes.length > 0) {
33922
+ return sendInvalidSearch40025(
33923
+ res,
33924
+ buildUnknownParamDiagnostics25([...new Set(unknownCodes)])
33925
+ );
33926
+ }
33927
+ const malformedRef = findMalformedReference25(
33928
+ req.query,
33929
+ searchParamKeys
31803
33930
  );
31804
- }
31805
-
31806
- // src/data/rest-api/routes/data/practitioner/practitioner-get-by-id-route.ts
31807
- async function getPractitionerByIdRoute(req, res) {
31808
- const id = String(req.params.id);
33931
+ if (malformedRef !== void 0) {
33932
+ return sendInvalidSearch40025(
33933
+ res,
33934
+ `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
33935
+ );
33936
+ }
31809
33937
  const ctx = req.openhiContext;
31810
33938
  try {
31811
- const result = await getPractitionerByIdOperation({ context: ctx, id });
31812
- return res.json(result.resource);
33939
+ const result = await genericSearchOperation({
33940
+ resourceType: PRACTITIONER_RESOURCE_TYPE,
33941
+ tenantId: ctx.tenantId,
33942
+ workspaceId: ctx.workspaceId,
33943
+ query: req.query,
33944
+ resolver: defaultSearchParameterResolver
33945
+ });
33946
+ const bundle = buildSearchsetBundle(BASE_PATH.PRACTITIONER, result.entries);
33947
+ return res.json(bundle);
31813
33948
  } catch (err) {
31814
- const status = domainErrorToHttpStatus(err);
31815
- if (status === 404) {
31816
- const diagnostics = err instanceof NotFoundError ? err.message : `Practitioner ${id} not found`;
31817
- return sendOperationOutcome404(res, diagnostics);
31818
- }
31819
- return sendOperationOutcome500(res, err, "GET Practitioner error:");
33949
+ return sendOperationOutcome500(res, err, "GET /Practitioner search error:");
31820
33950
  }
31821
33951
  }
31822
33952
 
31823
- // src/data/operations/data/practitioner/practitioner-list-operation.ts
31824
- async function listPractitionersOperation(params) {
31825
- const { context, tableName, mode } = params;
31826
- const { tenantId, workspaceId } = context;
31827
- const service = getDynamoDataService(tableName);
31828
- return listDataEntitiesByWorkspace(
31829
- service.entities.practitioner,
31830
- tenantId,
31831
- workspaceId,
31832
- mode
31833
- );
31834
- }
31835
-
31836
- // src/data/rest-api/routes/data/practitioner/practitioner-list-route.ts
31837
- async function listPractitionersRoute(req, res) {
31838
- return handleListRoute({
31839
- req,
31840
- res,
31841
- basePath: BASE_PATH.PRACTITIONER,
31842
- listOperation: listPractitionersOperation,
31843
- errorLogContext: "GET /Practitioner list error:"
31844
- });
31845
- }
31846
-
31847
33953
  // src/data/operations/data/practitioner/practitioner-update-operation.ts
31848
33954
  async function updatePractitionerOperation(params) {
31849
33955
  const { context, id, body, tableName } = params;
@@ -31978,15 +34084,119 @@ async function getPractitionerRoleByIdRoute(req, res) {
31978
34084
  }
31979
34085
 
31980
34086
  // src/data/rest-api/routes/data/practitionerrole/practitionerrole-list-route.ts
31981
- async function listPractitionerRolesRoute(req, res) {
31982
- return handleListRoute({
31983
- req,
31984
- res,
31985
- basePath: BASE_PATH.PRACTITIONERROLE,
31986
- listOperation: listPractitionerRolesOperation,
31987
- errorLogContext: "GET /PractitionerRole list error:"
34087
+ var PRACTITIONERROLE_RESOURCE_TYPE = "PractitionerRole";
34088
+ function stripModifier26(key) {
34089
+ const idx = key.indexOf(":");
34090
+ return idx === -1 ? key : key.slice(0, idx);
34091
+ }
34092
+ function isResultParameter26(key) {
34093
+ return key.startsWith("_");
34094
+ }
34095
+ function sendInvalidSearch40026(res, diagnostics) {
34096
+ return res.status(400).json({
34097
+ resourceType: "OperationOutcome",
34098
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
31988
34099
  });
31989
34100
  }
34101
+ function extractSearchParamKeys26(query) {
34102
+ const out = [];
34103
+ for (const rawKey of Object.keys(query)) {
34104
+ if (isResultParameter26(rawKey)) {
34105
+ continue;
34106
+ }
34107
+ out.push({ rawKey, code: stripModifier26(rawKey) });
34108
+ }
34109
+ return out;
34110
+ }
34111
+ function buildUnknownParamDiagnostics26(unknownCodes) {
34112
+ const validCodes = getRegisteredSearchParameters(
34113
+ PRACTITIONERROLE_RESOURCE_TYPE
34114
+ ).map((p) => p.code).sort().join(", ");
34115
+ const codes = unknownCodes.join(", ");
34116
+ const isPlural = unknownCodes.length !== 1;
34117
+ return [
34118
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for PractitionerRole: ${codes}.`,
34119
+ `Valid codes: ${validCodes}.`
34120
+ ].join(" ");
34121
+ }
34122
+ function findMalformedReference26(query, searchParamKeys) {
34123
+ const referenceCodes = new Set(
34124
+ getRegisteredSearchParameters(PRACTITIONERROLE_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
34125
+ );
34126
+ for (const { rawKey, code } of searchParamKeys) {
34127
+ if (!referenceCodes.has(code)) {
34128
+ continue;
34129
+ }
34130
+ const raw = query[rawKey];
34131
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
34132
+ for (const v of values) {
34133
+ const trimmed = v.trim();
34134
+ if (trimmed.length === 0) {
34135
+ continue;
34136
+ }
34137
+ if (parseTypedReference(trimmed) === void 0) {
34138
+ return { rawKey, value: trimmed };
34139
+ }
34140
+ }
34141
+ }
34142
+ return void 0;
34143
+ }
34144
+ async function listPractitionerRolesRoute(req, res) {
34145
+ const searchParamKeys = extractSearchParamKeys26(
34146
+ req.query
34147
+ );
34148
+ if (searchParamKeys.length === 0) {
34149
+ return handleListRoute({
34150
+ req,
34151
+ res,
34152
+ basePath: BASE_PATH.PRACTITIONERROLE,
34153
+ listOperation: listPractitionerRolesOperation,
34154
+ errorLogContext: "GET /PractitionerRole list error:"
34155
+ });
34156
+ }
34157
+ const registered = getRegisteredSearchParameters(
34158
+ PRACTITIONERROLE_RESOURCE_TYPE
34159
+ );
34160
+ const validCodes = new Set(registered.map((p) => p.code));
34161
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
34162
+ if (unknownCodes.length > 0) {
34163
+ return sendInvalidSearch40026(
34164
+ res,
34165
+ buildUnknownParamDiagnostics26([...new Set(unknownCodes)])
34166
+ );
34167
+ }
34168
+ const malformedRef = findMalformedReference26(
34169
+ req.query,
34170
+ searchParamKeys
34171
+ );
34172
+ if (malformedRef !== void 0) {
34173
+ return sendInvalidSearch40026(
34174
+ res,
34175
+ `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
34176
+ );
34177
+ }
34178
+ const ctx = req.openhiContext;
34179
+ try {
34180
+ const result = await genericSearchOperation({
34181
+ resourceType: PRACTITIONERROLE_RESOURCE_TYPE,
34182
+ tenantId: ctx.tenantId,
34183
+ workspaceId: ctx.workspaceId,
34184
+ query: req.query,
34185
+ resolver: defaultSearchParameterResolver
34186
+ });
34187
+ const bundle = buildSearchsetBundle(
34188
+ BASE_PATH.PRACTITIONERROLE,
34189
+ result.entries
34190
+ );
34191
+ return res.json(bundle);
34192
+ } catch (err) {
34193
+ return sendOperationOutcome500(
34194
+ res,
34195
+ err,
34196
+ "GET /PractitionerRole search error:"
34197
+ );
34198
+ }
34199
+ }
31990
34200
 
31991
34201
  // src/data/operations/data/practitionerrole/practitionerrole-update-operation.ts
31992
34202
  async function updatePractitionerRoleOperation(params) {
@@ -32179,30 +34389,30 @@ async function listProceduresOperation(params) {
32179
34389
 
32180
34390
  // src/data/rest-api/routes/data/procedure/procedure-list-route.ts
32181
34391
  var PROCEDURE_RESOURCE_TYPE = "Procedure";
32182
- function stripModifier11(key) {
34392
+ function stripModifier27(key) {
32183
34393
  const idx = key.indexOf(":");
32184
34394
  return idx === -1 ? key : key.slice(0, idx);
32185
34395
  }
32186
- function isResultParameter11(key) {
34396
+ function isResultParameter27(key) {
32187
34397
  return key.startsWith("_");
32188
34398
  }
32189
- function sendInvalidSearch40011(res, diagnostics) {
34399
+ function sendInvalidSearch40027(res, diagnostics) {
32190
34400
  return res.status(400).json({
32191
34401
  resourceType: "OperationOutcome",
32192
34402
  issue: [{ severity: "error", code: "invalid", diagnostics }]
32193
34403
  });
32194
34404
  }
32195
- function extractSearchParamKeys11(query) {
34405
+ function extractSearchParamKeys27(query) {
32196
34406
  const out = [];
32197
34407
  for (const rawKey of Object.keys(query)) {
32198
- if (isResultParameter11(rawKey)) {
34408
+ if (isResultParameter27(rawKey)) {
32199
34409
  continue;
32200
34410
  }
32201
- out.push({ rawKey, code: stripModifier11(rawKey) });
34411
+ out.push({ rawKey, code: stripModifier27(rawKey) });
32202
34412
  }
32203
34413
  return out;
32204
34414
  }
32205
- function buildUnknownParamDiagnostics11(unknownCodes) {
34415
+ function buildUnknownParamDiagnostics27(unknownCodes) {
32206
34416
  const validCodes = getRegisteredSearchParameters(PROCEDURE_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
32207
34417
  const codes = unknownCodes.join(", ");
32208
34418
  const isPlural = unknownCodes.length !== 1;
@@ -32211,7 +34421,7 @@ function buildUnknownParamDiagnostics11(unknownCodes) {
32211
34421
  `Valid codes: ${validCodes}.`
32212
34422
  ].join(" ");
32213
34423
  }
32214
- function findMalformedReference11(query, searchParamKeys) {
34424
+ function findMalformedReference27(query, searchParamKeys) {
32215
34425
  const referenceCodes = new Set(
32216
34426
  getRegisteredSearchParameters(PROCEDURE_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
32217
34427
  );
@@ -32234,7 +34444,7 @@ function findMalformedReference11(query, searchParamKeys) {
32234
34444
  return void 0;
32235
34445
  }
32236
34446
  async function listProceduresRoute(req, res) {
32237
- const searchParamKeys = extractSearchParamKeys11(
34447
+ const searchParamKeys = extractSearchParamKeys27(
32238
34448
  req.query
32239
34449
  );
32240
34450
  if (searchParamKeys.length === 0) {
@@ -32250,17 +34460,17 @@ async function listProceduresRoute(req, res) {
32250
34460
  const validCodes = new Set(registered.map((p) => p.code));
32251
34461
  const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
32252
34462
  if (unknownCodes.length > 0) {
32253
- return sendInvalidSearch40011(
34463
+ return sendInvalidSearch40027(
32254
34464
  res,
32255
- buildUnknownParamDiagnostics11([...new Set(unknownCodes)])
34465
+ buildUnknownParamDiagnostics27([...new Set(unknownCodes)])
32256
34466
  );
32257
34467
  }
32258
- const malformedRef = findMalformedReference11(
34468
+ const malformedRef = findMalformedReference27(
32259
34469
  req.query,
32260
34470
  searchParamKeys
32261
34471
  );
32262
34472
  if (malformedRef !== void 0) {
32263
- return sendInvalidSearch40011(
34473
+ return sendInvalidSearch40027(
32264
34474
  res,
32265
34475
  `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
32266
34476
  );
@@ -33057,49 +35267,149 @@ async function getRelatedPersonByIdOperation(params) {
33057
35267
  id,
33058
35268
  "RelatedPerson"
33059
35269
  );
33060
- }
33061
-
33062
- // src/data/rest-api/routes/data/relatedperson/relatedperson-get-by-id-route.ts
33063
- async function getRelatedPersonByIdRoute(req, res) {
33064
- const id = String(req.params.id);
35270
+ }
35271
+
35272
+ // src/data/rest-api/routes/data/relatedperson/relatedperson-get-by-id-route.ts
35273
+ async function getRelatedPersonByIdRoute(req, res) {
35274
+ const id = String(req.params.id);
35275
+ const ctx = req.openhiContext;
35276
+ try {
35277
+ const result = await getRelatedPersonByIdOperation({ context: ctx, id });
35278
+ return res.json(result.resource);
35279
+ } catch (err) {
35280
+ const status = domainErrorToHttpStatus(err);
35281
+ if (status === 404) {
35282
+ const diagnostics = err instanceof NotFoundError ? err.message : `RelatedPerson ${id} not found`;
35283
+ return sendOperationOutcome404(res, diagnostics);
35284
+ }
35285
+ return sendOperationOutcome500(res, err, "GET RelatedPerson error:");
35286
+ }
35287
+ }
35288
+
35289
+ // src/data/operations/data/relatedperson/relatedperson-list-operation.ts
35290
+ async function listRelatedPersonsOperation(params) {
35291
+ const { context, tableName, mode } = params;
35292
+ const { tenantId, workspaceId } = context;
35293
+ const service = getDynamoDataService(tableName);
35294
+ return listDataEntitiesByWorkspace(
35295
+ service.entities.relatedperson,
35296
+ tenantId,
35297
+ workspaceId,
35298
+ mode
35299
+ );
35300
+ }
35301
+
35302
+ // src/data/rest-api/routes/data/relatedperson/relatedperson-list-route.ts
35303
+ var RELATEDPERSON_RESOURCE_TYPE = "RelatedPerson";
35304
+ function stripModifier28(key) {
35305
+ const idx = key.indexOf(":");
35306
+ return idx === -1 ? key : key.slice(0, idx);
35307
+ }
35308
+ function isResultParameter28(key) {
35309
+ return key.startsWith("_");
35310
+ }
35311
+ function sendInvalidSearch40028(res, diagnostics) {
35312
+ return res.status(400).json({
35313
+ resourceType: "OperationOutcome",
35314
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
35315
+ });
35316
+ }
35317
+ function extractSearchParamKeys28(query) {
35318
+ const out = [];
35319
+ for (const rawKey of Object.keys(query)) {
35320
+ if (isResultParameter28(rawKey)) {
35321
+ continue;
35322
+ }
35323
+ out.push({ rawKey, code: stripModifier28(rawKey) });
35324
+ }
35325
+ return out;
35326
+ }
35327
+ function buildUnknownParamDiagnostics28(unknownCodes) {
35328
+ const validCodes = getRegisteredSearchParameters(RELATEDPERSON_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
35329
+ const codes = unknownCodes.join(", ");
35330
+ const isPlural = unknownCodes.length !== 1;
35331
+ return [
35332
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for RelatedPerson: ${codes}.`,
35333
+ `Valid codes: ${validCodes}.`
35334
+ ].join(" ");
35335
+ }
35336
+ function findMalformedReference28(query, searchParamKeys) {
35337
+ const referenceCodes = new Set(
35338
+ getRegisteredSearchParameters(RELATEDPERSON_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
35339
+ );
35340
+ for (const { rawKey, code } of searchParamKeys) {
35341
+ if (!referenceCodes.has(code)) {
35342
+ continue;
35343
+ }
35344
+ const raw = query[rawKey];
35345
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
35346
+ for (const v of values) {
35347
+ const trimmed = v.trim();
35348
+ if (trimmed.length === 0) {
35349
+ continue;
35350
+ }
35351
+ if (parseTypedReference(trimmed) === void 0) {
35352
+ return { rawKey, value: trimmed };
35353
+ }
35354
+ }
35355
+ }
35356
+ return void 0;
35357
+ }
35358
+ async function listRelatedPersonsRoute(req, res) {
35359
+ const searchParamKeys = extractSearchParamKeys28(
35360
+ req.query
35361
+ );
35362
+ if (searchParamKeys.length === 0) {
35363
+ return handleListRoute({
35364
+ req,
35365
+ res,
35366
+ basePath: BASE_PATH.RELATEDPERSON,
35367
+ listOperation: listRelatedPersonsOperation,
35368
+ errorLogContext: "GET /RelatedPerson list error:"
35369
+ });
35370
+ }
35371
+ const registered = getRegisteredSearchParameters(RELATEDPERSON_RESOURCE_TYPE);
35372
+ const validCodes = new Set(registered.map((p) => p.code));
35373
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
35374
+ if (unknownCodes.length > 0) {
35375
+ return sendInvalidSearch40028(
35376
+ res,
35377
+ buildUnknownParamDiagnostics28([...new Set(unknownCodes)])
35378
+ );
35379
+ }
35380
+ const malformedRef = findMalformedReference28(
35381
+ req.query,
35382
+ searchParamKeys
35383
+ );
35384
+ if (malformedRef !== void 0) {
35385
+ return sendInvalidSearch40028(
35386
+ res,
35387
+ `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
35388
+ );
35389
+ }
33065
35390
  const ctx = req.openhiContext;
33066
35391
  try {
33067
- const result = await getRelatedPersonByIdOperation({ context: ctx, id });
33068
- return res.json(result.resource);
35392
+ const result = await genericSearchOperation({
35393
+ resourceType: RELATEDPERSON_RESOURCE_TYPE,
35394
+ tenantId: ctx.tenantId,
35395
+ workspaceId: ctx.workspaceId,
35396
+ query: req.query,
35397
+ resolver: defaultSearchParameterResolver
35398
+ });
35399
+ const bundle = buildSearchsetBundle(
35400
+ BASE_PATH.RELATEDPERSON,
35401
+ result.entries
35402
+ );
35403
+ return res.json(bundle);
33069
35404
  } catch (err) {
33070
- const status = domainErrorToHttpStatus(err);
33071
- if (status === 404) {
33072
- const diagnostics = err instanceof NotFoundError ? err.message : `RelatedPerson ${id} not found`;
33073
- return sendOperationOutcome404(res, diagnostics);
33074
- }
33075
- return sendOperationOutcome500(res, err, "GET RelatedPerson error:");
35405
+ return sendOperationOutcome500(
35406
+ res,
35407
+ err,
35408
+ "GET /RelatedPerson search error:"
35409
+ );
33076
35410
  }
33077
35411
  }
33078
35412
 
33079
- // src/data/operations/data/relatedperson/relatedperson-list-operation.ts
33080
- async function listRelatedPersonsOperation(params) {
33081
- const { context, tableName, mode } = params;
33082
- const { tenantId, workspaceId } = context;
33083
- const service = getDynamoDataService(tableName);
33084
- return listDataEntitiesByWorkspace(
33085
- service.entities.relatedperson,
33086
- tenantId,
33087
- workspaceId,
33088
- mode
33089
- );
33090
- }
33091
-
33092
- // src/data/rest-api/routes/data/relatedperson/relatedperson-list-route.ts
33093
- async function listRelatedPersonsRoute(req, res) {
33094
- return handleListRoute({
33095
- req,
33096
- res,
33097
- basePath: BASE_PATH.RELATEDPERSON,
33098
- listOperation: listRelatedPersonsOperation,
33099
- errorLogContext: "GET /RelatedPerson list error:"
33100
- });
33101
- }
33102
-
33103
35413
  // src/data/operations/data/relatedperson/relatedperson-update-operation.ts
33104
35414
  async function updateRelatedPersonOperation(params) {
33105
35415
  const { context, id, body, tableName } = params;
@@ -34734,97 +37044,108 @@ async function listSchedulesOperation(params) {
34734
37044
  );
34735
37045
  }
34736
37046
 
34737
- // src/data/operations/data/schedule/schedule-search-by-actor-operation.ts
34738
- var DEFAULT_LIMIT2 = 100;
34739
- function buildSearchSchedulesByActorSql() {
34740
- return [
34741
- "SELECT resource_id AS id, resource",
34742
- "FROM resources",
34743
- "WHERE tenant_id = :tenantId",
34744
- " AND workspace_id = :workspaceId",
34745
- " AND resource_type = 'Schedule'",
34746
- " AND deleted_at IS NULL",
34747
- ` AND ${REFERENCE_CONTAINMENT_SQL_FRAGMENT}`,
34748
- "ORDER BY last_updated DESC",
34749
- "LIMIT :limit;"
34750
- ].join("\n");
34751
- }
34752
- async function searchSchedulesByActorOperation(params) {
34753
- const { context, actorReference } = params;
34754
- const { tenantId, workspaceId } = context;
34755
- const runner = params.runner ?? getDefaultPostgresQueryRunner();
34756
- const limit = params.limit ?? DEFAULT_LIMIT2;
34757
- const { containmentRelative, containmentUrn } = buildReferenceContainmentPayload({
34758
- shape: { kind: "array-of-references", field: "actor" },
34759
- reference: actorReference,
34760
- tenantId,
34761
- workspaceId
34762
- });
34763
- const queryParams = [
34764
- { name: "tenantId", value: tenantId },
34765
- { name: "workspaceId", value: workspaceId },
34766
- { name: "containmentRelative", value: containmentRelative },
34767
- { name: "containmentUrn", value: containmentUrn },
34768
- { name: "limit", value: limit }
34769
- ];
34770
- const rows = await runner.query(
34771
- buildSearchSchedulesByActorSql(),
34772
- queryParams
34773
- );
34774
- const entries = rows.map((row) => ({
34775
- id: row.id,
34776
- resource: { ...row.resource, id: row.id }
34777
- }));
34778
- return { entries, total: entries.length };
34779
- }
34780
-
34781
37047
  // src/data/rest-api/routes/data/schedule/schedule-list-route.ts
34782
- function singleStringQueryParam(req, name) {
34783
- const v = req.query[name];
34784
- if (typeof v !== "string") {
34785
- return void 0;
34786
- }
34787
- const trimmed = v.trim();
34788
- return trimmed === "" ? void 0 : trimmed;
37048
+ var SCHEDULE_RESOURCE_TYPE = "Schedule";
37049
+ function stripModifier29(key) {
37050
+ const idx = key.indexOf(":");
37051
+ return idx === -1 ? key : key.slice(0, idx);
34789
37052
  }
34790
- function sendInvalidSearch40012(res, diagnostics) {
37053
+ function isResultParameter29(key) {
37054
+ return key.startsWith("_");
37055
+ }
37056
+ function sendInvalidSearch40029(res, diagnostics) {
34791
37057
  return res.status(400).json({
34792
37058
  resourceType: "OperationOutcome",
34793
37059
  issue: [{ severity: "error", code: "invalid", diagnostics }]
34794
37060
  });
34795
37061
  }
34796
- async function listSchedulesRoute(req, res) {
34797
- const actorRef = singleStringQueryParam(req, "actor");
34798
- if (actorRef !== void 0) {
34799
- if (parseTypedReference(actorRef) === void 0) {
34800
- return sendInvalidSearch40012(
34801
- res,
34802
- `?actor must be a typed reference like "Practitioner/<id>"; got "${actorRef}".`
34803
- );
37062
+ function extractSearchParamKeys29(query) {
37063
+ const out = [];
37064
+ for (const rawKey of Object.keys(query)) {
37065
+ if (isResultParameter29(rawKey)) {
37066
+ continue;
34804
37067
  }
34805
- const ctx = req.openhiContext;
34806
- try {
34807
- const result = await searchSchedulesByActorOperation({
34808
- context: ctx,
34809
- actorReference: actorRef
34810
- });
34811
- const bundle = buildSearchsetBundle(BASE_PATH.SCHEDULE, result.entries);
34812
- return res.json(bundle);
34813
- } catch (err) {
34814
- return sendOperationOutcome500(
34815
- res,
34816
- err,
34817
- "GET /Schedule?actor= search error:"
34818
- );
37068
+ out.push({ rawKey, code: stripModifier29(rawKey) });
37069
+ }
37070
+ return out;
37071
+ }
37072
+ function buildUnknownParamDiagnostics29(unknownCodes) {
37073
+ const validCodes = getRegisteredSearchParameters(SCHEDULE_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
37074
+ const codes = unknownCodes.join(", ");
37075
+ const isPlural = unknownCodes.length !== 1;
37076
+ return [
37077
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Schedule: ${codes}.`,
37078
+ `Valid codes: ${validCodes}.`
37079
+ ].join(" ");
37080
+ }
37081
+ function findMalformedReference29(query, searchParamKeys) {
37082
+ const referenceCodes = new Set(
37083
+ getRegisteredSearchParameters(SCHEDULE_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
37084
+ );
37085
+ for (const { rawKey, code } of searchParamKeys) {
37086
+ if (!referenceCodes.has(code)) {
37087
+ continue;
37088
+ }
37089
+ const raw = query[rawKey];
37090
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
37091
+ for (const v of values) {
37092
+ const trimmed = v.trim();
37093
+ if (trimmed.length === 0) {
37094
+ continue;
37095
+ }
37096
+ if (parseTypedReference(trimmed) === void 0) {
37097
+ return { rawKey, value: trimmed };
37098
+ }
34819
37099
  }
34820
37100
  }
34821
- return handleListRoute({
34822
- req,
34823
- res,
34824
- basePath: BASE_PATH.SCHEDULE,
34825
- listOperation: listSchedulesOperation,
34826
- errorLogContext: "GET /Schedule list error:"
34827
- });
37101
+ return void 0;
37102
+ }
37103
+ async function listSchedulesRoute(req, res) {
37104
+ const searchParamKeys = extractSearchParamKeys29(
37105
+ req.query
37106
+ );
37107
+ if (searchParamKeys.length === 0) {
37108
+ return handleListRoute({
37109
+ req,
37110
+ res,
37111
+ basePath: BASE_PATH.SCHEDULE,
37112
+ listOperation: listSchedulesOperation,
37113
+ errorLogContext: "GET /Schedule list error:"
37114
+ });
37115
+ }
37116
+ const registered = getRegisteredSearchParameters(SCHEDULE_RESOURCE_TYPE);
37117
+ const validCodes = new Set(registered.map((p) => p.code));
37118
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
37119
+ if (unknownCodes.length > 0) {
37120
+ return sendInvalidSearch40029(
37121
+ res,
37122
+ buildUnknownParamDiagnostics29([...new Set(unknownCodes)])
37123
+ );
37124
+ }
37125
+ const malformedRef = findMalformedReference29(
37126
+ req.query,
37127
+ searchParamKeys
37128
+ );
37129
+ if (malformedRef !== void 0) {
37130
+ return sendInvalidSearch40029(
37131
+ res,
37132
+ `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
37133
+ );
37134
+ }
37135
+ const ctx = req.openhiContext;
37136
+ try {
37137
+ const result = await genericSearchOperation({
37138
+ resourceType: SCHEDULE_RESOURCE_TYPE,
37139
+ tenantId: ctx.tenantId,
37140
+ workspaceId: ctx.workspaceId,
37141
+ query: req.query,
37142
+ resolver: defaultSearchParameterResolver
37143
+ });
37144
+ const bundle = buildSearchsetBundle(BASE_PATH.SCHEDULE, result.entries);
37145
+ return res.json(bundle);
37146
+ } catch (err) {
37147
+ return sendOperationOutcome500(res, err, "GET /Schedule search error:");
37148
+ }
34828
37149
  }
34829
37150
 
34830
37151
  // src/data/operations/data/schedule/schedule-update-operation.ts
@@ -35391,42 +37712,135 @@ async function getSlotByIdRoute(req, res) {
35391
37712
  const id = String(req.params.id);
35392
37713
  const ctx = req.openhiContext;
35393
37714
  try {
35394
- const result = await getSlotByIdOperation({ context: ctx, id });
35395
- return res.json(result.resource);
37715
+ const result = await getSlotByIdOperation({ context: ctx, id });
37716
+ return res.json(result.resource);
37717
+ } catch (err) {
37718
+ const status = domainErrorToHttpStatus(err);
37719
+ if (status === 404) {
37720
+ const diagnostics = err instanceof NotFoundError ? err.message : `Slot ${id} not found`;
37721
+ return sendOperationOutcome404(res, diagnostics);
37722
+ }
37723
+ return sendOperationOutcome500(res, err, "GET Slot error:");
37724
+ }
37725
+ }
37726
+
37727
+ // src/data/operations/data/slot/slot-list-operation.ts
37728
+ async function listSlotsOperation(params) {
37729
+ const { context, tableName, mode } = params;
37730
+ const { tenantId, workspaceId } = context;
37731
+ const service = getDynamoDataService(tableName);
37732
+ return listDataEntitiesByWorkspace(
37733
+ service.entities.slot,
37734
+ tenantId,
37735
+ workspaceId,
37736
+ mode
37737
+ );
37738
+ }
37739
+
37740
+ // src/data/rest-api/routes/data/slot/slot-list-route.ts
37741
+ var SLOT_RESOURCE_TYPE = "Slot";
37742
+ function stripModifier30(key) {
37743
+ const idx = key.indexOf(":");
37744
+ return idx === -1 ? key : key.slice(0, idx);
37745
+ }
37746
+ function isResultParameter30(key) {
37747
+ return key.startsWith("_");
37748
+ }
37749
+ function sendInvalidSearch40030(res, diagnostics) {
37750
+ return res.status(400).json({
37751
+ resourceType: "OperationOutcome",
37752
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
37753
+ });
37754
+ }
37755
+ function extractSearchParamKeys30(query) {
37756
+ const out = [];
37757
+ for (const rawKey of Object.keys(query)) {
37758
+ if (isResultParameter30(rawKey)) {
37759
+ continue;
37760
+ }
37761
+ out.push({ rawKey, code: stripModifier30(rawKey) });
37762
+ }
37763
+ return out;
37764
+ }
37765
+ function buildUnknownParamDiagnostics30(unknownCodes) {
37766
+ const validCodes = getRegisteredSearchParameters(SLOT_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
37767
+ const codes = unknownCodes.join(", ");
37768
+ const isPlural = unknownCodes.length !== 1;
37769
+ return [
37770
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Slot: ${codes}.`,
37771
+ `Valid codes: ${validCodes}.`
37772
+ ].join(" ");
37773
+ }
37774
+ function findMalformedReference30(query, searchParamKeys) {
37775
+ const referenceCodes = new Set(
37776
+ getRegisteredSearchParameters(SLOT_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
37777
+ );
37778
+ for (const { rawKey, code } of searchParamKeys) {
37779
+ if (!referenceCodes.has(code)) {
37780
+ continue;
37781
+ }
37782
+ const raw = query[rawKey];
37783
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
37784
+ for (const v of values) {
37785
+ const trimmed = v.trim();
37786
+ if (trimmed.length === 0) {
37787
+ continue;
37788
+ }
37789
+ if (parseTypedReference(trimmed) === void 0) {
37790
+ return { rawKey, value: trimmed };
37791
+ }
37792
+ }
37793
+ }
37794
+ return void 0;
37795
+ }
37796
+ async function listSlotsRoute(req, res) {
37797
+ const searchParamKeys = extractSearchParamKeys30(
37798
+ req.query
37799
+ );
37800
+ if (searchParamKeys.length === 0) {
37801
+ return handleListRoute({
37802
+ req,
37803
+ res,
37804
+ basePath: BASE_PATH.SLOT,
37805
+ listOperation: listSlotsOperation,
37806
+ errorLogContext: "GET /Slot list error:"
37807
+ });
37808
+ }
37809
+ const registered = getRegisteredSearchParameters(SLOT_RESOURCE_TYPE);
37810
+ const validCodes = new Set(registered.map((p) => p.code));
37811
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
37812
+ if (unknownCodes.length > 0) {
37813
+ return sendInvalidSearch40030(
37814
+ res,
37815
+ buildUnknownParamDiagnostics30([...new Set(unknownCodes)])
37816
+ );
37817
+ }
37818
+ const malformedRef = findMalformedReference30(
37819
+ req.query,
37820
+ searchParamKeys
37821
+ );
37822
+ if (malformedRef !== void 0) {
37823
+ return sendInvalidSearch40030(
37824
+ res,
37825
+ `?${malformedRef.rawKey} must be a typed reference like "Schedule/<id>"; got "${malformedRef.value}".`
37826
+ );
37827
+ }
37828
+ const ctx = req.openhiContext;
37829
+ try {
37830
+ const result = await genericSearchOperation({
37831
+ resourceType: SLOT_RESOURCE_TYPE,
37832
+ tenantId: ctx.tenantId,
37833
+ workspaceId: ctx.workspaceId,
37834
+ query: req.query,
37835
+ resolver: defaultSearchParameterResolver
37836
+ });
37837
+ const bundle = buildSearchsetBundle(BASE_PATH.SLOT, result.entries);
37838
+ return res.json(bundle);
35396
37839
  } catch (err) {
35397
- const status = domainErrorToHttpStatus(err);
35398
- if (status === 404) {
35399
- const diagnostics = err instanceof NotFoundError ? err.message : `Slot ${id} not found`;
35400
- return sendOperationOutcome404(res, diagnostics);
35401
- }
35402
- return sendOperationOutcome500(res, err, "GET Slot error:");
37840
+ return sendOperationOutcome500(res, err, "GET /Slot search error:");
35403
37841
  }
35404
37842
  }
35405
37843
 
35406
- // src/data/operations/data/slot/slot-list-operation.ts
35407
- async function listSlotsOperation(params) {
35408
- const { context, tableName, mode } = params;
35409
- const { tenantId, workspaceId } = context;
35410
- const service = getDynamoDataService(tableName);
35411
- return listDataEntitiesByWorkspace(
35412
- service.entities.slot,
35413
- tenantId,
35414
- workspaceId,
35415
- mode
35416
- );
35417
- }
35418
-
35419
- // src/data/rest-api/routes/data/slot/slot-list-route.ts
35420
- async function listSlotsRoute(req, res) {
35421
- return handleListRoute({
35422
- req,
35423
- res,
35424
- basePath: BASE_PATH.SLOT,
35425
- listOperation: listSlotsOperation,
35426
- errorLogContext: "GET /Slot list error:"
35427
- });
35428
- }
35429
-
35430
37844
  // src/data/operations/data/slot/slot-update-operation.ts
35431
37845
  async function updateSlotOperation(params) {
35432
37846
  const { context, id, body, tableName } = params;
@@ -35617,15 +38031,111 @@ async function listSpecimensOperation(params) {
35617
38031
  }
35618
38032
 
35619
38033
  // src/data/rest-api/routes/data/specimen/specimen-list-route.ts
35620
- async function listSpecimensRoute(req, res) {
35621
- return handleListRoute({
35622
- req,
35623
- res,
35624
- basePath: BASE_PATH.SPECIMEN,
35625
- listOperation: listSpecimensOperation,
35626
- errorLogContext: "GET /Specimen list error:"
38034
+ var SPECIMEN_RESOURCE_TYPE = "Specimen";
38035
+ function stripModifier31(key) {
38036
+ const idx = key.indexOf(":");
38037
+ return idx === -1 ? key : key.slice(0, idx);
38038
+ }
38039
+ function isResultParameter31(key) {
38040
+ return key.startsWith("_");
38041
+ }
38042
+ function sendInvalidSearch40031(res, diagnostics) {
38043
+ return res.status(400).json({
38044
+ resourceType: "OperationOutcome",
38045
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
35627
38046
  });
35628
38047
  }
38048
+ function extractSearchParamKeys31(query) {
38049
+ const out = [];
38050
+ for (const rawKey of Object.keys(query)) {
38051
+ if (isResultParameter31(rawKey)) {
38052
+ continue;
38053
+ }
38054
+ out.push({ rawKey, code: stripModifier31(rawKey) });
38055
+ }
38056
+ return out;
38057
+ }
38058
+ function buildUnknownParamDiagnostics31(unknownCodes) {
38059
+ const validCodes = getRegisteredSearchParameters(SPECIMEN_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
38060
+ const codes = unknownCodes.join(", ");
38061
+ const isPlural = unknownCodes.length !== 1;
38062
+ return [
38063
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Specimen: ${codes}.`,
38064
+ `Valid codes: ${validCodes}.`
38065
+ ].join(" ");
38066
+ }
38067
+ function findMalformedReference31(query, searchParamKeys) {
38068
+ const referenceCodes = new Set(
38069
+ getRegisteredSearchParameters(SPECIMEN_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
38070
+ );
38071
+ if (referenceCodes.size === 0) {
38072
+ return void 0;
38073
+ }
38074
+ for (const { rawKey, code } of searchParamKeys) {
38075
+ if (!referenceCodes.has(code)) {
38076
+ continue;
38077
+ }
38078
+ const raw = query[rawKey];
38079
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
38080
+ for (const v of values) {
38081
+ const trimmed = v.trim();
38082
+ if (trimmed.length === 0) {
38083
+ continue;
38084
+ }
38085
+ if (parseTypedReference(trimmed) === void 0) {
38086
+ return { rawKey, value: trimmed };
38087
+ }
38088
+ }
38089
+ }
38090
+ return void 0;
38091
+ }
38092
+ async function listSpecimensRoute(req, res) {
38093
+ const searchParamKeys = extractSearchParamKeys31(
38094
+ req.query
38095
+ );
38096
+ if (searchParamKeys.length === 0) {
38097
+ return handleListRoute({
38098
+ req,
38099
+ res,
38100
+ basePath: BASE_PATH.SPECIMEN,
38101
+ listOperation: listSpecimensOperation,
38102
+ errorLogContext: "GET /Specimen list error:"
38103
+ });
38104
+ }
38105
+ const registered = getRegisteredSearchParameters(SPECIMEN_RESOURCE_TYPE);
38106
+ const validCodes = new Set(registered.map((p) => p.code));
38107
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
38108
+ if (unknownCodes.length > 0) {
38109
+ return sendInvalidSearch40031(
38110
+ res,
38111
+ buildUnknownParamDiagnostics31([...new Set(unknownCodes)])
38112
+ );
38113
+ }
38114
+ const malformedRef = findMalformedReference31(
38115
+ req.query,
38116
+ searchParamKeys
38117
+ );
38118
+ if (malformedRef !== void 0) {
38119
+ return sendInvalidSearch40031(
38120
+ res,
38121
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
38122
+ );
38123
+ }
38124
+ const ctx = req.openhiContext;
38125
+ try {
38126
+ const result = await genericSearchOperation({
38127
+ resourceType: SPECIMEN_RESOURCE_TYPE,
38128
+ tenantId: ctx.tenantId,
38129
+ workspaceId: ctx.workspaceId,
38130
+ query: req.query,
38131
+ resolver: defaultSearchParameterResolver
38132
+ });
38133
+ const bundle = buildSearchsetBundle(BASE_PATH.SPECIMEN, result.entries);
38134
+ return res.json(bundle);
38135
+ } catch (err) {
38136
+ return sendOperationOutcome500(res, err, "GET /Specimen search error:");
38137
+ }
38138
+ }
35629
38139
 
35630
38140
  // src/data/operations/data/specimen/specimen-update-operation.ts
35631
38141
  async function updateSpecimenOperation(params) {
@@ -38498,171 +41008,108 @@ async function listTasksOperation(params) {
38498
41008
  );
38499
41009
  }
38500
41010
 
38501
- // src/data/operations/data/task/task-search-by-owner-operation.ts
38502
- var DEFAULT_LIMIT3 = 100;
38503
- function buildSearchTasksByOwnerSql() {
38504
- return [
38505
- "SELECT resource_id AS id, resource",
38506
- "FROM resources",
38507
- "WHERE tenant_id = :tenantId",
38508
- " AND workspace_id = :workspaceId",
38509
- " AND resource_type = 'Task'",
38510
- " AND deleted_at IS NULL",
38511
- ` AND ${REFERENCE_CONTAINMENT_SQL_FRAGMENT}`,
38512
- "ORDER BY last_updated DESC",
38513
- "LIMIT :limit;"
38514
- ].join("\n");
41011
+ // src/data/rest-api/routes/data/task/task-list-route.ts
41012
+ var TASK_RESOURCE_TYPE = "Task";
41013
+ function stripModifier32(key) {
41014
+ const idx = key.indexOf(":");
41015
+ return idx === -1 ? key : key.slice(0, idx);
38515
41016
  }
38516
- async function searchTasksByOwnerOperation(params) {
38517
- const { context, ownerReference } = params;
38518
- const { tenantId, workspaceId } = context;
38519
- const runner = params.runner ?? getDefaultPostgresQueryRunner();
38520
- const limit = params.limit ?? DEFAULT_LIMIT3;
38521
- const { containmentRelative, containmentUrn } = buildReferenceContainmentPayload({
38522
- shape: { kind: "scalar", field: "owner" },
38523
- reference: ownerReference,
38524
- tenantId,
38525
- workspaceId
41017
+ function isResultParameter32(key) {
41018
+ return key.startsWith("_");
41019
+ }
41020
+ function sendInvalidSearch40032(res, diagnostics) {
41021
+ return res.status(400).json({
41022
+ resourceType: "OperationOutcome",
41023
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
38526
41024
  });
38527
- const queryParams = [
38528
- { name: "tenantId", value: tenantId },
38529
- { name: "workspaceId", value: workspaceId },
38530
- { name: "containmentRelative", value: containmentRelative },
38531
- { name: "containmentUrn", value: containmentUrn },
38532
- { name: "limit", value: limit }
38533
- ];
38534
- const rows = await runner.query(
38535
- buildSearchTasksByOwnerSql(),
38536
- queryParams
38537
- );
38538
- const entries = rows.map((row) => ({
38539
- id: row.id,
38540
- resource: { ...row.resource, id: row.id }
38541
- }));
38542
- return { entries, total: entries.length };
38543
41025
  }
38544
-
38545
- // src/data/operations/data/task/task-search-by-requester-operation.ts
38546
- var DEFAULT_LIMIT4 = 100;
38547
- function buildSearchTasksByRequesterSql() {
41026
+ function extractSearchParamKeys32(query) {
41027
+ const out = [];
41028
+ for (const rawKey of Object.keys(query)) {
41029
+ if (isResultParameter32(rawKey)) {
41030
+ continue;
41031
+ }
41032
+ out.push({ rawKey, code: stripModifier32(rawKey) });
41033
+ }
41034
+ return out;
41035
+ }
41036
+ function buildUnknownParamDiagnostics32(unknownCodes) {
41037
+ const validCodes = getRegisteredSearchParameters(TASK_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
41038
+ const codes = unknownCodes.join(", ");
41039
+ const isPlural = unknownCodes.length !== 1;
38548
41040
  return [
38549
- "SELECT resource_id AS id, resource",
38550
- "FROM resources",
38551
- "WHERE tenant_id = :tenantId",
38552
- " AND workspace_id = :workspaceId",
38553
- " AND resource_type = 'Task'",
38554
- " AND deleted_at IS NULL",
38555
- ` AND ${REFERENCE_CONTAINMENT_SQL_FRAGMENT}`,
38556
- "ORDER BY last_updated DESC",
38557
- "LIMIT :limit;"
38558
- ].join("\n");
41041
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Task: ${codes}.`,
41042
+ `Valid codes: ${validCodes}.`
41043
+ ].join(" ");
38559
41044
  }
38560
- async function searchTasksByRequesterOperation(params) {
38561
- const { context, requesterReference } = params;
38562
- const { tenantId, workspaceId } = context;
38563
- const runner = params.runner ?? getDefaultPostgresQueryRunner();
38564
- const limit = params.limit ?? DEFAULT_LIMIT4;
38565
- const { containmentRelative, containmentUrn } = buildReferenceContainmentPayload({
38566
- shape: { kind: "scalar", field: "requester" },
38567
- reference: requesterReference,
38568
- tenantId,
38569
- workspaceId
38570
- });
38571
- const queryParams = [
38572
- { name: "tenantId", value: tenantId },
38573
- { name: "workspaceId", value: workspaceId },
38574
- { name: "containmentRelative", value: containmentRelative },
38575
- { name: "containmentUrn", value: containmentUrn },
38576
- { name: "limit", value: limit }
38577
- ];
38578
- const rows = await runner.query(
38579
- buildSearchTasksByRequesterSql(),
38580
- queryParams
41045
+ function findMalformedReference32(query, searchParamKeys) {
41046
+ const referenceCodes = new Set(
41047
+ getRegisteredSearchParameters(TASK_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
38581
41048
  );
38582
- const entries = rows.map((row) => ({
38583
- id: row.id,
38584
- resource: { ...row.resource, id: row.id }
38585
- }));
38586
- return { entries, total: entries.length };
38587
- }
38588
-
38589
- // src/data/rest-api/routes/data/task/task-list-route.ts
38590
- function singleStringQueryParam2(req, name) {
38591
- const v = req.query[name];
38592
- if (typeof v !== "string") {
38593
- return void 0;
41049
+ for (const { rawKey, code } of searchParamKeys) {
41050
+ if (!referenceCodes.has(code)) {
41051
+ continue;
41052
+ }
41053
+ const raw = query[rawKey];
41054
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
41055
+ for (const v of values) {
41056
+ const trimmed = v.trim();
41057
+ if (trimmed.length === 0) {
41058
+ continue;
41059
+ }
41060
+ if (parseTypedReference(trimmed) === void 0) {
41061
+ return { rawKey, value: trimmed };
41062
+ }
41063
+ }
38594
41064
  }
38595
- const trimmed = v.trim();
38596
- return trimmed === "" ? void 0 : trimmed;
38597
- }
38598
- function sendInvalidSearch40013(res, diagnostics) {
38599
- return res.status(400).json({
38600
- resourceType: "OperationOutcome",
38601
- issue: [{ severity: "error", code: "invalid", diagnostics }]
38602
- });
41065
+ return void 0;
38603
41066
  }
38604
41067
  async function listTasksRoute(req, res) {
38605
- const ownerRef = singleStringQueryParam2(req, "owner");
38606
- const requesterRef = singleStringQueryParam2(req, "requester");
38607
- if (ownerRef !== void 0 && requesterRef !== void 0) {
38608
- return sendInvalidSearch40013(
41068
+ const searchParamKeys = extractSearchParamKeys32(
41069
+ req.query
41070
+ );
41071
+ if (searchParamKeys.length === 0) {
41072
+ return handleListRoute({
41073
+ req,
41074
+ res,
41075
+ basePath: BASE_PATH.TASK,
41076
+ listOperation: listTasksOperation,
41077
+ errorLogContext: "GET /Task list error:"
41078
+ });
41079
+ }
41080
+ const registered = getRegisteredSearchParameters(TASK_RESOURCE_TYPE);
41081
+ const validCodes = new Set(registered.map((p) => p.code));
41082
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
41083
+ if (unknownCodes.length > 0) {
41084
+ return sendInvalidSearch40032(
38609
41085
  res,
38610
- "?owner= and ?requester= cannot be combined on the same request."
41086
+ buildUnknownParamDiagnostics32([...new Set(unknownCodes)])
38611
41087
  );
38612
41088
  }
38613
- if (ownerRef !== void 0) {
38614
- if (parseTypedReference(ownerRef) === void 0) {
38615
- return sendInvalidSearch40013(
38616
- res,
38617
- `?owner must be a typed reference like "Practitioner/<id>"; got "${ownerRef}".`
38618
- );
38619
- }
38620
- const ctx = req.openhiContext;
38621
- try {
38622
- const result = await searchTasksByOwnerOperation({
38623
- context: ctx,
38624
- ownerReference: ownerRef
38625
- });
38626
- const bundle = buildSearchsetBundle(BASE_PATH.TASK, result.entries);
38627
- return res.json(bundle);
38628
- } catch (err) {
38629
- return sendOperationOutcome500(
38630
- res,
38631
- err,
38632
- "GET /Task?owner= search error:"
38633
- );
38634
- }
41089
+ const malformedRef = findMalformedReference32(
41090
+ req.query,
41091
+ searchParamKeys
41092
+ );
41093
+ if (malformedRef !== void 0) {
41094
+ return sendInvalidSearch40032(
41095
+ res,
41096
+ `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
41097
+ );
38635
41098
  }
38636
- if (requesterRef !== void 0) {
38637
- if (parseTypedReference(requesterRef) === void 0) {
38638
- return sendInvalidSearch40013(
38639
- res,
38640
- `?requester must be a typed reference like "Practitioner/<id>"; got "${requesterRef}".`
38641
- );
38642
- }
38643
- const ctx = req.openhiContext;
38644
- try {
38645
- const result = await searchTasksByRequesterOperation({
38646
- context: ctx,
38647
- requesterReference: requesterRef
38648
- });
38649
- const bundle = buildSearchsetBundle(BASE_PATH.TASK, result.entries);
38650
- return res.json(bundle);
38651
- } catch (err) {
38652
- return sendOperationOutcome500(
38653
- res,
38654
- err,
38655
- "GET /Task?requester= search error:"
38656
- );
38657
- }
41099
+ const ctx = req.openhiContext;
41100
+ try {
41101
+ const result = await genericSearchOperation({
41102
+ resourceType: TASK_RESOURCE_TYPE,
41103
+ tenantId: ctx.tenantId,
41104
+ workspaceId: ctx.workspaceId,
41105
+ query: req.query,
41106
+ resolver: defaultSearchParameterResolver
41107
+ });
41108
+ const bundle = buildSearchsetBundle(BASE_PATH.TASK, result.entries);
41109
+ return res.json(bundle);
41110
+ } catch (err) {
41111
+ return sendOperationOutcome500(res, err, "GET /Task search error:");
38658
41112
  }
38659
- return handleListRoute({
38660
- req,
38661
- res,
38662
- basePath: BASE_PATH.TASK,
38663
- listOperation: listTasksOperation,
38664
- errorLogContext: "GET /Task list error:"
38665
- });
38666
41113
  }
38667
41114
 
38668
41115
  // src/data/operations/data/task/task-update-operation.ts