@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.
@@ -5209,7 +5209,6 @@ async function listAllergyIntolerancesOperation(params) {
5209
5209
  function buildOpenHiResourceUrn(opts) {
5210
5210
  return `urn:ohi:${opts.tenantId}:${opts.workspaceId}:${opts.resourceType}:${opts.resourceId}`;
5211
5211
  }
5212
- var REFERENCE_CONTAINMENT_SQL_FRAGMENT = "(resource @> :containmentRelative::jsonb OR resource @> :containmentUrn::jsonb)";
5213
5212
  function parseTypedReference(s) {
5214
5213
  const match = /^([A-Za-z][A-Za-z0-9_]*)\/([^\s/]+)$/.exec(s);
5215
5214
  if (!match) {
@@ -5879,6 +5878,89 @@ var APPOINTMENT_SEARCH_PARAMETERS = [
5879
5878
  { code: "slot", type: "reference", jsonbPath: "$.slot[*]" }
5880
5879
  ];
5881
5880
 
5881
+ // src/data/search/registry/chargeitem-search-parameters.ts
5882
+ var CHARGEITEM_SEARCH_PARAMETERS = [
5883
+ { code: "account", type: "reference", jsonbPath: "$.account[*]" },
5884
+ { code: "code", type: "token", jsonbPath: "$.code" },
5885
+ { code: "context", type: "reference", jsonbPath: "$.context" },
5886
+ { code: "entered-date", type: "date", jsonbPath: "$.enteredDate" },
5887
+ { code: "enterer", type: "reference", jsonbPath: "$.enterer" },
5888
+ {
5889
+ code: "factor-override",
5890
+ type: "string",
5891
+ jsonbPath: "$.factorOverride",
5892
+ modifiers: ["exact", "contains", "missing", "not"]
5893
+ },
5894
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
5895
+ { code: "occurrence", type: "date", jsonbPath: "$.occurrenceDateTime" },
5896
+ { code: "patient", type: "reference", jsonbPath: "$.subject" },
5897
+ {
5898
+ code: "performer-actor",
5899
+ type: "reference",
5900
+ jsonbPath: "$.performer[*].actor"
5901
+ },
5902
+ {
5903
+ code: "performer-function",
5904
+ type: "token",
5905
+ jsonbPath: "$.performer[*].function"
5906
+ },
5907
+ {
5908
+ code: "performing-organization",
5909
+ type: "reference",
5910
+ jsonbPath: "$.performingOrganization"
5911
+ },
5912
+ {
5913
+ code: "requesting-organization",
5914
+ type: "reference",
5915
+ jsonbPath: "$.requestingOrganization"
5916
+ },
5917
+ { code: "service", type: "reference", jsonbPath: "$.service[*]" },
5918
+ { code: "subject", type: "reference", jsonbPath: "$.subject" }
5919
+ ];
5920
+
5921
+ // src/data/search/registry/claim-search-parameters.ts
5922
+ var CLAIM_SEARCH_PARAMETERS = [
5923
+ {
5924
+ code: "care-team",
5925
+ type: "reference",
5926
+ jsonbPath: "$.careTeam[*].provider"
5927
+ },
5928
+ { code: "created", type: "date", jsonbPath: "$.created" },
5929
+ { code: "enterer", type: "reference", jsonbPath: "$.enterer" },
5930
+ { code: "facility", type: "reference", jsonbPath: "$.facility" },
5931
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
5932
+ { code: "insurer", type: "reference", jsonbPath: "$.insurer" },
5933
+ { code: "patient", type: "reference", jsonbPath: "$.patient" },
5934
+ { code: "priority", type: "token", jsonbPath: "$.priority" },
5935
+ { code: "provider", type: "reference", jsonbPath: "$.provider" },
5936
+ { code: "status", type: "token", jsonbPath: "$.status" },
5937
+ { code: "use", type: "token", jsonbPath: "$.use" }
5938
+ ];
5939
+
5940
+ // src/data/search/registry/composition-search-parameters.ts
5941
+ var COMPOSITION_SEARCH_PARAMETERS = [
5942
+ { code: "status", type: "token", jsonbPath: "$.status" },
5943
+ { code: "type", type: "token", jsonbPath: "$.type" },
5944
+ { code: "category", type: "token", jsonbPath: "$.category[*]" },
5945
+ { code: "subject", type: "reference", jsonbPath: "$.subject" },
5946
+ { code: "patient", type: "reference", jsonbPath: "$.subject" },
5947
+ { code: "encounter", type: "reference", jsonbPath: "$.encounter" },
5948
+ { code: "author", type: "reference", jsonbPath: "$.author[*]" },
5949
+ { code: "date", type: "date", jsonbPath: "$.date" },
5950
+ {
5951
+ code: "confidentiality",
5952
+ type: "token",
5953
+ jsonbPath: "$.confidentiality"
5954
+ },
5955
+ {
5956
+ code: "title",
5957
+ type: "string",
5958
+ jsonbPath: "$.title",
5959
+ modifiers: ["exact", "contains", "missing", "not"]
5960
+ },
5961
+ { code: "identifier", type: "token", jsonbPath: "$.identifier" }
5962
+ ];
5963
+
5882
5964
  // src/data/search/registry/condition-search-parameters.ts
5883
5965
  var CONDITION_SEARCH_PARAMETERS = [
5884
5966
  {
@@ -5905,6 +5987,121 @@ var CONDITION_SEARCH_PARAMETERS = [
5905
5987
  { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" }
5906
5988
  ];
5907
5989
 
5990
+ // src/data/search/registry/coverage-search-parameters.ts
5991
+ var COVERAGE_SEARCH_PARAMETERS = [
5992
+ { code: "beneficiary", type: "reference", jsonbPath: "$.beneficiary" },
5993
+ { code: "class-type", type: "token", jsonbPath: "$.class[*].type" },
5994
+ {
5995
+ code: "class-value",
5996
+ type: "string",
5997
+ jsonbPath: "$.class[*].value",
5998
+ modifiers: ["exact", "contains", "missing", "not"]
5999
+ },
6000
+ {
6001
+ code: "dependent",
6002
+ type: "string",
6003
+ jsonbPath: "$.dependent",
6004
+ modifiers: ["exact", "contains", "missing", "not"]
6005
+ },
6006
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
6007
+ { code: "patient", type: "reference", jsonbPath: "$.beneficiary" },
6008
+ { code: "payor", type: "reference", jsonbPath: "$.payor[*]" },
6009
+ {
6010
+ code: "policy-holder",
6011
+ type: "reference",
6012
+ jsonbPath: "$.policyHolder"
6013
+ },
6014
+ { code: "status", type: "token", jsonbPath: "$.status" },
6015
+ { code: "subscriber", type: "reference", jsonbPath: "$.subscriber" },
6016
+ { code: "type", type: "token", jsonbPath: "$.type" }
6017
+ ];
6018
+
6019
+ // src/data/search/registry/diagnosticreport-search-parameters.ts
6020
+ var DIAGNOSTICREPORT_SEARCH_PARAMETERS = [
6021
+ { code: "based-on", type: "reference", jsonbPath: "$.basedOn[*]" },
6022
+ { code: "category", type: "token", jsonbPath: "$.category[*]" },
6023
+ { code: "code", type: "token", jsonbPath: "$.code" },
6024
+ {
6025
+ code: "conclusion",
6026
+ type: "token",
6027
+ jsonbPath: "$.conclusionCode[*]"
6028
+ },
6029
+ { code: "date", type: "date", jsonbPath: "$.effectiveDateTime" },
6030
+ { code: "encounter", type: "reference", jsonbPath: "$.encounter" },
6031
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
6032
+ { code: "issued", type: "date", jsonbPath: "$.issued" },
6033
+ { code: "patient", type: "reference", jsonbPath: "$.subject" },
6034
+ { code: "performer", type: "reference", jsonbPath: "$.performer[*]" },
6035
+ { code: "result", type: "reference", jsonbPath: "$.result[*]" },
6036
+ {
6037
+ code: "results-interpreter",
6038
+ type: "reference",
6039
+ jsonbPath: "$.resultsInterpreter[*]"
6040
+ },
6041
+ { code: "specimen", type: "reference", jsonbPath: "$.specimen[*]" },
6042
+ { code: "status", type: "token", jsonbPath: "$.status" },
6043
+ { code: "subject", type: "reference", jsonbPath: "$.subject" }
6044
+ ];
6045
+
6046
+ // src/data/search/registry/documentmanifest-search-parameters.ts
6047
+ var DOCUMENTMANIFEST_SEARCH_PARAMETERS = [
6048
+ { code: "status", type: "token", jsonbPath: "$.status" },
6049
+ { code: "type", type: "token", jsonbPath: "$.type" },
6050
+ { code: "subject", type: "reference", jsonbPath: "$.subject" },
6051
+ { code: "patient", type: "reference", jsonbPath: "$.subject" },
6052
+ { code: "author", type: "reference", jsonbPath: "$.author[*]" },
6053
+ { code: "recipient", type: "reference", jsonbPath: "$.recipient[*]" },
6054
+ { code: "created", type: "date", jsonbPath: "$.created" },
6055
+ {
6056
+ code: "description",
6057
+ type: "string",
6058
+ jsonbPath: "$.description",
6059
+ modifiers: ["exact", "contains", "missing", "not"]
6060
+ },
6061
+ { code: "identifier", type: "token", jsonbPath: "$.identifier" },
6062
+ {
6063
+ code: "source",
6064
+ type: "string",
6065
+ jsonbPath: "$.source",
6066
+ modifiers: ["exact", "contains", "missing", "not"]
6067
+ },
6068
+ {
6069
+ code: "related-id",
6070
+ type: "token",
6071
+ jsonbPath: "$.related[*].identifier"
6072
+ },
6073
+ {
6074
+ code: "related-ref",
6075
+ type: "reference",
6076
+ jsonbPath: "$.related[*].ref"
6077
+ }
6078
+ ];
6079
+
6080
+ // src/data/search/registry/documentreference-search-parameters.ts
6081
+ var DOCUMENTREFERENCE_SEARCH_PARAMETERS = [
6082
+ { code: "status", type: "token", jsonbPath: "$.status" },
6083
+ { code: "docStatus", type: "token", jsonbPath: "$.docStatus" },
6084
+ { code: "type", type: "token", jsonbPath: "$.type" },
6085
+ { code: "category", type: "token", jsonbPath: "$.category[*]" },
6086
+ { code: "subject", type: "reference", jsonbPath: "$.subject" },
6087
+ { code: "patient", type: "reference", jsonbPath: "$.subject" },
6088
+ { code: "author", type: "reference", jsonbPath: "$.author[*]" },
6089
+ {
6090
+ code: "authenticator",
6091
+ type: "reference",
6092
+ jsonbPath: "$.authenticator"
6093
+ },
6094
+ { code: "custodian", type: "reference", jsonbPath: "$.custodian" },
6095
+ { code: "date", type: "date", jsonbPath: "$.date" },
6096
+ {
6097
+ code: "description",
6098
+ type: "string",
6099
+ jsonbPath: "$.description",
6100
+ modifiers: ["exact", "contains", "missing", "not"]
6101
+ },
6102
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" }
6103
+ ];
6104
+
5908
6105
  // src/data/search/registry/encounter-search-parameters.ts
5909
6106
  var ENCOUNTER_SEARCH_PARAMETERS = [
5910
6107
  { code: "status", type: "token", jsonbPath: "$.status" },
@@ -5931,6 +6128,61 @@ var ENCOUNTER_SEARCH_PARAMETERS = [
5931
6128
  }
5932
6129
  ];
5933
6130
 
6131
+ // src/data/search/registry/endpoint-search-parameters.ts
6132
+ var ENDPOINT_SEARCH_PARAMETERS = [
6133
+ {
6134
+ code: "connection-type",
6135
+ type: "token",
6136
+ jsonbPath: "$.connectionType"
6137
+ },
6138
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
6139
+ {
6140
+ code: "name",
6141
+ type: "string",
6142
+ jsonbPath: "$.name",
6143
+ modifiers: ["exact", "contains", "missing", "not"]
6144
+ },
6145
+ {
6146
+ code: "organization",
6147
+ type: "reference",
6148
+ jsonbPath: "$.managingOrganization"
6149
+ },
6150
+ {
6151
+ code: "payload-type",
6152
+ type: "token",
6153
+ jsonbPath: "$.payloadType[*]"
6154
+ },
6155
+ { code: "status", type: "token", jsonbPath: "$.status" }
6156
+ ];
6157
+
6158
+ // src/data/search/registry/explanationofbenefit-search-parameters.ts
6159
+ var EXPLANATIONOFBENEFIT_SEARCH_PARAMETERS = [
6160
+ {
6161
+ code: "care-team",
6162
+ type: "reference",
6163
+ jsonbPath: "$.careTeam[*].provider"
6164
+ },
6165
+ { code: "claim", type: "reference", jsonbPath: "$.claim" },
6166
+ {
6167
+ code: "coverage",
6168
+ type: "reference",
6169
+ jsonbPath: "$.insurance[*].coverage"
6170
+ },
6171
+ { code: "created", type: "date", jsonbPath: "$.created" },
6172
+ {
6173
+ code: "disposition",
6174
+ type: "string",
6175
+ jsonbPath: "$.disposition",
6176
+ modifiers: ["exact", "contains", "missing", "not"]
6177
+ },
6178
+ { code: "enterer", type: "reference", jsonbPath: "$.enterer" },
6179
+ { code: "facility", type: "reference", jsonbPath: "$.facility" },
6180
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
6181
+ { code: "patient", type: "reference", jsonbPath: "$.patient" },
6182
+ { code: "provider", type: "reference", jsonbPath: "$.provider" },
6183
+ { code: "status", type: "token", jsonbPath: "$.status" }
6184
+ ];
6185
+
5934
6186
  // src/data/search/registry/familymemberhistory-search-parameters.ts
5935
6187
  var FAMILYMEMBERHISTORY_SEARCH_PARAMETERS = [
5936
6188
  { code: "status", type: "token", jsonbPath: "$.status" },
@@ -5942,6 +6194,24 @@ var FAMILYMEMBERHISTORY_SEARCH_PARAMETERS = [
5942
6194
  { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" }
5943
6195
  ];
5944
6196
 
6197
+ // src/data/search/registry/imagingstudy-search-parameters.ts
6198
+ var IMAGINGSTUDY_SEARCH_PARAMETERS = [
6199
+ { code: "basedon", type: "reference", jsonbPath: "$.basedOn[*]" },
6200
+ { code: "bodysite", type: "token", jsonbPath: "$.series[*].bodySite" },
6201
+ { code: "encounter", type: "reference", jsonbPath: "$.encounter" },
6202
+ { code: "endpoint", type: "reference", jsonbPath: "$.endpoint[*]" },
6203
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
6204
+ { code: "interpreter", type: "reference", jsonbPath: "$.interpreter[*]" },
6205
+ { code: "modality", type: "token", jsonbPath: "$.series[*].modality" },
6206
+ { code: "patient", type: "reference", jsonbPath: "$.subject" },
6207
+ { code: "reason", type: "token", jsonbPath: "$.reasonCode[*]" },
6208
+ { code: "referrer", type: "reference", jsonbPath: "$.referrer" },
6209
+ { code: "series", type: "token", jsonbPath: "$.series[*].uid" },
6210
+ { code: "started", type: "date", jsonbPath: "$.started" },
6211
+ { code: "status", type: "token", jsonbPath: "$.status" },
6212
+ { code: "subject", type: "reference", jsonbPath: "$.subject" }
6213
+ ];
6214
+
5945
6215
  // src/data/search/registry/immunization-search-parameters.ts
5946
6216
  var IMMUNIZATION_SEARCH_PARAMETERS = [
5947
6217
  { code: "status", type: "token", jsonbPath: "$.status" },
@@ -5968,6 +6238,54 @@ var IMMUNIZATION_SEARCH_PARAMETERS = [
5968
6238
  { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" }
5969
6239
  ];
5970
6240
 
6241
+ // src/data/search/registry/invoice-search-parameters.ts
6242
+ var INVOICE_SEARCH_PARAMETERS = [
6243
+ { code: "account", type: "reference", jsonbPath: "$.account" },
6244
+ { code: "date", type: "date", jsonbPath: "$.date" },
6245
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
6246
+ { code: "issuer", type: "reference", jsonbPath: "$.issuer" },
6247
+ {
6248
+ code: "participant",
6249
+ type: "reference",
6250
+ jsonbPath: "$.participant[*].actor"
6251
+ },
6252
+ {
6253
+ code: "participant-role",
6254
+ type: "token",
6255
+ jsonbPath: "$.participant[*].role"
6256
+ },
6257
+ { code: "patient", type: "reference", jsonbPath: "$.subject" },
6258
+ { code: "recipient", type: "reference", jsonbPath: "$.recipient" },
6259
+ { code: "status", type: "token", jsonbPath: "$.status" },
6260
+ { code: "subject", type: "reference", jsonbPath: "$.subject" },
6261
+ { code: "type", type: "token", jsonbPath: "$.type" }
6262
+ ];
6263
+
6264
+ // src/data/search/registry/location-search-parameters.ts
6265
+ var LOCATION_SEARCH_PARAMETERS = [
6266
+ { code: "endpoint", type: "reference", jsonbPath: "$.endpoint[*]" },
6267
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
6268
+ {
6269
+ code: "name",
6270
+ type: "string",
6271
+ jsonbPath: "$.name",
6272
+ modifiers: ["exact", "contains", "missing", "not"]
6273
+ },
6274
+ {
6275
+ code: "operational-status",
6276
+ type: "token",
6277
+ jsonbPath: "$.operationalStatus"
6278
+ },
6279
+ {
6280
+ code: "organization",
6281
+ type: "reference",
6282
+ jsonbPath: "$.managingOrganization"
6283
+ },
6284
+ { code: "partof", type: "reference", jsonbPath: "$.partOf" },
6285
+ { code: "status", type: "token", jsonbPath: "$.status" },
6286
+ { code: "type", type: "token", jsonbPath: "$.type[*]" }
6287
+ ];
6288
+
5971
6289
  // src/data/search/registry/medicationrequest-search-parameters.ts
5972
6290
  var MEDICATIONREQUEST_SEARCH_PARAMETERS = [
5973
6291
  { code: "status", type: "token", jsonbPath: "$.status" },
@@ -6029,6 +6347,58 @@ var OBSERVATION_SEARCH_PARAMETERS = [
6029
6347
  { code: "part-of", type: "reference", jsonbPath: "$.partOf[*]" }
6030
6348
  ];
6031
6349
 
6350
+ // src/data/search/registry/organization-search-parameters.ts
6351
+ var ORGANIZATION_SEARCH_PARAMETERS = [
6352
+ { code: "active", type: "token", jsonbPath: "$.active" },
6353
+ {
6354
+ code: "address",
6355
+ type: "string",
6356
+ jsonbPath: "$.address[*].text",
6357
+ modifiers: ["exact", "contains", "missing", "not"]
6358
+ },
6359
+ {
6360
+ code: "address-city",
6361
+ type: "string",
6362
+ jsonbPath: "$.address[*].city",
6363
+ modifiers: ["exact", "contains", "missing", "not"]
6364
+ },
6365
+ {
6366
+ code: "address-country",
6367
+ type: "string",
6368
+ jsonbPath: "$.address[*].country",
6369
+ modifiers: ["exact", "contains", "missing", "not"]
6370
+ },
6371
+ {
6372
+ code: "address-postalcode",
6373
+ type: "string",
6374
+ jsonbPath: "$.address[*].postalCode",
6375
+ modifiers: ["exact", "contains", "missing", "not"]
6376
+ },
6377
+ {
6378
+ code: "address-state",
6379
+ type: "string",
6380
+ jsonbPath: "$.address[*].state",
6381
+ modifiers: ["exact", "contains", "missing", "not"]
6382
+ },
6383
+ { code: "address-use", type: "token", jsonbPath: "$.address[*].use" },
6384
+ { code: "endpoint", type: "reference", jsonbPath: "$.endpoint[*]" },
6385
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
6386
+ {
6387
+ code: "name",
6388
+ type: "string",
6389
+ jsonbPath: "$.name",
6390
+ modifiers: ["exact", "contains", "missing", "not"]
6391
+ },
6392
+ { code: "partof", type: "reference", jsonbPath: "$.partOf" },
6393
+ {
6394
+ code: "phonetic",
6395
+ type: "string",
6396
+ jsonbPath: "$.name",
6397
+ modifiers: ["exact", "contains", "missing", "not"]
6398
+ },
6399
+ { code: "type", type: "token", jsonbPath: "$.type[*]" }
6400
+ ];
6401
+
6032
6402
  // src/data/search/registry/patient-search-parameters.ts
6033
6403
  var PATIENT_SEARCH_PARAMETERS = [
6034
6404
  { code: "gender", type: "token", jsonbPath: "$.gender" },
@@ -6066,6 +6436,101 @@ var PATIENT_SEARCH_PARAMETERS = [
6066
6436
  }
6067
6437
  ];
6068
6438
 
6439
+ // src/data/search/registry/paymentnotice-search-parameters.ts
6440
+ var PAYMENTNOTICE_SEARCH_PARAMETERS = [
6441
+ { code: "created", type: "date", jsonbPath: "$.created" },
6442
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
6443
+ {
6444
+ code: "payment-status",
6445
+ type: "token",
6446
+ jsonbPath: "$.paymentStatus"
6447
+ },
6448
+ { code: "provider", type: "reference", jsonbPath: "$.provider" },
6449
+ { code: "request", type: "reference", jsonbPath: "$.request" },
6450
+ { code: "response", type: "reference", jsonbPath: "$.response" },
6451
+ { code: "status", type: "token", jsonbPath: "$.status" }
6452
+ ];
6453
+
6454
+ // src/data/search/registry/practitioner-search-parameters.ts
6455
+ var PRACTITIONER_SEARCH_PARAMETERS = [
6456
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
6457
+ {
6458
+ code: "name",
6459
+ type: "string",
6460
+ jsonbPath: "$.name[*].text",
6461
+ modifiers: ["exact", "contains", "missing", "not"]
6462
+ },
6463
+ {
6464
+ code: "family",
6465
+ type: "string",
6466
+ jsonbPath: "$.name[*].family",
6467
+ modifiers: ["exact", "contains", "missing", "not"]
6468
+ },
6469
+ {
6470
+ code: "given",
6471
+ type: "string",
6472
+ jsonbPath: "$.name[*].given",
6473
+ modifiers: ["exact", "contains", "missing", "not"]
6474
+ },
6475
+ { code: "active", type: "token", jsonbPath: "$.active" },
6476
+ { code: "gender", type: "token", jsonbPath: "$.gender" },
6477
+ { code: "email", type: "token", jsonbPath: "$.telecom[*]" },
6478
+ { code: "phone", type: "token", jsonbPath: "$.telecom[*]" },
6479
+ { code: "telecom", type: "token", jsonbPath: "$.telecom[*]" },
6480
+ {
6481
+ code: "address",
6482
+ type: "string",
6483
+ jsonbPath: "$.address[*].text",
6484
+ modifiers: ["exact", "contains", "missing", "not"]
6485
+ },
6486
+ {
6487
+ code: "address-city",
6488
+ type: "string",
6489
+ jsonbPath: "$.address[*].city",
6490
+ modifiers: ["exact", "contains", "missing", "not"]
6491
+ },
6492
+ {
6493
+ code: "address-country",
6494
+ type: "string",
6495
+ jsonbPath: "$.address[*].country",
6496
+ modifiers: ["exact", "contains", "missing", "not"]
6497
+ },
6498
+ {
6499
+ code: "address-postalcode",
6500
+ type: "string",
6501
+ jsonbPath: "$.address[*].postalCode",
6502
+ modifiers: ["exact", "contains", "missing", "not"]
6503
+ },
6504
+ {
6505
+ code: "address-state",
6506
+ type: "string",
6507
+ jsonbPath: "$.address[*].state",
6508
+ modifiers: ["exact", "contains", "missing", "not"]
6509
+ },
6510
+ { code: "communication", type: "token", jsonbPath: "$.communication[*]" }
6511
+ ];
6512
+
6513
+ // src/data/search/registry/practitionerrole-search-parameters.ts
6514
+ var PRACTITIONERROLE_SEARCH_PARAMETERS = [
6515
+ { code: "active", type: "token", jsonbPath: "$.active" },
6516
+ { code: "date", type: "date", jsonbPath: "$.period.start" },
6517
+ { code: "email", type: "token", jsonbPath: "$.telecom[*]" },
6518
+ { code: "phone", type: "token", jsonbPath: "$.telecom[*]" },
6519
+ { code: "telecom", type: "token", jsonbPath: "$.telecom[*]" },
6520
+ { code: "endpoint", type: "reference", jsonbPath: "$.endpoint[*]" },
6521
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
6522
+ { code: "location", type: "reference", jsonbPath: "$.location[*]" },
6523
+ { code: "organization", type: "reference", jsonbPath: "$.organization" },
6524
+ { code: "practitioner", type: "reference", jsonbPath: "$.practitioner" },
6525
+ { code: "role", type: "token", jsonbPath: "$.code[*]" },
6526
+ {
6527
+ code: "service",
6528
+ type: "reference",
6529
+ jsonbPath: "$.healthcareService[*]"
6530
+ },
6531
+ { code: "specialty", type: "token", jsonbPath: "$.specialty[*]" }
6532
+ ];
6533
+
6069
6534
  // src/data/search/registry/procedure-search-parameters.ts
6070
6535
  var PROCEDURE_SEARCH_PARAMETERS = [
6071
6536
  { code: "status", type: "token", jsonbPath: "$.status" },
@@ -6092,19 +6557,160 @@ var PROCEDURE_SEARCH_PARAMETERS = [
6092
6557
  }
6093
6558
  ];
6094
6559
 
6560
+ // src/data/search/registry/relatedperson-search-parameters.ts
6561
+ var RELATEDPERSON_SEARCH_PARAMETERS = [
6562
+ { code: "active", type: "token", jsonbPath: "$.active" },
6563
+ {
6564
+ code: "address",
6565
+ type: "string",
6566
+ jsonbPath: "$.address[*].text",
6567
+ modifiers: ["exact", "contains", "missing", "not"]
6568
+ },
6569
+ {
6570
+ code: "address-city",
6571
+ type: "string",
6572
+ jsonbPath: "$.address[*].city",
6573
+ modifiers: ["exact", "contains", "missing", "not"]
6574
+ },
6575
+ { code: "birthdate", type: "date", jsonbPath: "$.birthDate" },
6576
+ { code: "email", type: "token", jsonbPath: "$.telecom[*]" },
6577
+ { code: "phone", type: "token", jsonbPath: "$.telecom[*]" },
6578
+ { code: "telecom", type: "token", jsonbPath: "$.telecom[*]" },
6579
+ { code: "gender", type: "token", jsonbPath: "$.gender" },
6580
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
6581
+ {
6582
+ code: "name",
6583
+ type: "string",
6584
+ jsonbPath: "$.name[*].text",
6585
+ modifiers: ["exact", "contains", "missing", "not"]
6586
+ },
6587
+ { code: "patient", type: "reference", jsonbPath: "$.patient" },
6588
+ {
6589
+ code: "relationship",
6590
+ type: "token",
6591
+ jsonbPath: "$.relationship[*]"
6592
+ }
6593
+ ];
6594
+
6595
+ // src/data/search/registry/schedule-search-parameters.ts
6596
+ var SCHEDULE_SEARCH_PARAMETERS = [
6597
+ { code: "active", type: "token", jsonbPath: "$.active" },
6598
+ { code: "actor", type: "reference", jsonbPath: "$.actor[*]" },
6599
+ { code: "date", type: "date", jsonbPath: "$.planningHorizon.start" },
6600
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
6601
+ {
6602
+ code: "service-category",
6603
+ type: "token",
6604
+ jsonbPath: "$.serviceCategory[*]"
6605
+ },
6606
+ { code: "service-type", type: "token", jsonbPath: "$.serviceType[*]" },
6607
+ { code: "specialty", type: "token", jsonbPath: "$.specialty[*]" }
6608
+ ];
6609
+
6610
+ // src/data/search/registry/slot-search-parameters.ts
6611
+ var SLOT_SEARCH_PARAMETERS = [
6612
+ { code: "status", type: "token", jsonbPath: "$.status" },
6613
+ { code: "start", type: "date", jsonbPath: "$.start" },
6614
+ { code: "schedule", type: "reference", jsonbPath: "$.schedule" },
6615
+ {
6616
+ code: "appointment-type",
6617
+ type: "token",
6618
+ jsonbPath: "$.appointmentType"
6619
+ },
6620
+ {
6621
+ code: "service-category",
6622
+ type: "token",
6623
+ jsonbPath: "$.serviceCategory[*]"
6624
+ },
6625
+ { code: "service-type", type: "token", jsonbPath: "$.serviceType[*]" },
6626
+ { code: "specialty", type: "token", jsonbPath: "$.specialty[*]" },
6627
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" }
6628
+ ];
6629
+
6630
+ // src/data/search/registry/specimen-search-parameters.ts
6631
+ var SPECIMEN_SEARCH_PARAMETERS = [
6632
+ { code: "accession", type: "token", jsonbPath: "$.accessionIdentifier" },
6633
+ {
6634
+ code: "collected",
6635
+ type: "date",
6636
+ jsonbPath: "$.collection.collectedDateTime"
6637
+ },
6638
+ {
6639
+ code: "container-id",
6640
+ type: "token",
6641
+ jsonbPath: "$.container[*].identifier"
6642
+ },
6643
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" },
6644
+ { code: "parent", type: "reference", jsonbPath: "$.parent[*]" },
6645
+ { code: "patient", type: "reference", jsonbPath: "$.subject" },
6646
+ { code: "status", type: "token", jsonbPath: "$.status" },
6647
+ { code: "subject", type: "reference", jsonbPath: "$.subject" },
6648
+ { code: "type", type: "token", jsonbPath: "$.type" }
6649
+ ];
6650
+
6651
+ // src/data/search/registry/task-search-parameters.ts
6652
+ var TASK_SEARCH_PARAMETERS = [
6653
+ { code: "status", type: "token", jsonbPath: "$.status" },
6654
+ { code: "intent", type: "token", jsonbPath: "$.intent" },
6655
+ { code: "priority", type: "token", jsonbPath: "$.priority" },
6656
+ { code: "code", type: "token", jsonbPath: "$.code" },
6657
+ { code: "business-status", type: "token", jsonbPath: "$.businessStatus" },
6658
+ { code: "subject", type: "reference", jsonbPath: "$.for" },
6659
+ { code: "patient", type: "reference", jsonbPath: "$.for" },
6660
+ { code: "for", type: "reference", jsonbPath: "$.for" },
6661
+ { code: "encounter", type: "reference", jsonbPath: "$.encounter" },
6662
+ { code: "focus", type: "reference", jsonbPath: "$.focus" },
6663
+ { code: "owner", type: "reference", jsonbPath: "$.owner" },
6664
+ { code: "requester", type: "reference", jsonbPath: "$.requester" },
6665
+ { code: "performer", type: "token", jsonbPath: "$.performerType[*]" },
6666
+ { code: "based-on", type: "reference", jsonbPath: "$.basedOn[*]" },
6667
+ { code: "part-of", type: "reference", jsonbPath: "$.partOf[*]" },
6668
+ { code: "period", type: "date", jsonbPath: "$.executionPeriod.start" },
6669
+ { code: "authored-on", type: "date", jsonbPath: "$.authoredOn" },
6670
+ { code: "modified", type: "date", jsonbPath: "$.lastModified" },
6671
+ { code: "reason-code", type: "token", jsonbPath: "$.reasonCode" },
6672
+ {
6673
+ code: "reason-reference",
6674
+ type: "reference",
6675
+ jsonbPath: "$.reasonReference"
6676
+ },
6677
+ { code: "identifier", type: "token", jsonbPath: "$.identifier[*]" }
6678
+ ];
6679
+
6095
6680
  // src/data/search/registry/resolver.ts
6096
6681
  var STATIC_SEARCH_PARAMETER_MAP = {
6097
6682
  AllergyIntolerance: ALLERGYINTOLERANCE_SEARCH_PARAMETERS,
6098
6683
  Appointment: APPOINTMENT_SEARCH_PARAMETERS,
6684
+ ChargeItem: CHARGEITEM_SEARCH_PARAMETERS,
6685
+ Claim: CLAIM_SEARCH_PARAMETERS,
6686
+ Composition: COMPOSITION_SEARCH_PARAMETERS,
6099
6687
  Condition: CONDITION_SEARCH_PARAMETERS,
6688
+ Coverage: COVERAGE_SEARCH_PARAMETERS,
6689
+ DiagnosticReport: DIAGNOSTICREPORT_SEARCH_PARAMETERS,
6690
+ DocumentManifest: DOCUMENTMANIFEST_SEARCH_PARAMETERS,
6691
+ DocumentReference: DOCUMENTREFERENCE_SEARCH_PARAMETERS,
6100
6692
  Encounter: ENCOUNTER_SEARCH_PARAMETERS,
6693
+ Endpoint: ENDPOINT_SEARCH_PARAMETERS,
6694
+ ExplanationOfBenefit: EXPLANATIONOFBENEFIT_SEARCH_PARAMETERS,
6101
6695
  FamilyMemberHistory: FAMILYMEMBERHISTORY_SEARCH_PARAMETERS,
6696
+ ImagingStudy: IMAGINGSTUDY_SEARCH_PARAMETERS,
6102
6697
  Immunization: IMMUNIZATION_SEARCH_PARAMETERS,
6698
+ Invoice: INVOICE_SEARCH_PARAMETERS,
6699
+ Location: LOCATION_SEARCH_PARAMETERS,
6103
6700
  MedicationRequest: MEDICATIONREQUEST_SEARCH_PARAMETERS,
6104
6701
  MedicationStatement: MEDICATIONSTATEMENT_SEARCH_PARAMETERS,
6105
6702
  Observation: OBSERVATION_SEARCH_PARAMETERS,
6703
+ Organization: ORGANIZATION_SEARCH_PARAMETERS,
6106
6704
  Patient: PATIENT_SEARCH_PARAMETERS,
6107
- Procedure: PROCEDURE_SEARCH_PARAMETERS
6705
+ PaymentNotice: PAYMENTNOTICE_SEARCH_PARAMETERS,
6706
+ Practitioner: PRACTITIONER_SEARCH_PARAMETERS,
6707
+ PractitionerRole: PRACTITIONERROLE_SEARCH_PARAMETERS,
6708
+ Procedure: PROCEDURE_SEARCH_PARAMETERS,
6709
+ RelatedPerson: RELATEDPERSON_SEARCH_PARAMETERS,
6710
+ Schedule: SCHEDULE_SEARCH_PARAMETERS,
6711
+ Slot: SLOT_SEARCH_PARAMETERS,
6712
+ Specimen: SPECIMEN_SEARCH_PARAMETERS,
6713
+ Task: TASK_SEARCH_PARAMETERS
6108
6714
  };
6109
6715
  var defaultSearchParameterResolver = (resourceType, _tenantId) => STATIC_SEARCH_PARAMETER_MAP[resourceType] ?? [];
6110
6716
  function getRegisteredSearchParameters(resourceType) {
@@ -8495,63 +9101,159 @@ async function deleteChargeItemRoute(req, res) {
8495
9101
  } catch (err) {
8496
9102
  return sendOperationOutcome500(res, err, "DELETE ChargeItem error:");
8497
9103
  }
8498
- }
8499
-
8500
- // src/data/operations/data/chargeitem/chargeitem-get-by-id-operation.ts
8501
- async function getChargeItemByIdOperation(params) {
8502
- const { context, id, tableName } = params;
8503
- const { tenantId, workspaceId } = context;
8504
- const service = getDynamoDataService(tableName);
8505
- return getDataEntityById(
8506
- service.entities.chargeitem,
8507
- tenantId,
8508
- workspaceId,
8509
- id,
8510
- "ChargeItem"
9104
+ }
9105
+
9106
+ // src/data/operations/data/chargeitem/chargeitem-get-by-id-operation.ts
9107
+ async function getChargeItemByIdOperation(params) {
9108
+ const { context, id, tableName } = params;
9109
+ const { tenantId, workspaceId } = context;
9110
+ const service = getDynamoDataService(tableName);
9111
+ return getDataEntityById(
9112
+ service.entities.chargeitem,
9113
+ tenantId,
9114
+ workspaceId,
9115
+ id,
9116
+ "ChargeItem"
9117
+ );
9118
+ }
9119
+
9120
+ // src/data/rest-api/routes/data/chargeitem/chargeitem-get-by-id-route.ts
9121
+ async function getChargeItemByIdRoute(req, res) {
9122
+ const id = String(req.params.id);
9123
+ const ctx = req.openhiContext;
9124
+ try {
9125
+ const result = await getChargeItemByIdOperation({ context: ctx, id });
9126
+ return res.json(result.resource);
9127
+ } catch (err) {
9128
+ const status = domainErrorToHttpStatus(err);
9129
+ if (status === 404) {
9130
+ const diagnostics = err instanceof NotFoundError ? err.message : `ChargeItem ${id} not found`;
9131
+ return sendOperationOutcome404(res, diagnostics);
9132
+ }
9133
+ return sendOperationOutcome500(res, err, "GET ChargeItem error:");
9134
+ }
9135
+ }
9136
+
9137
+ // src/data/operations/data/chargeitem/chargeitem-list-operation.ts
9138
+ async function listChargeItemsOperation(params) {
9139
+ const { context, tableName, mode } = params;
9140
+ const { tenantId, workspaceId } = context;
9141
+ const service = getDynamoDataService(tableName);
9142
+ return listDataEntitiesByWorkspace(
9143
+ service.entities.chargeitem,
9144
+ tenantId,
9145
+ workspaceId,
9146
+ mode
9147
+ );
9148
+ }
9149
+
9150
+ // src/data/rest-api/routes/data/chargeitem/chargeitem-list-route.ts
9151
+ var CHARGEITEM_RESOURCE_TYPE = "ChargeItem";
9152
+ function stripModifier3(key) {
9153
+ const idx = key.indexOf(":");
9154
+ return idx === -1 ? key : key.slice(0, idx);
9155
+ }
9156
+ function isResultParameter3(key) {
9157
+ return key.startsWith("_");
9158
+ }
9159
+ function sendInvalidSearch4003(res, diagnostics) {
9160
+ return res.status(400).json({
9161
+ resourceType: "OperationOutcome",
9162
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
9163
+ });
9164
+ }
9165
+ function extractSearchParamKeys3(query) {
9166
+ const out = [];
9167
+ for (const rawKey of Object.keys(query)) {
9168
+ if (isResultParameter3(rawKey)) {
9169
+ continue;
9170
+ }
9171
+ out.push({ rawKey, code: stripModifier3(rawKey) });
9172
+ }
9173
+ return out;
9174
+ }
9175
+ function buildUnknownParamDiagnostics3(unknownCodes) {
9176
+ const validCodes = getRegisteredSearchParameters(CHARGEITEM_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
9177
+ const codes = unknownCodes.join(", ");
9178
+ const isPlural = unknownCodes.length !== 1;
9179
+ return [
9180
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for ChargeItem: ${codes}.`,
9181
+ `Valid codes: ${validCodes}.`
9182
+ ].join(" ");
9183
+ }
9184
+ function findMalformedReference3(query, searchParamKeys) {
9185
+ const referenceCodes = new Set(
9186
+ getRegisteredSearchParameters(CHARGEITEM_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
9187
+ );
9188
+ if (referenceCodes.size === 0) {
9189
+ return void 0;
9190
+ }
9191
+ for (const { rawKey, code } of searchParamKeys) {
9192
+ if (!referenceCodes.has(code)) {
9193
+ continue;
9194
+ }
9195
+ const raw = query[rawKey];
9196
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
9197
+ for (const v of values) {
9198
+ const trimmed = v.trim();
9199
+ if (trimmed.length === 0) {
9200
+ continue;
9201
+ }
9202
+ if (parseTypedReference(trimmed) === void 0) {
9203
+ return { rawKey, value: trimmed };
9204
+ }
9205
+ }
9206
+ }
9207
+ return void 0;
9208
+ }
9209
+ async function listChargeItemsRoute(req, res) {
9210
+ const searchParamKeys = extractSearchParamKeys3(
9211
+ req.query
9212
+ );
9213
+ if (searchParamKeys.length === 0) {
9214
+ return handleListRoute({
9215
+ req,
9216
+ res,
9217
+ basePath: BASE_PATH.CHARGEITEM,
9218
+ listOperation: listChargeItemsOperation,
9219
+ errorLogContext: "GET /ChargeItem list error:"
9220
+ });
9221
+ }
9222
+ const registered = getRegisteredSearchParameters(CHARGEITEM_RESOURCE_TYPE);
9223
+ const validCodes = new Set(registered.map((p) => p.code));
9224
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
9225
+ if (unknownCodes.length > 0) {
9226
+ return sendInvalidSearch4003(
9227
+ res,
9228
+ buildUnknownParamDiagnostics3([...new Set(unknownCodes)])
9229
+ );
9230
+ }
9231
+ const malformedRef = findMalformedReference3(
9232
+ req.query,
9233
+ searchParamKeys
8511
9234
  );
8512
- }
8513
-
8514
- // src/data/rest-api/routes/data/chargeitem/chargeitem-get-by-id-route.ts
8515
- async function getChargeItemByIdRoute(req, res) {
8516
- const id = String(req.params.id);
9235
+ if (malformedRef !== void 0) {
9236
+ return sendInvalidSearch4003(
9237
+ res,
9238
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
9239
+ );
9240
+ }
8517
9241
  const ctx = req.openhiContext;
8518
9242
  try {
8519
- const result = await getChargeItemByIdOperation({ context: ctx, id });
8520
- return res.json(result.resource);
9243
+ const result = await genericSearchOperation({
9244
+ resourceType: CHARGEITEM_RESOURCE_TYPE,
9245
+ tenantId: ctx.tenantId,
9246
+ workspaceId: ctx.workspaceId,
9247
+ query: req.query,
9248
+ resolver: defaultSearchParameterResolver
9249
+ });
9250
+ const bundle = buildSearchsetBundle(BASE_PATH.CHARGEITEM, result.entries);
9251
+ return res.json(bundle);
8521
9252
  } catch (err) {
8522
- const status = domainErrorToHttpStatus(err);
8523
- if (status === 404) {
8524
- const diagnostics = err instanceof NotFoundError ? err.message : `ChargeItem ${id} not found`;
8525
- return sendOperationOutcome404(res, diagnostics);
8526
- }
8527
- return sendOperationOutcome500(res, err, "GET ChargeItem error:");
9253
+ return sendOperationOutcome500(res, err, "GET /ChargeItem search error:");
8528
9254
  }
8529
9255
  }
8530
9256
 
8531
- // src/data/operations/data/chargeitem/chargeitem-list-operation.ts
8532
- async function listChargeItemsOperation(params) {
8533
- const { context, tableName, mode } = params;
8534
- const { tenantId, workspaceId } = context;
8535
- const service = getDynamoDataService(tableName);
8536
- return listDataEntitiesByWorkspace(
8537
- service.entities.chargeitem,
8538
- tenantId,
8539
- workspaceId,
8540
- mode
8541
- );
8542
- }
8543
-
8544
- // src/data/rest-api/routes/data/chargeitem/chargeitem-list-route.ts
8545
- async function listChargeItemsRoute(req, res) {
8546
- return handleListRoute({
8547
- req,
8548
- res,
8549
- basePath: BASE_PATH.CHARGEITEM,
8550
- listOperation: listChargeItemsOperation,
8551
- errorLogContext: "GET /ChargeItem list error:"
8552
- });
8553
- }
8554
-
8555
9257
  // src/data/operations/data/chargeitem/chargeitem-update-operation.ts
8556
9258
  async function updateChargeItemOperation(params) {
8557
9259
  const { context, id, body, tableName } = params;
@@ -8953,15 +9655,111 @@ async function listClaimsOperation(params) {
8953
9655
  }
8954
9656
 
8955
9657
  // src/data/rest-api/routes/data/claim/claim-list-route.ts
8956
- async function listClaimsRoute(req, res) {
8957
- return handleListRoute({
8958
- req,
8959
- res,
8960
- basePath: BASE_PATH.CLAIM,
8961
- listOperation: listClaimsOperation,
8962
- errorLogContext: "GET /Claim list error:"
9658
+ var CLAIM_RESOURCE_TYPE = "Claim";
9659
+ function stripModifier4(key) {
9660
+ const idx = key.indexOf(":");
9661
+ return idx === -1 ? key : key.slice(0, idx);
9662
+ }
9663
+ function isResultParameter4(key) {
9664
+ return key.startsWith("_");
9665
+ }
9666
+ function sendInvalidSearch4004(res, diagnostics) {
9667
+ return res.status(400).json({
9668
+ resourceType: "OperationOutcome",
9669
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
8963
9670
  });
8964
9671
  }
9672
+ function extractSearchParamKeys4(query) {
9673
+ const out = [];
9674
+ for (const rawKey of Object.keys(query)) {
9675
+ if (isResultParameter4(rawKey)) {
9676
+ continue;
9677
+ }
9678
+ out.push({ rawKey, code: stripModifier4(rawKey) });
9679
+ }
9680
+ return out;
9681
+ }
9682
+ function buildUnknownParamDiagnostics4(unknownCodes) {
9683
+ const validCodes = getRegisteredSearchParameters(CLAIM_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
9684
+ const codes = unknownCodes.join(", ");
9685
+ const isPlural = unknownCodes.length !== 1;
9686
+ return [
9687
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Claim: ${codes}.`,
9688
+ `Valid codes: ${validCodes}.`
9689
+ ].join(" ");
9690
+ }
9691
+ function findMalformedReference4(query, searchParamKeys) {
9692
+ const referenceCodes = new Set(
9693
+ getRegisteredSearchParameters(CLAIM_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
9694
+ );
9695
+ if (referenceCodes.size === 0) {
9696
+ return void 0;
9697
+ }
9698
+ for (const { rawKey, code } of searchParamKeys) {
9699
+ if (!referenceCodes.has(code)) {
9700
+ continue;
9701
+ }
9702
+ const raw = query[rawKey];
9703
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
9704
+ for (const v of values) {
9705
+ const trimmed = v.trim();
9706
+ if (trimmed.length === 0) {
9707
+ continue;
9708
+ }
9709
+ if (parseTypedReference(trimmed) === void 0) {
9710
+ return { rawKey, value: trimmed };
9711
+ }
9712
+ }
9713
+ }
9714
+ return void 0;
9715
+ }
9716
+ async function listClaimsRoute(req, res) {
9717
+ const searchParamKeys = extractSearchParamKeys4(
9718
+ req.query
9719
+ );
9720
+ if (searchParamKeys.length === 0) {
9721
+ return handleListRoute({
9722
+ req,
9723
+ res,
9724
+ basePath: BASE_PATH.CLAIM,
9725
+ listOperation: listClaimsOperation,
9726
+ errorLogContext: "GET /Claim list error:"
9727
+ });
9728
+ }
9729
+ const registered = getRegisteredSearchParameters(CLAIM_RESOURCE_TYPE);
9730
+ const validCodes = new Set(registered.map((p) => p.code));
9731
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
9732
+ if (unknownCodes.length > 0) {
9733
+ return sendInvalidSearch4004(
9734
+ res,
9735
+ buildUnknownParamDiagnostics4([...new Set(unknownCodes)])
9736
+ );
9737
+ }
9738
+ const malformedRef = findMalformedReference4(
9739
+ req.query,
9740
+ searchParamKeys
9741
+ );
9742
+ if (malformedRef !== void 0) {
9743
+ return sendInvalidSearch4004(
9744
+ res,
9745
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
9746
+ );
9747
+ }
9748
+ const ctx = req.openhiContext;
9749
+ try {
9750
+ const result = await genericSearchOperation({
9751
+ resourceType: CLAIM_RESOURCE_TYPE,
9752
+ tenantId: ctx.tenantId,
9753
+ workspaceId: ctx.workspaceId,
9754
+ query: req.query,
9755
+ resolver: defaultSearchParameterResolver
9756
+ });
9757
+ const bundle = buildSearchsetBundle(BASE_PATH.CLAIM, result.entries);
9758
+ return res.json(bundle);
9759
+ } catch (err) {
9760
+ return sendOperationOutcome500(res, err, "GET /Claim search error:");
9761
+ }
9762
+ }
8965
9763
 
8966
9764
  // src/data/operations/data/claim/claim-update-operation.ts
8967
9765
  async function updateClaimOperation(params) {
@@ -10390,15 +11188,111 @@ async function listCompositionsOperation(params) {
10390
11188
  }
10391
11189
 
10392
11190
  // src/data/rest-api/routes/data/composition/composition-list-route.ts
10393
- async function listCompositionsRoute(req, res) {
10394
- return handleListRoute({
10395
- req,
10396
- res,
10397
- basePath: BASE_PATH.COMPOSITION,
10398
- listOperation: listCompositionsOperation,
10399
- errorLogContext: "GET /Composition list error:"
11191
+ var COMPOSITION_RESOURCE_TYPE = "Composition";
11192
+ function stripModifier5(key) {
11193
+ const idx = key.indexOf(":");
11194
+ return idx === -1 ? key : key.slice(0, idx);
11195
+ }
11196
+ function isResultParameter5(key) {
11197
+ return key.startsWith("_");
11198
+ }
11199
+ function sendInvalidSearch4005(res, diagnostics) {
11200
+ return res.status(400).json({
11201
+ resourceType: "OperationOutcome",
11202
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
10400
11203
  });
10401
11204
  }
11205
+ function extractSearchParamKeys5(query) {
11206
+ const out = [];
11207
+ for (const rawKey of Object.keys(query)) {
11208
+ if (isResultParameter5(rawKey)) {
11209
+ continue;
11210
+ }
11211
+ out.push({ rawKey, code: stripModifier5(rawKey) });
11212
+ }
11213
+ return out;
11214
+ }
11215
+ function buildUnknownParamDiagnostics5(unknownCodes) {
11216
+ const validCodes = getRegisteredSearchParameters(COMPOSITION_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
11217
+ const codes = unknownCodes.join(", ");
11218
+ const isPlural = unknownCodes.length !== 1;
11219
+ return [
11220
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Composition: ${codes}.`,
11221
+ `Valid codes: ${validCodes}.`
11222
+ ].join(" ");
11223
+ }
11224
+ function findMalformedReference5(query, searchParamKeys) {
11225
+ const referenceCodes = new Set(
11226
+ getRegisteredSearchParameters(COMPOSITION_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
11227
+ );
11228
+ if (referenceCodes.size === 0) {
11229
+ return void 0;
11230
+ }
11231
+ for (const { rawKey, code } of searchParamKeys) {
11232
+ if (!referenceCodes.has(code)) {
11233
+ continue;
11234
+ }
11235
+ const raw = query[rawKey];
11236
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
11237
+ for (const v of values) {
11238
+ const trimmed = v.trim();
11239
+ if (trimmed.length === 0) {
11240
+ continue;
11241
+ }
11242
+ if (parseTypedReference(trimmed) === void 0) {
11243
+ return { rawKey, value: trimmed };
11244
+ }
11245
+ }
11246
+ }
11247
+ return void 0;
11248
+ }
11249
+ async function listCompositionsRoute(req, res) {
11250
+ const searchParamKeys = extractSearchParamKeys5(
11251
+ req.query
11252
+ );
11253
+ if (searchParamKeys.length === 0) {
11254
+ return handleListRoute({
11255
+ req,
11256
+ res,
11257
+ basePath: BASE_PATH.COMPOSITION,
11258
+ listOperation: listCompositionsOperation,
11259
+ errorLogContext: "GET /Composition list error:"
11260
+ });
11261
+ }
11262
+ const registered = getRegisteredSearchParameters(COMPOSITION_RESOURCE_TYPE);
11263
+ const validCodes = new Set(registered.map((p) => p.code));
11264
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
11265
+ if (unknownCodes.length > 0) {
11266
+ return sendInvalidSearch4005(
11267
+ res,
11268
+ buildUnknownParamDiagnostics5([...new Set(unknownCodes)])
11269
+ );
11270
+ }
11271
+ const malformedRef = findMalformedReference5(
11272
+ req.query,
11273
+ searchParamKeys
11274
+ );
11275
+ if (malformedRef !== void 0) {
11276
+ return sendInvalidSearch4005(
11277
+ res,
11278
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
11279
+ );
11280
+ }
11281
+ const ctx = req.openhiContext;
11282
+ try {
11283
+ const result = await genericSearchOperation({
11284
+ resourceType: COMPOSITION_RESOURCE_TYPE,
11285
+ tenantId: ctx.tenantId,
11286
+ workspaceId: ctx.workspaceId,
11287
+ query: req.query,
11288
+ resolver: defaultSearchParameterResolver
11289
+ });
11290
+ const bundle = buildSearchsetBundle(BASE_PATH.COMPOSITION, result.entries);
11291
+ return res.json(bundle);
11292
+ } catch (err) {
11293
+ return sendOperationOutcome500(res, err, "GET /Composition search error:");
11294
+ }
11295
+ }
10402
11296
 
10403
11297
  // src/data/operations/data/composition/composition-update-operation.ts
10404
11298
  async function updateCompositionOperation(params) {
@@ -10791,30 +11685,30 @@ async function listConditionsOperation(params) {
10791
11685
 
10792
11686
  // src/data/rest-api/routes/data/condition/condition-list-route.ts
10793
11687
  var CONDITION_RESOURCE_TYPE = "Condition";
10794
- function stripModifier3(key) {
11688
+ function stripModifier6(key) {
10795
11689
  const idx = key.indexOf(":");
10796
11690
  return idx === -1 ? key : key.slice(0, idx);
10797
11691
  }
10798
- function isResultParameter3(key) {
11692
+ function isResultParameter6(key) {
10799
11693
  return key.startsWith("_");
10800
11694
  }
10801
- function sendInvalidSearch4003(res, diagnostics) {
11695
+ function sendInvalidSearch4006(res, diagnostics) {
10802
11696
  return res.status(400).json({
10803
11697
  resourceType: "OperationOutcome",
10804
11698
  issue: [{ severity: "error", code: "invalid", diagnostics }]
10805
11699
  });
10806
11700
  }
10807
- function extractSearchParamKeys3(query) {
11701
+ function extractSearchParamKeys6(query) {
10808
11702
  const out = [];
10809
11703
  for (const rawKey of Object.keys(query)) {
10810
- if (isResultParameter3(rawKey)) {
11704
+ if (isResultParameter6(rawKey)) {
10811
11705
  continue;
10812
11706
  }
10813
- out.push({ rawKey, code: stripModifier3(rawKey) });
11707
+ out.push({ rawKey, code: stripModifier6(rawKey) });
10814
11708
  }
10815
11709
  return out;
10816
11710
  }
10817
- function buildUnknownParamDiagnostics3(unknownCodes) {
11711
+ function buildUnknownParamDiagnostics6(unknownCodes) {
10818
11712
  const validCodes = getRegisteredSearchParameters(CONDITION_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
10819
11713
  const codes = unknownCodes.join(", ");
10820
11714
  const isPlural = unknownCodes.length !== 1;
@@ -10823,7 +11717,7 @@ function buildUnknownParamDiagnostics3(unknownCodes) {
10823
11717
  `Valid codes: ${validCodes}.`
10824
11718
  ].join(" ");
10825
11719
  }
10826
- function findMalformedReference3(query, searchParamKeys) {
11720
+ function findMalformedReference6(query, searchParamKeys) {
10827
11721
  const referenceCodes = new Set(
10828
11722
  getRegisteredSearchParameters(CONDITION_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
10829
11723
  );
@@ -10846,7 +11740,7 @@ function findMalformedReference3(query, searchParamKeys) {
10846
11740
  return void 0;
10847
11741
  }
10848
11742
  async function listConditionsRoute(req, res) {
10849
- const searchParamKeys = extractSearchParamKeys3(
11743
+ const searchParamKeys = extractSearchParamKeys6(
10850
11744
  req.query
10851
11745
  );
10852
11746
  if (searchParamKeys.length === 0) {
@@ -10862,17 +11756,17 @@ async function listConditionsRoute(req, res) {
10862
11756
  const validCodes = new Set(registered.map((p) => p.code));
10863
11757
  const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
10864
11758
  if (unknownCodes.length > 0) {
10865
- return sendInvalidSearch4003(
11759
+ return sendInvalidSearch4006(
10866
11760
  res,
10867
- buildUnknownParamDiagnostics3([...new Set(unknownCodes)])
11761
+ buildUnknownParamDiagnostics6([...new Set(unknownCodes)])
10868
11762
  );
10869
11763
  }
10870
- const malformedRef = findMalformedReference3(
11764
+ const malformedRef = findMalformedReference6(
10871
11765
  req.query,
10872
11766
  searchParamKeys
10873
11767
  );
10874
11768
  if (malformedRef !== void 0) {
10875
- return sendInvalidSearch4003(
11769
+ return sendInvalidSearch4006(
10876
11770
  res,
10877
11771
  `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
10878
11772
  );
@@ -11486,15 +12380,120 @@ async function listCoveragesOperation(params) {
11486
12380
  }
11487
12381
 
11488
12382
  // src/data/rest-api/routes/data/coverage/coverage-list-route.ts
11489
- async function listCoveragesRoute(req, res) {
11490
- return handleListRoute({
11491
- req,
11492
- res,
11493
- basePath: BASE_PATH.COVERAGE,
11494
- listOperation: listCoveragesOperation,
11495
- errorLogContext: "GET /Coverage list error:"
12383
+ var COVERAGE_RESOURCE_TYPE = "Coverage";
12384
+ function stripModifier7(key) {
12385
+ const idx = key.indexOf(":");
12386
+ return idx === -1 ? key : key.slice(0, idx);
12387
+ }
12388
+ function isResultParameter7(key) {
12389
+ return key.startsWith("_");
12390
+ }
12391
+ function sendInvalidSearch4007(res, diagnostics) {
12392
+ return res.status(400).json({
12393
+ resourceType: "OperationOutcome",
12394
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
11496
12395
  });
11497
12396
  }
12397
+ function extractSearchParamKeys7(query) {
12398
+ const out = [];
12399
+ for (const rawKey of Object.keys(query)) {
12400
+ if (isResultParameter7(rawKey)) {
12401
+ continue;
12402
+ }
12403
+ out.push({ rawKey, code: stripModifier7(rawKey) });
12404
+ }
12405
+ return out;
12406
+ }
12407
+ function buildUnknownParamDiagnostics7(unknownCodes) {
12408
+ const validCodes = getRegisteredSearchParameters(COVERAGE_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
12409
+ const codes = unknownCodes.join(", ");
12410
+ const isPlural = unknownCodes.length !== 1;
12411
+ return [
12412
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Coverage: ${codes}.`,
12413
+ `Valid codes: ${validCodes}.`
12414
+ ].join(" ");
12415
+ }
12416
+ function findMalformedReference7(query, searchParamKeys) {
12417
+ const referenceCodes = new Set(
12418
+ getRegisteredSearchParameters(COVERAGE_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
12419
+ );
12420
+ if (referenceCodes.size === 0) {
12421
+ return void 0;
12422
+ }
12423
+ for (const { rawKey, code } of searchParamKeys) {
12424
+ if (!referenceCodes.has(code)) {
12425
+ continue;
12426
+ }
12427
+ const raw = query[rawKey];
12428
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
12429
+ for (const v of values) {
12430
+ const trimmed = v.trim();
12431
+ if (trimmed.length === 0) {
12432
+ continue;
12433
+ }
12434
+ if (parseTypedReference(trimmed) === void 0) {
12435
+ return { rawKey, value: trimmed };
12436
+ }
12437
+ }
12438
+ }
12439
+ return void 0;
12440
+ }
12441
+ async function listCoveragesRoute(req, res) {
12442
+ const searchParamKeys = extractSearchParamKeys7(
12443
+ req.query
12444
+ );
12445
+ if (searchParamKeys.length === 0) {
12446
+ return handleListRoute({
12447
+ req,
12448
+ res,
12449
+ basePath: BASE_PATH.COVERAGE,
12450
+ listOperation: listCoveragesOperation,
12451
+ errorLogContext: "GET /Coverage list error:"
12452
+ });
12453
+ }
12454
+ const registered = getRegisteredSearchParameters(
12455
+ COVERAGE_RESOURCE_TYPE
12456
+ );
12457
+ const validCodes = new Set(registered.map((p) => p.code));
12458
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
12459
+ if (unknownCodes.length > 0) {
12460
+ return sendInvalidSearch4007(
12461
+ res,
12462
+ buildUnknownParamDiagnostics7([...new Set(unknownCodes)])
12463
+ );
12464
+ }
12465
+ const malformedRef = findMalformedReference7(
12466
+ req.query,
12467
+ searchParamKeys
12468
+ );
12469
+ if (malformedRef !== void 0) {
12470
+ return sendInvalidSearch4007(
12471
+ res,
12472
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
12473
+ );
12474
+ }
12475
+ const ctx = req.openhiContext;
12476
+ try {
12477
+ const result = await genericSearchOperation({
12478
+ resourceType: COVERAGE_RESOURCE_TYPE,
12479
+ tenantId: ctx.tenantId,
12480
+ workspaceId: ctx.workspaceId,
12481
+ query: req.query,
12482
+ resolver: defaultSearchParameterResolver
12483
+ });
12484
+ const bundle = buildSearchsetBundle(
12485
+ BASE_PATH.COVERAGE,
12486
+ result.entries
12487
+ );
12488
+ return res.json(bundle);
12489
+ } catch (err) {
12490
+ return sendOperationOutcome500(
12491
+ res,
12492
+ err,
12493
+ "GET /Coverage search error:"
12494
+ );
12495
+ }
12496
+ }
11498
12497
 
11499
12498
  // src/data/operations/data/coverage/coverage-update-operation.ts
11500
12499
  async function updateCoverageOperation(params) {
@@ -13308,39 +14307,146 @@ async function getDiagnosticReportByIdRoute(req, res) {
13308
14307
  const result = await getDiagnosticReportByIdOperation({ context: ctx, id });
13309
14308
  return res.json(result.resource);
13310
14309
  } catch (err) {
13311
- const status = domainErrorToHttpStatus(err);
13312
- if (status === 404) {
13313
- const diagnostics = err instanceof NotFoundError ? err.message : `DiagnosticReport ${id} not found`;
13314
- return sendOperationOutcome404(res, diagnostics);
13315
- }
13316
- return sendOperationOutcome500(res, err, "GET DiagnosticReport error:");
14310
+ const status = domainErrorToHttpStatus(err);
14311
+ if (status === 404) {
14312
+ const diagnostics = err instanceof NotFoundError ? err.message : `DiagnosticReport ${id} not found`;
14313
+ return sendOperationOutcome404(res, diagnostics);
14314
+ }
14315
+ return sendOperationOutcome500(res, err, "GET DiagnosticReport error:");
14316
+ }
14317
+ }
14318
+
14319
+ // src/data/operations/data/diagnosticreport/diagnosticreport-list-operation.ts
14320
+ async function listDiagnosticReportsOperation(params) {
14321
+ const { context, tableName, mode } = params;
14322
+ const { tenantId, workspaceId } = context;
14323
+ const service = getDynamoDataService(tableName);
14324
+ return listDataEntitiesByWorkspace(
14325
+ service.entities.diagnosticreport,
14326
+ tenantId,
14327
+ workspaceId,
14328
+ mode
14329
+ );
14330
+ }
14331
+
14332
+ // src/data/rest-api/routes/data/diagnosticreport/diagnosticreport-list-route.ts
14333
+ var DIAGNOSTICREPORT_RESOURCE_TYPE = "DiagnosticReport";
14334
+ function stripModifier8(key) {
14335
+ const idx = key.indexOf(":");
14336
+ return idx === -1 ? key : key.slice(0, idx);
14337
+ }
14338
+ function isResultParameter8(key) {
14339
+ return key.startsWith("_");
14340
+ }
14341
+ function sendInvalidSearch4008(res, diagnostics) {
14342
+ return res.status(400).json({
14343
+ resourceType: "OperationOutcome",
14344
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
14345
+ });
14346
+ }
14347
+ function extractSearchParamKeys8(query) {
14348
+ const out = [];
14349
+ for (const rawKey of Object.keys(query)) {
14350
+ if (isResultParameter8(rawKey)) {
14351
+ continue;
14352
+ }
14353
+ out.push({ rawKey, code: stripModifier8(rawKey) });
14354
+ }
14355
+ return out;
14356
+ }
14357
+ function buildUnknownParamDiagnostics8(unknownCodes) {
14358
+ const validCodes = getRegisteredSearchParameters(
14359
+ DIAGNOSTICREPORT_RESOURCE_TYPE
14360
+ ).map((p) => p.code).sort().join(", ");
14361
+ const codes = unknownCodes.join(", ");
14362
+ const isPlural = unknownCodes.length !== 1;
14363
+ return [
14364
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for DiagnosticReport: ${codes}.`,
14365
+ `Valid codes: ${validCodes}.`
14366
+ ].join(" ");
14367
+ }
14368
+ function findMalformedReference8(query, searchParamKeys) {
14369
+ const referenceCodes = new Set(
14370
+ getRegisteredSearchParameters(DIAGNOSTICREPORT_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
14371
+ );
14372
+ if (referenceCodes.size === 0) {
14373
+ return void 0;
14374
+ }
14375
+ for (const { rawKey, code } of searchParamKeys) {
14376
+ if (!referenceCodes.has(code)) {
14377
+ continue;
14378
+ }
14379
+ const raw = query[rawKey];
14380
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
14381
+ for (const v of values) {
14382
+ const trimmed = v.trim();
14383
+ if (trimmed.length === 0) {
14384
+ continue;
14385
+ }
14386
+ if (parseTypedReference(trimmed) === void 0) {
14387
+ return { rawKey, value: trimmed };
14388
+ }
14389
+ }
14390
+ }
14391
+ return void 0;
14392
+ }
14393
+ async function listDiagnosticReportsRoute(req, res) {
14394
+ const searchParamKeys = extractSearchParamKeys8(
14395
+ req.query
14396
+ );
14397
+ if (searchParamKeys.length === 0) {
14398
+ return handleListRoute({
14399
+ req,
14400
+ res,
14401
+ basePath: BASE_PATH.DIAGNOSTICREPORT,
14402
+ listOperation: listDiagnosticReportsOperation,
14403
+ errorLogContext: "GET /DiagnosticReport list error:"
14404
+ });
14405
+ }
14406
+ const registered = getRegisteredSearchParameters(
14407
+ DIAGNOSTICREPORT_RESOURCE_TYPE
14408
+ );
14409
+ const validCodes = new Set(registered.map((p) => p.code));
14410
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
14411
+ if (unknownCodes.length > 0) {
14412
+ return sendInvalidSearch4008(
14413
+ res,
14414
+ buildUnknownParamDiagnostics8([...new Set(unknownCodes)])
14415
+ );
14416
+ }
14417
+ const malformedRef = findMalformedReference8(
14418
+ req.query,
14419
+ searchParamKeys
14420
+ );
14421
+ if (malformedRef !== void 0) {
14422
+ return sendInvalidSearch4008(
14423
+ res,
14424
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
14425
+ );
14426
+ }
14427
+ const ctx = req.openhiContext;
14428
+ try {
14429
+ const result = await genericSearchOperation({
14430
+ resourceType: DIAGNOSTICREPORT_RESOURCE_TYPE,
14431
+ tenantId: ctx.tenantId,
14432
+ workspaceId: ctx.workspaceId,
14433
+ query: req.query,
14434
+ resolver: defaultSearchParameterResolver
14435
+ });
14436
+ const bundle = buildSearchsetBundle(
14437
+ BASE_PATH.DIAGNOSTICREPORT,
14438
+ result.entries
14439
+ );
14440
+ return res.json(bundle);
14441
+ } catch (err) {
14442
+ return sendOperationOutcome500(
14443
+ res,
14444
+ err,
14445
+ "GET /DiagnosticReport search error:"
14446
+ );
13317
14447
  }
13318
14448
  }
13319
14449
 
13320
- // src/data/operations/data/diagnosticreport/diagnosticreport-list-operation.ts
13321
- async function listDiagnosticReportsOperation(params) {
13322
- const { context, tableName, mode } = params;
13323
- const { tenantId, workspaceId } = context;
13324
- const service = getDynamoDataService(tableName);
13325
- return listDataEntitiesByWorkspace(
13326
- service.entities.diagnosticreport,
13327
- tenantId,
13328
- workspaceId,
13329
- mode
13330
- );
13331
- }
13332
-
13333
- // src/data/rest-api/routes/data/diagnosticreport/diagnosticreport-list-route.ts
13334
- async function listDiagnosticReportsRoute(req, res) {
13335
- return handleListRoute({
13336
- req,
13337
- res,
13338
- basePath: BASE_PATH.DIAGNOSTICREPORT,
13339
- listOperation: listDiagnosticReportsOperation,
13340
- errorLogContext: "GET /DiagnosticReport list error:"
13341
- });
13342
- }
13343
-
13344
14450
  // src/data/operations/data/diagnosticreport/diagnosticreport-update-operation.ts
13345
14451
  async function updateDiagnosticReportOperation(params) {
13346
14452
  const { context, id, body, tableName } = params;
@@ -13531,15 +14637,122 @@ async function listDocumentManifestsOperation(params) {
13531
14637
  }
13532
14638
 
13533
14639
  // src/data/rest-api/routes/data/documentmanifest/documentmanifest-list-route.ts
13534
- async function listDocumentManifestsRoute(req, res) {
13535
- return handleListRoute({
13536
- req,
13537
- res,
13538
- basePath: BASE_PATH.DOCUMENTMANIFEST,
13539
- listOperation: listDocumentManifestsOperation,
13540
- errorLogContext: "GET /DocumentManifest list error:"
14640
+ var DOCUMENTMANIFEST_RESOURCE_TYPE = "DocumentManifest";
14641
+ function stripModifier9(key) {
14642
+ const idx = key.indexOf(":");
14643
+ return idx === -1 ? key : key.slice(0, idx);
14644
+ }
14645
+ function isResultParameter9(key) {
14646
+ return key.startsWith("_");
14647
+ }
14648
+ function sendInvalidSearch4009(res, diagnostics) {
14649
+ return res.status(400).json({
14650
+ resourceType: "OperationOutcome",
14651
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
13541
14652
  });
13542
14653
  }
14654
+ function extractSearchParamKeys9(query) {
14655
+ const out = [];
14656
+ for (const rawKey of Object.keys(query)) {
14657
+ if (isResultParameter9(rawKey)) {
14658
+ continue;
14659
+ }
14660
+ out.push({ rawKey, code: stripModifier9(rawKey) });
14661
+ }
14662
+ return out;
14663
+ }
14664
+ function buildUnknownParamDiagnostics9(unknownCodes) {
14665
+ const validCodes = getRegisteredSearchParameters(
14666
+ DOCUMENTMANIFEST_RESOURCE_TYPE
14667
+ ).map((p) => p.code).sort().join(", ");
14668
+ const codes = unknownCodes.join(", ");
14669
+ const isPlural = unknownCodes.length !== 1;
14670
+ return [
14671
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for DocumentManifest: ${codes}.`,
14672
+ `Valid codes: ${validCodes}.`
14673
+ ].join(" ");
14674
+ }
14675
+ function findMalformedReference9(query, searchParamKeys) {
14676
+ const referenceCodes = new Set(
14677
+ getRegisteredSearchParameters(DOCUMENTMANIFEST_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
14678
+ );
14679
+ if (referenceCodes.size === 0) {
14680
+ return void 0;
14681
+ }
14682
+ for (const { rawKey, code } of searchParamKeys) {
14683
+ if (!referenceCodes.has(code)) {
14684
+ continue;
14685
+ }
14686
+ const raw = query[rawKey];
14687
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
14688
+ for (const v of values) {
14689
+ const trimmed = v.trim();
14690
+ if (trimmed.length === 0) {
14691
+ continue;
14692
+ }
14693
+ if (parseTypedReference(trimmed) === void 0) {
14694
+ return { rawKey, value: trimmed };
14695
+ }
14696
+ }
14697
+ }
14698
+ return void 0;
14699
+ }
14700
+ async function listDocumentManifestsRoute(req, res) {
14701
+ const searchParamKeys = extractSearchParamKeys9(
14702
+ req.query
14703
+ );
14704
+ if (searchParamKeys.length === 0) {
14705
+ return handleListRoute({
14706
+ req,
14707
+ res,
14708
+ basePath: BASE_PATH.DOCUMENTMANIFEST,
14709
+ listOperation: listDocumentManifestsOperation,
14710
+ errorLogContext: "GET /DocumentManifest list error:"
14711
+ });
14712
+ }
14713
+ const registered = getRegisteredSearchParameters(
14714
+ DOCUMENTMANIFEST_RESOURCE_TYPE
14715
+ );
14716
+ const validCodes = new Set(registered.map((p) => p.code));
14717
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
14718
+ if (unknownCodes.length > 0) {
14719
+ return sendInvalidSearch4009(
14720
+ res,
14721
+ buildUnknownParamDiagnostics9([...new Set(unknownCodes)])
14722
+ );
14723
+ }
14724
+ const malformedRef = findMalformedReference9(
14725
+ req.query,
14726
+ searchParamKeys
14727
+ );
14728
+ if (malformedRef !== void 0) {
14729
+ return sendInvalidSearch4009(
14730
+ res,
14731
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
14732
+ );
14733
+ }
14734
+ const ctx = req.openhiContext;
14735
+ try {
14736
+ const result = await genericSearchOperation({
14737
+ resourceType: DOCUMENTMANIFEST_RESOURCE_TYPE,
14738
+ tenantId: ctx.tenantId,
14739
+ workspaceId: ctx.workspaceId,
14740
+ query: req.query,
14741
+ resolver: defaultSearchParameterResolver
14742
+ });
14743
+ const bundle = buildSearchsetBundle(
14744
+ BASE_PATH.DOCUMENTMANIFEST,
14745
+ result.entries
14746
+ );
14747
+ return res.json(bundle);
14748
+ } catch (err) {
14749
+ return sendOperationOutcome500(
14750
+ res,
14751
+ err,
14752
+ "GET /DocumentManifest search error:"
14753
+ );
14754
+ }
14755
+ }
13543
14756
 
13544
14757
  // src/data/operations/data/documentmanifest/documentmanifest-update-operation.ts
13545
14758
  async function updateDocumentManifestOperation(params) {
@@ -13705,45 +14918,152 @@ async function getDocumentReferenceByIdRoute(req, res) {
13705
14918
  const id = String(req.params.id);
13706
14919
  const ctx = req.openhiContext;
13707
14920
  try {
13708
- const result = await getDocumentReferenceByIdOperation({
13709
- context: ctx,
13710
- id
14921
+ const result = await getDocumentReferenceByIdOperation({
14922
+ context: ctx,
14923
+ id
14924
+ });
14925
+ return res.json(result.resource);
14926
+ } catch (err) {
14927
+ const status = domainErrorToHttpStatus(err);
14928
+ if (status === 404) {
14929
+ const diagnostics = err instanceof NotFoundError ? err.message : `DocumentReference ${id} not found`;
14930
+ return sendOperationOutcome404(res, diagnostics);
14931
+ }
14932
+ return sendOperationOutcome500(res, err, "GET DocumentReference error:");
14933
+ }
14934
+ }
14935
+
14936
+ // src/data/operations/data/documentreference/documentreference-list-operation.ts
14937
+ async function listDocumentReferencesOperation(params) {
14938
+ const { context, tableName, mode } = params;
14939
+ const { tenantId, workspaceId } = context;
14940
+ const service = getDynamoDataService(tableName);
14941
+ return listDataEntitiesByWorkspace(
14942
+ service.entities.documentreference,
14943
+ tenantId,
14944
+ workspaceId,
14945
+ mode
14946
+ );
14947
+ }
14948
+
14949
+ // src/data/rest-api/routes/data/documentreference/documentreference-list-route.ts
14950
+ var DOCUMENTREFERENCE_RESOURCE_TYPE = "DocumentReference";
14951
+ function stripModifier10(key) {
14952
+ const idx = key.indexOf(":");
14953
+ return idx === -1 ? key : key.slice(0, idx);
14954
+ }
14955
+ function isResultParameter10(key) {
14956
+ return key.startsWith("_");
14957
+ }
14958
+ function sendInvalidSearch40010(res, diagnostics) {
14959
+ return res.status(400).json({
14960
+ resourceType: "OperationOutcome",
14961
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
14962
+ });
14963
+ }
14964
+ function extractSearchParamKeys10(query) {
14965
+ const out = [];
14966
+ for (const rawKey of Object.keys(query)) {
14967
+ if (isResultParameter10(rawKey)) {
14968
+ continue;
14969
+ }
14970
+ out.push({ rawKey, code: stripModifier10(rawKey) });
14971
+ }
14972
+ return out;
14973
+ }
14974
+ function buildUnknownParamDiagnostics10(unknownCodes) {
14975
+ const validCodes = getRegisteredSearchParameters(
14976
+ DOCUMENTREFERENCE_RESOURCE_TYPE
14977
+ ).map((p) => p.code).sort().join(", ");
14978
+ const codes = unknownCodes.join(", ");
14979
+ const isPlural = unknownCodes.length !== 1;
14980
+ return [
14981
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for DocumentReference: ${codes}.`,
14982
+ `Valid codes: ${validCodes}.`
14983
+ ].join(" ");
14984
+ }
14985
+ function findMalformedReference10(query, searchParamKeys) {
14986
+ const referenceCodes = new Set(
14987
+ getRegisteredSearchParameters(DOCUMENTREFERENCE_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
14988
+ );
14989
+ if (referenceCodes.size === 0) {
14990
+ return void 0;
14991
+ }
14992
+ for (const { rawKey, code } of searchParamKeys) {
14993
+ if (!referenceCodes.has(code)) {
14994
+ continue;
14995
+ }
14996
+ const raw = query[rawKey];
14997
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
14998
+ for (const v of values) {
14999
+ const trimmed = v.trim();
15000
+ if (trimmed.length === 0) {
15001
+ continue;
15002
+ }
15003
+ if (parseTypedReference(trimmed) === void 0) {
15004
+ return { rawKey, value: trimmed };
15005
+ }
15006
+ }
15007
+ }
15008
+ return void 0;
15009
+ }
15010
+ async function listDocumentReferencesRoute(req, res) {
15011
+ const searchParamKeys = extractSearchParamKeys10(
15012
+ req.query
15013
+ );
15014
+ if (searchParamKeys.length === 0) {
15015
+ return handleListRoute({
15016
+ req,
15017
+ res,
15018
+ basePath: BASE_PATH.DOCUMENTREFERENCE,
15019
+ listOperation: listDocumentReferencesOperation,
15020
+ errorLogContext: "GET /DocumentReference list error:"
15021
+ });
15022
+ }
15023
+ const registered = getRegisteredSearchParameters(
15024
+ DOCUMENTREFERENCE_RESOURCE_TYPE
15025
+ );
15026
+ const validCodes = new Set(registered.map((p) => p.code));
15027
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
15028
+ if (unknownCodes.length > 0) {
15029
+ return sendInvalidSearch40010(
15030
+ res,
15031
+ buildUnknownParamDiagnostics10([...new Set(unknownCodes)])
15032
+ );
15033
+ }
15034
+ const malformedRef = findMalformedReference10(
15035
+ req.query,
15036
+ searchParamKeys
15037
+ );
15038
+ if (malformedRef !== void 0) {
15039
+ return sendInvalidSearch40010(
15040
+ res,
15041
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
15042
+ );
15043
+ }
15044
+ const ctx = req.openhiContext;
15045
+ try {
15046
+ const result = await genericSearchOperation({
15047
+ resourceType: DOCUMENTREFERENCE_RESOURCE_TYPE,
15048
+ tenantId: ctx.tenantId,
15049
+ workspaceId: ctx.workspaceId,
15050
+ query: req.query,
15051
+ resolver: defaultSearchParameterResolver
13711
15052
  });
13712
- return res.json(result.resource);
15053
+ const bundle = buildSearchsetBundle(
15054
+ BASE_PATH.DOCUMENTREFERENCE,
15055
+ result.entries
15056
+ );
15057
+ return res.json(bundle);
13713
15058
  } catch (err) {
13714
- const status = domainErrorToHttpStatus(err);
13715
- if (status === 404) {
13716
- const diagnostics = err instanceof NotFoundError ? err.message : `DocumentReference ${id} not found`;
13717
- return sendOperationOutcome404(res, diagnostics);
13718
- }
13719
- return sendOperationOutcome500(res, err, "GET DocumentReference error:");
15059
+ return sendOperationOutcome500(
15060
+ res,
15061
+ err,
15062
+ "GET /DocumentReference search error:"
15063
+ );
13720
15064
  }
13721
15065
  }
13722
15066
 
13723
- // src/data/operations/data/documentreference/documentreference-list-operation.ts
13724
- async function listDocumentReferencesOperation(params) {
13725
- const { context, tableName, mode } = params;
13726
- const { tenantId, workspaceId } = context;
13727
- const service = getDynamoDataService(tableName);
13728
- return listDataEntitiesByWorkspace(
13729
- service.entities.documentreference,
13730
- tenantId,
13731
- workspaceId,
13732
- mode
13733
- );
13734
- }
13735
-
13736
- // src/data/rest-api/routes/data/documentreference/documentreference-list-route.ts
13737
- async function listDocumentReferencesRoute(req, res) {
13738
- return handleListRoute({
13739
- req,
13740
- res,
13741
- basePath: BASE_PATH.DOCUMENTREFERENCE,
13742
- listOperation: listDocumentReferencesOperation,
13743
- errorLogContext: "GET /DocumentReference list error:"
13744
- });
13745
- }
13746
-
13747
15067
  // src/data/operations/data/documentreference/documentreference-update-operation.ts
13748
15068
  async function updateDocumentReferenceOperation(params) {
13749
15069
  const { context, id, body, tableName } = params;
@@ -14119,30 +15439,30 @@ async function listEncountersOperation(params) {
14119
15439
 
14120
15440
  // src/data/rest-api/routes/data/encounter/encounter-list-route.ts
14121
15441
  var ENCOUNTER_RESOURCE_TYPE = "Encounter";
14122
- function stripModifier4(key) {
15442
+ function stripModifier11(key) {
14123
15443
  const idx = key.indexOf(":");
14124
15444
  return idx === -1 ? key : key.slice(0, idx);
14125
15445
  }
14126
- function isResultParameter4(key) {
15446
+ function isResultParameter11(key) {
14127
15447
  return key.startsWith("_");
14128
15448
  }
14129
- function sendInvalidSearch4004(res, diagnostics) {
15449
+ function sendInvalidSearch40011(res, diagnostics) {
14130
15450
  return res.status(400).json({
14131
15451
  resourceType: "OperationOutcome",
14132
15452
  issue: [{ severity: "error", code: "invalid", diagnostics }]
14133
15453
  });
14134
15454
  }
14135
- function extractSearchParamKeys4(query) {
15455
+ function extractSearchParamKeys11(query) {
14136
15456
  const out = [];
14137
15457
  for (const rawKey of Object.keys(query)) {
14138
- if (isResultParameter4(rawKey)) {
15458
+ if (isResultParameter11(rawKey)) {
14139
15459
  continue;
14140
15460
  }
14141
- out.push({ rawKey, code: stripModifier4(rawKey) });
15461
+ out.push({ rawKey, code: stripModifier11(rawKey) });
14142
15462
  }
14143
15463
  return out;
14144
15464
  }
14145
- function buildUnknownParamDiagnostics4(unknownCodes) {
15465
+ function buildUnknownParamDiagnostics11(unknownCodes) {
14146
15466
  const validCodes = getRegisteredSearchParameters(ENCOUNTER_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
14147
15467
  const codes = unknownCodes.join(", ");
14148
15468
  const isPlural = unknownCodes.length !== 1;
@@ -14151,7 +15471,7 @@ function buildUnknownParamDiagnostics4(unknownCodes) {
14151
15471
  `Valid codes: ${validCodes}.`
14152
15472
  ].join(" ");
14153
15473
  }
14154
- function findMalformedReference4(query, searchParamKeys) {
15474
+ function findMalformedReference11(query, searchParamKeys) {
14155
15475
  const referenceCodes = new Set(
14156
15476
  getRegisteredSearchParameters(ENCOUNTER_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
14157
15477
  );
@@ -14174,7 +15494,7 @@ function findMalformedReference4(query, searchParamKeys) {
14174
15494
  return void 0;
14175
15495
  }
14176
15496
  async function listEncountersRoute(req, res) {
14177
- const searchParamKeys = extractSearchParamKeys4(
15497
+ const searchParamKeys = extractSearchParamKeys11(
14178
15498
  req.query
14179
15499
  );
14180
15500
  if (searchParamKeys.length === 0) {
@@ -14190,17 +15510,17 @@ async function listEncountersRoute(req, res) {
14190
15510
  const validCodes = new Set(registered.map((p) => p.code));
14191
15511
  const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
14192
15512
  if (unknownCodes.length > 0) {
14193
- return sendInvalidSearch4004(
15513
+ return sendInvalidSearch40011(
14194
15514
  res,
14195
- buildUnknownParamDiagnostics4([...new Set(unknownCodes)])
15515
+ buildUnknownParamDiagnostics11([...new Set(unknownCodes)])
14196
15516
  );
14197
15517
  }
14198
- const malformedRef = findMalformedReference4(
15518
+ const malformedRef = findMalformedReference11(
14199
15519
  req.query,
14200
15520
  searchParamKeys
14201
15521
  );
14202
15522
  if (malformedRef !== void 0) {
14203
- return sendInvalidSearch4004(
15523
+ return sendInvalidSearch40011(
14204
15524
  res,
14205
15525
  `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
14206
15526
  );
@@ -14416,15 +15736,111 @@ async function listEndpointsOperation(params) {
14416
15736
  }
14417
15737
 
14418
15738
  // src/data/rest-api/routes/data/endpoint/endpoint-list-route.ts
14419
- async function listEndpointsRoute(req, res) {
14420
- return handleListRoute({
14421
- req,
14422
- res,
14423
- basePath: BASE_PATH.ENDPOINT,
14424
- listOperation: listEndpointsOperation,
14425
- errorLogContext: "GET /Endpoint list error:"
15739
+ var ENDPOINT_RESOURCE_TYPE = "Endpoint";
15740
+ function stripModifier12(key) {
15741
+ const idx = key.indexOf(":");
15742
+ return idx === -1 ? key : key.slice(0, idx);
15743
+ }
15744
+ function isResultParameter12(key) {
15745
+ return key.startsWith("_");
15746
+ }
15747
+ function sendInvalidSearch40012(res, diagnostics) {
15748
+ return res.status(400).json({
15749
+ resourceType: "OperationOutcome",
15750
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
14426
15751
  });
14427
15752
  }
15753
+ function extractSearchParamKeys12(query) {
15754
+ const out = [];
15755
+ for (const rawKey of Object.keys(query)) {
15756
+ if (isResultParameter12(rawKey)) {
15757
+ continue;
15758
+ }
15759
+ out.push({ rawKey, code: stripModifier12(rawKey) });
15760
+ }
15761
+ return out;
15762
+ }
15763
+ function buildUnknownParamDiagnostics12(unknownCodes) {
15764
+ const validCodes = getRegisteredSearchParameters(ENDPOINT_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
15765
+ const codes = unknownCodes.join(", ");
15766
+ const isPlural = unknownCodes.length !== 1;
15767
+ return [
15768
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Endpoint: ${codes}.`,
15769
+ `Valid codes: ${validCodes}.`
15770
+ ].join(" ");
15771
+ }
15772
+ function findMalformedReference12(query, searchParamKeys) {
15773
+ const referenceCodes = new Set(
15774
+ getRegisteredSearchParameters(ENDPOINT_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
15775
+ );
15776
+ if (referenceCodes.size === 0) {
15777
+ return void 0;
15778
+ }
15779
+ for (const { rawKey, code } of searchParamKeys) {
15780
+ if (!referenceCodes.has(code)) {
15781
+ continue;
15782
+ }
15783
+ const raw = query[rawKey];
15784
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
15785
+ for (const v of values) {
15786
+ const trimmed = v.trim();
15787
+ if (trimmed.length === 0) {
15788
+ continue;
15789
+ }
15790
+ if (parseTypedReference(trimmed) === void 0) {
15791
+ return { rawKey, value: trimmed };
15792
+ }
15793
+ }
15794
+ }
15795
+ return void 0;
15796
+ }
15797
+ async function listEndpointsRoute(req, res) {
15798
+ const searchParamKeys = extractSearchParamKeys12(
15799
+ req.query
15800
+ );
15801
+ if (searchParamKeys.length === 0) {
15802
+ return handleListRoute({
15803
+ req,
15804
+ res,
15805
+ basePath: BASE_PATH.ENDPOINT,
15806
+ listOperation: listEndpointsOperation,
15807
+ errorLogContext: "GET /Endpoint list error:"
15808
+ });
15809
+ }
15810
+ const registered = getRegisteredSearchParameters(ENDPOINT_RESOURCE_TYPE);
15811
+ const validCodes = new Set(registered.map((p) => p.code));
15812
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
15813
+ if (unknownCodes.length > 0) {
15814
+ return sendInvalidSearch40012(
15815
+ res,
15816
+ buildUnknownParamDiagnostics12([...new Set(unknownCodes)])
15817
+ );
15818
+ }
15819
+ const malformedRef = findMalformedReference12(
15820
+ req.query,
15821
+ searchParamKeys
15822
+ );
15823
+ if (malformedRef !== void 0) {
15824
+ return sendInvalidSearch40012(
15825
+ res,
15826
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
15827
+ );
15828
+ }
15829
+ const ctx = req.openhiContext;
15830
+ try {
15831
+ const result = await genericSearchOperation({
15832
+ resourceType: ENDPOINT_RESOURCE_TYPE,
15833
+ tenantId: ctx.tenantId,
15834
+ workspaceId: ctx.workspaceId,
15835
+ query: req.query,
15836
+ resolver: defaultSearchParameterResolver
15837
+ });
15838
+ const bundle = buildSearchsetBundle(BASE_PATH.ENDPOINT, result.entries);
15839
+ return res.json(bundle);
15840
+ } catch (err) {
15841
+ return sendOperationOutcome500(res, err, "GET /Endpoint search error:");
15842
+ }
15843
+ }
14428
15844
 
14429
15845
  // src/data/operations/data/endpoint/endpoint-update-operation.ts
14430
15846
  async function updateEndpointOperation(params) {
@@ -16001,52 +17417,159 @@ async function getExplanationOfBenefitByIdOperation(params) {
16001
17417
  id,
16002
17418
  "ExplanationOfBenefit"
16003
17419
  );
16004
- }
16005
-
16006
- // src/data/rest-api/routes/data/explanationofbenefit/explanationofbenefit-get-by-id-route.ts
16007
- async function getExplanationOfBenefitByIdRoute(req, res) {
16008
- const id = String(req.params.id);
17420
+ }
17421
+
17422
+ // src/data/rest-api/routes/data/explanationofbenefit/explanationofbenefit-get-by-id-route.ts
17423
+ async function getExplanationOfBenefitByIdRoute(req, res) {
17424
+ const id = String(req.params.id);
17425
+ const ctx = req.openhiContext;
17426
+ try {
17427
+ const result = await getExplanationOfBenefitByIdOperation({
17428
+ context: ctx,
17429
+ id
17430
+ });
17431
+ return res.json(result.resource);
17432
+ } catch (err) {
17433
+ const status = domainErrorToHttpStatus(err);
17434
+ if (status === 404) {
17435
+ const diagnostics = err instanceof NotFoundError ? err.message : `ExplanationOfBenefit ${id} not found`;
17436
+ return sendOperationOutcome404(res, diagnostics);
17437
+ }
17438
+ return sendOperationOutcome500(res, err, "GET ExplanationOfBenefit error:");
17439
+ }
17440
+ }
17441
+
17442
+ // src/data/operations/data/explanationofbenefit/explanationofbenefit-list-operation.ts
17443
+ async function listExplanationOfBenefitsOperation(params) {
17444
+ const { context, tableName, mode } = params;
17445
+ const { tenantId, workspaceId } = context;
17446
+ const service = getDynamoDataService(tableName);
17447
+ return listDataEntitiesByWorkspace(
17448
+ service.entities.explanationofbenefit,
17449
+ tenantId,
17450
+ workspaceId,
17451
+ mode
17452
+ );
17453
+ }
17454
+
17455
+ // src/data/rest-api/routes/data/explanationofbenefit/explanationofbenefit-list-route.ts
17456
+ var EXPLANATIONOFBENEFIT_RESOURCE_TYPE = "ExplanationOfBenefit";
17457
+ function stripModifier13(key) {
17458
+ const idx = key.indexOf(":");
17459
+ return idx === -1 ? key : key.slice(0, idx);
17460
+ }
17461
+ function isResultParameter13(key) {
17462
+ return key.startsWith("_");
17463
+ }
17464
+ function sendInvalidSearch40013(res, diagnostics) {
17465
+ return res.status(400).json({
17466
+ resourceType: "OperationOutcome",
17467
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
17468
+ });
17469
+ }
17470
+ function extractSearchParamKeys13(query) {
17471
+ const out = [];
17472
+ for (const rawKey of Object.keys(query)) {
17473
+ if (isResultParameter13(rawKey)) {
17474
+ continue;
17475
+ }
17476
+ out.push({ rawKey, code: stripModifier13(rawKey) });
17477
+ }
17478
+ return out;
17479
+ }
17480
+ function buildUnknownParamDiagnostics13(unknownCodes) {
17481
+ const validCodes = getRegisteredSearchParameters(
17482
+ EXPLANATIONOFBENEFIT_RESOURCE_TYPE
17483
+ ).map((p) => p.code).sort().join(", ");
17484
+ const codes = unknownCodes.join(", ");
17485
+ const isPlural = unknownCodes.length !== 1;
17486
+ return [
17487
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for ExplanationOfBenefit: ${codes}.`,
17488
+ `Valid codes: ${validCodes}.`
17489
+ ].join(" ");
17490
+ }
17491
+ function findMalformedReference13(query, searchParamKeys) {
17492
+ const referenceCodes = new Set(
17493
+ getRegisteredSearchParameters(EXPLANATIONOFBENEFIT_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
17494
+ );
17495
+ if (referenceCodes.size === 0) {
17496
+ return void 0;
17497
+ }
17498
+ for (const { rawKey, code } of searchParamKeys) {
17499
+ if (!referenceCodes.has(code)) {
17500
+ continue;
17501
+ }
17502
+ const raw = query[rawKey];
17503
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
17504
+ for (const v of values) {
17505
+ const trimmed = v.trim();
17506
+ if (trimmed.length === 0) {
17507
+ continue;
17508
+ }
17509
+ if (parseTypedReference(trimmed) === void 0) {
17510
+ return { rawKey, value: trimmed };
17511
+ }
17512
+ }
17513
+ }
17514
+ return void 0;
17515
+ }
17516
+ async function listExplanationOfBenefitsRoute(req, res) {
17517
+ const searchParamKeys = extractSearchParamKeys13(
17518
+ req.query
17519
+ );
17520
+ if (searchParamKeys.length === 0) {
17521
+ return handleListRoute({
17522
+ req,
17523
+ res,
17524
+ basePath: BASE_PATH.EXPLANATIONOFBENEFIT,
17525
+ listOperation: listExplanationOfBenefitsOperation,
17526
+ errorLogContext: "GET /ExplanationOfBenefit list error:"
17527
+ });
17528
+ }
17529
+ const registered = getRegisteredSearchParameters(
17530
+ EXPLANATIONOFBENEFIT_RESOURCE_TYPE
17531
+ );
17532
+ const validCodes = new Set(registered.map((p) => p.code));
17533
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
17534
+ if (unknownCodes.length > 0) {
17535
+ return sendInvalidSearch40013(
17536
+ res,
17537
+ buildUnknownParamDiagnostics13([...new Set(unknownCodes)])
17538
+ );
17539
+ }
17540
+ const malformedRef = findMalformedReference13(
17541
+ req.query,
17542
+ searchParamKeys
17543
+ );
17544
+ if (malformedRef !== void 0) {
17545
+ return sendInvalidSearch40013(
17546
+ res,
17547
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
17548
+ );
17549
+ }
16009
17550
  const ctx = req.openhiContext;
16010
17551
  try {
16011
- const result = await getExplanationOfBenefitByIdOperation({
16012
- context: ctx,
16013
- id
17552
+ const result = await genericSearchOperation({
17553
+ resourceType: EXPLANATIONOFBENEFIT_RESOURCE_TYPE,
17554
+ tenantId: ctx.tenantId,
17555
+ workspaceId: ctx.workspaceId,
17556
+ query: req.query,
17557
+ resolver: defaultSearchParameterResolver
16014
17558
  });
16015
- return res.json(result.resource);
17559
+ const bundle = buildSearchsetBundle(
17560
+ BASE_PATH.EXPLANATIONOFBENEFIT,
17561
+ result.entries
17562
+ );
17563
+ return res.json(bundle);
16016
17564
  } catch (err) {
16017
- const status = domainErrorToHttpStatus(err);
16018
- if (status === 404) {
16019
- const diagnostics = err instanceof NotFoundError ? err.message : `ExplanationOfBenefit ${id} not found`;
16020
- return sendOperationOutcome404(res, diagnostics);
16021
- }
16022
- return sendOperationOutcome500(res, err, "GET ExplanationOfBenefit error:");
17565
+ return sendOperationOutcome500(
17566
+ res,
17567
+ err,
17568
+ "GET /ExplanationOfBenefit search error:"
17569
+ );
16023
17570
  }
16024
17571
  }
16025
17572
 
16026
- // src/data/operations/data/explanationofbenefit/explanationofbenefit-list-operation.ts
16027
- async function listExplanationOfBenefitsOperation(params) {
16028
- const { context, tableName, mode } = params;
16029
- const { tenantId, workspaceId } = context;
16030
- const service = getDynamoDataService(tableName);
16031
- return listDataEntitiesByWorkspace(
16032
- service.entities.explanationofbenefit,
16033
- tenantId,
16034
- workspaceId,
16035
- mode
16036
- );
16037
- }
16038
-
16039
- // src/data/rest-api/routes/data/explanationofbenefit/explanationofbenefit-list-route.ts
16040
- async function listExplanationOfBenefitsRoute(req, res) {
16041
- return handleListRoute({
16042
- req,
16043
- res,
16044
- basePath: BASE_PATH.EXPLANATIONOFBENEFIT,
16045
- listOperation: listExplanationOfBenefitsOperation,
16046
- errorLogContext: "GET /ExplanationOfBenefit list error:"
16047
- });
16048
- }
16049
-
16050
17573
  // src/data/operations/data/explanationofbenefit/explanationofbenefit-update-operation.ts
16051
17574
  async function updateExplanationOfBenefitOperation(params) {
16052
17575
  const { context, id, body, tableName } = params;
@@ -16245,30 +17768,30 @@ async function listFamilyMemberHistorysOperation(params) {
16245
17768
 
16246
17769
  // src/data/rest-api/routes/data/familymemberhistory/familymemberhistory-list-route.ts
16247
17770
  var FAMILYMEMBERHISTORY_RESOURCE_TYPE = "FamilyMemberHistory";
16248
- function stripModifier5(key) {
17771
+ function stripModifier14(key) {
16249
17772
  const idx = key.indexOf(":");
16250
17773
  return idx === -1 ? key : key.slice(0, idx);
16251
17774
  }
16252
- function isResultParameter5(key) {
17775
+ function isResultParameter14(key) {
16253
17776
  return key.startsWith("_");
16254
17777
  }
16255
- function sendInvalidSearch4005(res, diagnostics) {
17778
+ function sendInvalidSearch40014(res, diagnostics) {
16256
17779
  return res.status(400).json({
16257
17780
  resourceType: "OperationOutcome",
16258
17781
  issue: [{ severity: "error", code: "invalid", diagnostics }]
16259
17782
  });
16260
17783
  }
16261
- function extractSearchParamKeys5(query) {
17784
+ function extractSearchParamKeys14(query) {
16262
17785
  const out = [];
16263
17786
  for (const rawKey of Object.keys(query)) {
16264
- if (isResultParameter5(rawKey)) {
17787
+ if (isResultParameter14(rawKey)) {
16265
17788
  continue;
16266
17789
  }
16267
- out.push({ rawKey, code: stripModifier5(rawKey) });
17790
+ out.push({ rawKey, code: stripModifier14(rawKey) });
16268
17791
  }
16269
17792
  return out;
16270
17793
  }
16271
- function buildUnknownParamDiagnostics5(unknownCodes) {
17794
+ function buildUnknownParamDiagnostics14(unknownCodes) {
16272
17795
  const validCodes = getRegisteredSearchParameters(
16273
17796
  FAMILYMEMBERHISTORY_RESOURCE_TYPE
16274
17797
  ).map((p) => p.code).sort().join(", ");
@@ -16279,7 +17802,7 @@ function buildUnknownParamDiagnostics5(unknownCodes) {
16279
17802
  `Valid codes: ${validCodes}.`
16280
17803
  ].join(" ");
16281
17804
  }
16282
- function findMalformedReference5(query, searchParamKeys) {
17805
+ function findMalformedReference14(query, searchParamKeys) {
16283
17806
  const referenceCodes = new Set(
16284
17807
  getRegisteredSearchParameters(FAMILYMEMBERHISTORY_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
16285
17808
  );
@@ -16302,7 +17825,7 @@ function findMalformedReference5(query, searchParamKeys) {
16302
17825
  return void 0;
16303
17826
  }
16304
17827
  async function listFamilyMemberHistorysRoute(req, res) {
16305
- const searchParamKeys = extractSearchParamKeys5(
17828
+ const searchParamKeys = extractSearchParamKeys14(
16306
17829
  req.query
16307
17830
  );
16308
17831
  if (searchParamKeys.length === 0) {
@@ -16320,17 +17843,17 @@ async function listFamilyMemberHistorysRoute(req, res) {
16320
17843
  const validCodes = new Set(registered.map((p) => p.code));
16321
17844
  const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
16322
17845
  if (unknownCodes.length > 0) {
16323
- return sendInvalidSearch4005(
17846
+ return sendInvalidSearch40014(
16324
17847
  res,
16325
- buildUnknownParamDiagnostics5([...new Set(unknownCodes)])
17848
+ buildUnknownParamDiagnostics14([...new Set(unknownCodes)])
16326
17849
  );
16327
17850
  }
16328
- const malformedRef = findMalformedReference5(
17851
+ const malformedRef = findMalformedReference14(
16329
17852
  req.query,
16330
17853
  searchParamKeys
16331
17854
  );
16332
17855
  if (malformedRef !== void 0) {
16333
- return sendInvalidSearch4005(
17856
+ return sendInvalidSearch40014(
16334
17857
  res,
16335
17858
  `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
16336
17859
  );
@@ -17751,15 +19274,111 @@ async function listImagingStudysOperation(params) {
17751
19274
  }
17752
19275
 
17753
19276
  // src/data/rest-api/routes/data/imagingstudy/imagingstudy-list-route.ts
17754
- async function listImagingStudysRoute(req, res) {
17755
- return handleListRoute({
17756
- req,
17757
- res,
17758
- basePath: BASE_PATH.IMAGINGSTUDY,
17759
- listOperation: listImagingStudysOperation,
17760
- errorLogContext: "GET /ImagingStudy list error:"
19277
+ var IMAGINGSTUDY_RESOURCE_TYPE = "ImagingStudy";
19278
+ function stripModifier15(key) {
19279
+ const idx = key.indexOf(":");
19280
+ return idx === -1 ? key : key.slice(0, idx);
19281
+ }
19282
+ function isResultParameter15(key) {
19283
+ return key.startsWith("_");
19284
+ }
19285
+ function sendInvalidSearch40015(res, diagnostics) {
19286
+ return res.status(400).json({
19287
+ resourceType: "OperationOutcome",
19288
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
17761
19289
  });
17762
19290
  }
19291
+ function extractSearchParamKeys15(query) {
19292
+ const out = [];
19293
+ for (const rawKey of Object.keys(query)) {
19294
+ if (isResultParameter15(rawKey)) {
19295
+ continue;
19296
+ }
19297
+ out.push({ rawKey, code: stripModifier15(rawKey) });
19298
+ }
19299
+ return out;
19300
+ }
19301
+ function buildUnknownParamDiagnostics15(unknownCodes) {
19302
+ const validCodes = getRegisteredSearchParameters(IMAGINGSTUDY_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
19303
+ const codes = unknownCodes.join(", ");
19304
+ const isPlural = unknownCodes.length !== 1;
19305
+ return [
19306
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for ImagingStudy: ${codes}.`,
19307
+ `Valid codes: ${validCodes}.`
19308
+ ].join(" ");
19309
+ }
19310
+ function findMalformedReference15(query, searchParamKeys) {
19311
+ const referenceCodes = new Set(
19312
+ getRegisteredSearchParameters(IMAGINGSTUDY_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
19313
+ );
19314
+ if (referenceCodes.size === 0) {
19315
+ return void 0;
19316
+ }
19317
+ for (const { rawKey, code } of searchParamKeys) {
19318
+ if (!referenceCodes.has(code)) {
19319
+ continue;
19320
+ }
19321
+ const raw = query[rawKey];
19322
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
19323
+ for (const v of values) {
19324
+ const trimmed = v.trim();
19325
+ if (trimmed.length === 0) {
19326
+ continue;
19327
+ }
19328
+ if (parseTypedReference(trimmed) === void 0) {
19329
+ return { rawKey, value: trimmed };
19330
+ }
19331
+ }
19332
+ }
19333
+ return void 0;
19334
+ }
19335
+ async function listImagingStudysRoute(req, res) {
19336
+ const searchParamKeys = extractSearchParamKeys15(
19337
+ req.query
19338
+ );
19339
+ if (searchParamKeys.length === 0) {
19340
+ return handleListRoute({
19341
+ req,
19342
+ res,
19343
+ basePath: BASE_PATH.IMAGINGSTUDY,
19344
+ listOperation: listImagingStudysOperation,
19345
+ errorLogContext: "GET /ImagingStudy list error:"
19346
+ });
19347
+ }
19348
+ const registered = getRegisteredSearchParameters(IMAGINGSTUDY_RESOURCE_TYPE);
19349
+ const validCodes = new Set(registered.map((p) => p.code));
19350
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
19351
+ if (unknownCodes.length > 0) {
19352
+ return sendInvalidSearch40015(
19353
+ res,
19354
+ buildUnknownParamDiagnostics15([...new Set(unknownCodes)])
19355
+ );
19356
+ }
19357
+ const malformedRef = findMalformedReference15(
19358
+ req.query,
19359
+ searchParamKeys
19360
+ );
19361
+ if (malformedRef !== void 0) {
19362
+ return sendInvalidSearch40015(
19363
+ res,
19364
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
19365
+ );
19366
+ }
19367
+ const ctx = req.openhiContext;
19368
+ try {
19369
+ const result = await genericSearchOperation({
19370
+ resourceType: IMAGINGSTUDY_RESOURCE_TYPE,
19371
+ tenantId: ctx.tenantId,
19372
+ workspaceId: ctx.workspaceId,
19373
+ query: req.query,
19374
+ resolver: defaultSearchParameterResolver
19375
+ });
19376
+ const bundle = buildSearchsetBundle(BASE_PATH.IMAGINGSTUDY, result.entries);
19377
+ return res.json(bundle);
19378
+ } catch (err) {
19379
+ return sendOperationOutcome500(res, err, "GET /ImagingStudy search error:");
19380
+ }
19381
+ }
17763
19382
 
17764
19383
  // src/data/operations/data/imagingstudy/imagingstudy-update-operation.ts
17765
19384
  async function updateImagingStudyOperation(params) {
@@ -17952,30 +19571,30 @@ async function listImmunizationsOperation(params) {
17952
19571
 
17953
19572
  // src/data/rest-api/routes/data/immunization/immunization-list-route.ts
17954
19573
  var IMMUNIZATION_RESOURCE_TYPE = "Immunization";
17955
- function stripModifier6(key) {
19574
+ function stripModifier16(key) {
17956
19575
  const idx = key.indexOf(":");
17957
19576
  return idx === -1 ? key : key.slice(0, idx);
17958
19577
  }
17959
- function isResultParameter6(key) {
19578
+ function isResultParameter16(key) {
17960
19579
  return key.startsWith("_");
17961
19580
  }
17962
- function sendInvalidSearch4006(res, diagnostics) {
19581
+ function sendInvalidSearch40016(res, diagnostics) {
17963
19582
  return res.status(400).json({
17964
19583
  resourceType: "OperationOutcome",
17965
19584
  issue: [{ severity: "error", code: "invalid", diagnostics }]
17966
19585
  });
17967
19586
  }
17968
- function extractSearchParamKeys6(query) {
19587
+ function extractSearchParamKeys16(query) {
17969
19588
  const out = [];
17970
19589
  for (const rawKey of Object.keys(query)) {
17971
- if (isResultParameter6(rawKey)) {
19590
+ if (isResultParameter16(rawKey)) {
17972
19591
  continue;
17973
19592
  }
17974
- out.push({ rawKey, code: stripModifier6(rawKey) });
19593
+ out.push({ rawKey, code: stripModifier16(rawKey) });
17975
19594
  }
17976
19595
  return out;
17977
19596
  }
17978
- function buildUnknownParamDiagnostics6(unknownCodes) {
19597
+ function buildUnknownParamDiagnostics16(unknownCodes) {
17979
19598
  const validCodes = getRegisteredSearchParameters(IMMUNIZATION_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
17980
19599
  const codes = unknownCodes.join(", ");
17981
19600
  const isPlural = unknownCodes.length !== 1;
@@ -17984,7 +19603,7 @@ function buildUnknownParamDiagnostics6(unknownCodes) {
17984
19603
  `Valid codes: ${validCodes}.`
17985
19604
  ].join(" ");
17986
19605
  }
17987
- function findMalformedReference6(query, searchParamKeys) {
19606
+ function findMalformedReference16(query, searchParamKeys) {
17988
19607
  const referenceCodes = new Set(
17989
19608
  getRegisteredSearchParameters(IMMUNIZATION_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
17990
19609
  );
@@ -18007,7 +19626,7 @@ function findMalformedReference6(query, searchParamKeys) {
18007
19626
  return void 0;
18008
19627
  }
18009
19628
  async function listImmunizationsRoute(req, res) {
18010
- const searchParamKeys = extractSearchParamKeys6(
19629
+ const searchParamKeys = extractSearchParamKeys16(
18011
19630
  req.query
18012
19631
  );
18013
19632
  if (searchParamKeys.length === 0) {
@@ -18023,17 +19642,17 @@ async function listImmunizationsRoute(req, res) {
18023
19642
  const validCodes = new Set(registered.map((p) => p.code));
18024
19643
  const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
18025
19644
  if (unknownCodes.length > 0) {
18026
- return sendInvalidSearch4006(
19645
+ return sendInvalidSearch40016(
18027
19646
  res,
18028
- buildUnknownParamDiagnostics6([...new Set(unknownCodes)])
19647
+ buildUnknownParamDiagnostics16([...new Set(unknownCodes)])
18029
19648
  );
18030
19649
  }
18031
- const malformedRef = findMalformedReference6(
19650
+ const malformedRef = findMalformedReference16(
18032
19651
  req.query,
18033
19652
  searchParamKeys
18034
19653
  );
18035
19654
  if (malformedRef !== void 0) {
18036
- return sendInvalidSearch4006(
19655
+ return sendInvalidSearch40016(
18037
19656
  res,
18038
19657
  `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
18039
19658
  );
@@ -19063,42 +20682,138 @@ async function getInvoiceByIdRoute(req, res) {
19063
20682
  const id = String(req.params.id);
19064
20683
  const ctx = req.openhiContext;
19065
20684
  try {
19066
- const result = await getInvoiceByIdOperation({ context: ctx, id });
19067
- return res.json(result.resource);
20685
+ const result = await getInvoiceByIdOperation({ context: ctx, id });
20686
+ return res.json(result.resource);
20687
+ } catch (err) {
20688
+ const status = domainErrorToHttpStatus(err);
20689
+ if (status === 404) {
20690
+ const diagnostics = err instanceof NotFoundError ? err.message : `Invoice ${id} not found`;
20691
+ return sendOperationOutcome404(res, diagnostics);
20692
+ }
20693
+ return sendOperationOutcome500(res, err, "GET Invoice error:");
20694
+ }
20695
+ }
20696
+
20697
+ // src/data/operations/data/invoice/invoice-list-operation.ts
20698
+ async function listInvoicesOperation(params) {
20699
+ const { context, tableName, mode } = params;
20700
+ const { tenantId, workspaceId } = context;
20701
+ const service = getDynamoDataService(tableName);
20702
+ return listDataEntitiesByWorkspace(
20703
+ service.entities.invoice,
20704
+ tenantId,
20705
+ workspaceId,
20706
+ mode
20707
+ );
20708
+ }
20709
+
20710
+ // src/data/rest-api/routes/data/invoice/invoice-list-route.ts
20711
+ var INVOICE_RESOURCE_TYPE = "Invoice";
20712
+ function stripModifier17(key) {
20713
+ const idx = key.indexOf(":");
20714
+ return idx === -1 ? key : key.slice(0, idx);
20715
+ }
20716
+ function isResultParameter17(key) {
20717
+ return key.startsWith("_");
20718
+ }
20719
+ function sendInvalidSearch40017(res, diagnostics) {
20720
+ return res.status(400).json({
20721
+ resourceType: "OperationOutcome",
20722
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
20723
+ });
20724
+ }
20725
+ function extractSearchParamKeys17(query) {
20726
+ const out = [];
20727
+ for (const rawKey of Object.keys(query)) {
20728
+ if (isResultParameter17(rawKey)) {
20729
+ continue;
20730
+ }
20731
+ out.push({ rawKey, code: stripModifier17(rawKey) });
20732
+ }
20733
+ return out;
20734
+ }
20735
+ function buildUnknownParamDiagnostics17(unknownCodes) {
20736
+ const validCodes = getRegisteredSearchParameters(INVOICE_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
20737
+ const codes = unknownCodes.join(", ");
20738
+ const isPlural = unknownCodes.length !== 1;
20739
+ return [
20740
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Invoice: ${codes}.`,
20741
+ `Valid codes: ${validCodes}.`
20742
+ ].join(" ");
20743
+ }
20744
+ function findMalformedReference17(query, searchParamKeys) {
20745
+ const referenceCodes = new Set(
20746
+ getRegisteredSearchParameters(INVOICE_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
20747
+ );
20748
+ if (referenceCodes.size === 0) {
20749
+ return void 0;
20750
+ }
20751
+ for (const { rawKey, code } of searchParamKeys) {
20752
+ if (!referenceCodes.has(code)) {
20753
+ continue;
20754
+ }
20755
+ const raw = query[rawKey];
20756
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
20757
+ for (const v of values) {
20758
+ const trimmed = v.trim();
20759
+ if (trimmed.length === 0) {
20760
+ continue;
20761
+ }
20762
+ if (parseTypedReference(trimmed) === void 0) {
20763
+ return { rawKey, value: trimmed };
20764
+ }
20765
+ }
20766
+ }
20767
+ return void 0;
20768
+ }
20769
+ async function listInvoicesRoute(req, res) {
20770
+ const searchParamKeys = extractSearchParamKeys17(
20771
+ req.query
20772
+ );
20773
+ if (searchParamKeys.length === 0) {
20774
+ return handleListRoute({
20775
+ req,
20776
+ res,
20777
+ basePath: BASE_PATH.INVOICE,
20778
+ listOperation: listInvoicesOperation,
20779
+ errorLogContext: "GET /Invoice list error:"
20780
+ });
20781
+ }
20782
+ const registered = getRegisteredSearchParameters(INVOICE_RESOURCE_TYPE);
20783
+ const validCodes = new Set(registered.map((p) => p.code));
20784
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
20785
+ if (unknownCodes.length > 0) {
20786
+ return sendInvalidSearch40017(
20787
+ res,
20788
+ buildUnknownParamDiagnostics17([...new Set(unknownCodes)])
20789
+ );
20790
+ }
20791
+ const malformedRef = findMalformedReference17(
20792
+ req.query,
20793
+ searchParamKeys
20794
+ );
20795
+ if (malformedRef !== void 0) {
20796
+ return sendInvalidSearch40017(
20797
+ res,
20798
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
20799
+ );
20800
+ }
20801
+ const ctx = req.openhiContext;
20802
+ try {
20803
+ const result = await genericSearchOperation({
20804
+ resourceType: INVOICE_RESOURCE_TYPE,
20805
+ tenantId: ctx.tenantId,
20806
+ workspaceId: ctx.workspaceId,
20807
+ query: req.query,
20808
+ resolver: defaultSearchParameterResolver
20809
+ });
20810
+ const bundle = buildSearchsetBundle(BASE_PATH.INVOICE, result.entries);
20811
+ return res.json(bundle);
19068
20812
  } catch (err) {
19069
- const status = domainErrorToHttpStatus(err);
19070
- if (status === 404) {
19071
- const diagnostics = err instanceof NotFoundError ? err.message : `Invoice ${id} not found`;
19072
- return sendOperationOutcome404(res, diagnostics);
19073
- }
19074
- return sendOperationOutcome500(res, err, "GET Invoice error:");
20813
+ return sendOperationOutcome500(res, err, "GET /Invoice search error:");
19075
20814
  }
19076
20815
  }
19077
20816
 
19078
- // src/data/operations/data/invoice/invoice-list-operation.ts
19079
- async function listInvoicesOperation(params) {
19080
- const { context, tableName, mode } = params;
19081
- const { tenantId, workspaceId } = context;
19082
- const service = getDynamoDataService(tableName);
19083
- return listDataEntitiesByWorkspace(
19084
- service.entities.invoice,
19085
- tenantId,
19086
- workspaceId,
19087
- mode
19088
- );
19089
- }
19090
-
19091
- // src/data/rest-api/routes/data/invoice/invoice-list-route.ts
19092
- async function listInvoicesRoute(req, res) {
19093
- return handleListRoute({
19094
- req,
19095
- res,
19096
- basePath: BASE_PATH.INVOICE,
19097
- listOperation: listInvoicesOperation,
19098
- errorLogContext: "GET /Invoice list error:"
19099
- });
19100
- }
19101
-
19102
20817
  // src/data/operations/data/invoice/invoice-update-operation.ts
19103
20818
  async function updateInvoiceOperation(params) {
19104
20819
  const { context, id, body, tableName } = params;
@@ -19889,15 +21604,111 @@ async function listLocationsOperation(params) {
19889
21604
  }
19890
21605
 
19891
21606
  // src/data/rest-api/routes/data/location/location-list-route.ts
19892
- async function listLocationsRoute(req, res) {
19893
- return handleListRoute({
19894
- req,
19895
- res,
19896
- basePath: BASE_PATH.LOCATION,
19897
- listOperation: listLocationsOperation,
19898
- errorLogContext: "GET /Location list error:"
21607
+ var LOCATION_RESOURCE_TYPE = "Location";
21608
+ function stripModifier18(key) {
21609
+ const idx = key.indexOf(":");
21610
+ return idx === -1 ? key : key.slice(0, idx);
21611
+ }
21612
+ function isResultParameter18(key) {
21613
+ return key.startsWith("_");
21614
+ }
21615
+ function sendInvalidSearch40018(res, diagnostics) {
21616
+ return res.status(400).json({
21617
+ resourceType: "OperationOutcome",
21618
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
19899
21619
  });
19900
21620
  }
21621
+ function extractSearchParamKeys18(query) {
21622
+ const out = [];
21623
+ for (const rawKey of Object.keys(query)) {
21624
+ if (isResultParameter18(rawKey)) {
21625
+ continue;
21626
+ }
21627
+ out.push({ rawKey, code: stripModifier18(rawKey) });
21628
+ }
21629
+ return out;
21630
+ }
21631
+ function buildUnknownParamDiagnostics18(unknownCodes) {
21632
+ const validCodes = getRegisteredSearchParameters(LOCATION_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
21633
+ const codes = unknownCodes.join(", ");
21634
+ const isPlural = unknownCodes.length !== 1;
21635
+ return [
21636
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Location: ${codes}.`,
21637
+ `Valid codes: ${validCodes}.`
21638
+ ].join(" ");
21639
+ }
21640
+ function findMalformedReference18(query, searchParamKeys) {
21641
+ const referenceCodes = new Set(
21642
+ getRegisteredSearchParameters(LOCATION_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
21643
+ );
21644
+ if (referenceCodes.size === 0) {
21645
+ return void 0;
21646
+ }
21647
+ for (const { rawKey, code } of searchParamKeys) {
21648
+ if (!referenceCodes.has(code)) {
21649
+ continue;
21650
+ }
21651
+ const raw = query[rawKey];
21652
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
21653
+ for (const v of values) {
21654
+ const trimmed = v.trim();
21655
+ if (trimmed.length === 0) {
21656
+ continue;
21657
+ }
21658
+ if (parseTypedReference(trimmed) === void 0) {
21659
+ return { rawKey, value: trimmed };
21660
+ }
21661
+ }
21662
+ }
21663
+ return void 0;
21664
+ }
21665
+ async function listLocationsRoute(req, res) {
21666
+ const searchParamKeys = extractSearchParamKeys18(
21667
+ req.query
21668
+ );
21669
+ if (searchParamKeys.length === 0) {
21670
+ return handleListRoute({
21671
+ req,
21672
+ res,
21673
+ basePath: BASE_PATH.LOCATION,
21674
+ listOperation: listLocationsOperation,
21675
+ errorLogContext: "GET /Location list error:"
21676
+ });
21677
+ }
21678
+ const registered = getRegisteredSearchParameters(LOCATION_RESOURCE_TYPE);
21679
+ const validCodes = new Set(registered.map((p) => p.code));
21680
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
21681
+ if (unknownCodes.length > 0) {
21682
+ return sendInvalidSearch40018(
21683
+ res,
21684
+ buildUnknownParamDiagnostics18([...new Set(unknownCodes)])
21685
+ );
21686
+ }
21687
+ const malformedRef = findMalformedReference18(
21688
+ req.query,
21689
+ searchParamKeys
21690
+ );
21691
+ if (malformedRef !== void 0) {
21692
+ return sendInvalidSearch40018(
21693
+ res,
21694
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
21695
+ );
21696
+ }
21697
+ const ctx = req.openhiContext;
21698
+ try {
21699
+ const result = await genericSearchOperation({
21700
+ resourceType: LOCATION_RESOURCE_TYPE,
21701
+ tenantId: ctx.tenantId,
21702
+ workspaceId: ctx.workspaceId,
21703
+ query: req.query,
21704
+ resolver: defaultSearchParameterResolver
21705
+ });
21706
+ const bundle = buildSearchsetBundle(BASE_PATH.LOCATION, result.entries);
21707
+ return res.json(bundle);
21708
+ } catch (err) {
21709
+ return sendOperationOutcome500(res, err, "GET /Location search error:");
21710
+ }
21711
+ }
19901
21712
 
19902
21713
  // src/data/operations/data/location/location-update-operation.ts
19903
21714
  async function updateLocationOperation(params) {
@@ -21526,30 +23337,30 @@ async function listMedicationRequestsOperation(params) {
21526
23337
 
21527
23338
  // src/data/rest-api/routes/data/medicationrequest/medicationrequest-list-route.ts
21528
23339
  var MEDICATIONREQUEST_RESOURCE_TYPE = "MedicationRequest";
21529
- function stripModifier7(key) {
23340
+ function stripModifier19(key) {
21530
23341
  const idx = key.indexOf(":");
21531
23342
  return idx === -1 ? key : key.slice(0, idx);
21532
23343
  }
21533
- function isResultParameter7(key) {
23344
+ function isResultParameter19(key) {
21534
23345
  return key.startsWith("_");
21535
23346
  }
21536
- function sendInvalidSearch4007(res, diagnostics) {
23347
+ function sendInvalidSearch40019(res, diagnostics) {
21537
23348
  return res.status(400).json({
21538
23349
  resourceType: "OperationOutcome",
21539
23350
  issue: [{ severity: "error", code: "invalid", diagnostics }]
21540
23351
  });
21541
23352
  }
21542
- function extractSearchParamKeys7(query) {
23353
+ function extractSearchParamKeys19(query) {
21543
23354
  const out = [];
21544
23355
  for (const rawKey of Object.keys(query)) {
21545
- if (isResultParameter7(rawKey)) {
23356
+ if (isResultParameter19(rawKey)) {
21546
23357
  continue;
21547
23358
  }
21548
- out.push({ rawKey, code: stripModifier7(rawKey) });
23359
+ out.push({ rawKey, code: stripModifier19(rawKey) });
21549
23360
  }
21550
23361
  return out;
21551
23362
  }
21552
- function buildUnknownParamDiagnostics7(unknownCodes) {
23363
+ function buildUnknownParamDiagnostics19(unknownCodes) {
21553
23364
  const validCodes = getRegisteredSearchParameters(
21554
23365
  MEDICATIONREQUEST_RESOURCE_TYPE
21555
23366
  ).map((p) => p.code).sort().join(", ");
@@ -21560,7 +23371,7 @@ function buildUnknownParamDiagnostics7(unknownCodes) {
21560
23371
  `Valid codes: ${validCodes}.`
21561
23372
  ].join(" ");
21562
23373
  }
21563
- function findMalformedReference7(query, searchParamKeys) {
23374
+ function findMalformedReference19(query, searchParamKeys) {
21564
23375
  const referenceCodes = new Set(
21565
23376
  getRegisteredSearchParameters(MEDICATIONREQUEST_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
21566
23377
  );
@@ -21583,7 +23394,7 @@ function findMalformedReference7(query, searchParamKeys) {
21583
23394
  return void 0;
21584
23395
  }
21585
23396
  async function listMedicationRequestsRoute(req, res) {
21586
- const searchParamKeys = extractSearchParamKeys7(
23397
+ const searchParamKeys = extractSearchParamKeys19(
21587
23398
  req.query
21588
23399
  );
21589
23400
  if (searchParamKeys.length === 0) {
@@ -21601,17 +23412,17 @@ async function listMedicationRequestsRoute(req, res) {
21601
23412
  const validCodes = new Set(registered.map((p) => p.code));
21602
23413
  const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
21603
23414
  if (unknownCodes.length > 0) {
21604
- return sendInvalidSearch4007(
23415
+ return sendInvalidSearch40019(
21605
23416
  res,
21606
- buildUnknownParamDiagnostics7([...new Set(unknownCodes)])
23417
+ buildUnknownParamDiagnostics19([...new Set(unknownCodes)])
21607
23418
  );
21608
23419
  }
21609
- const malformedRef = findMalformedReference7(
23420
+ const malformedRef = findMalformedReference19(
21610
23421
  req.query,
21611
23422
  searchParamKeys
21612
23423
  );
21613
23424
  if (malformedRef !== void 0) {
21614
- return sendInvalidSearch4007(
23425
+ return sendInvalidSearch40019(
21615
23426
  res,
21616
23427
  `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
21617
23428
  );
@@ -21837,30 +23648,30 @@ async function listMedicationStatementsOperation(params) {
21837
23648
 
21838
23649
  // src/data/rest-api/routes/data/medicationstatement/medicationstatement-list-route.ts
21839
23650
  var MEDICATIONSTATEMENT_RESOURCE_TYPE = "MedicationStatement";
21840
- function stripModifier8(key) {
23651
+ function stripModifier20(key) {
21841
23652
  const idx = key.indexOf(":");
21842
23653
  return idx === -1 ? key : key.slice(0, idx);
21843
23654
  }
21844
- function isResultParameter8(key) {
23655
+ function isResultParameter20(key) {
21845
23656
  return key.startsWith("_");
21846
23657
  }
21847
- function sendInvalidSearch4008(res, diagnostics) {
23658
+ function sendInvalidSearch40020(res, diagnostics) {
21848
23659
  return res.status(400).json({
21849
23660
  resourceType: "OperationOutcome",
21850
23661
  issue: [{ severity: "error", code: "invalid", diagnostics }]
21851
23662
  });
21852
23663
  }
21853
- function extractSearchParamKeys8(query) {
23664
+ function extractSearchParamKeys20(query) {
21854
23665
  const out = [];
21855
23666
  for (const rawKey of Object.keys(query)) {
21856
- if (isResultParameter8(rawKey)) {
23667
+ if (isResultParameter20(rawKey)) {
21857
23668
  continue;
21858
23669
  }
21859
- out.push({ rawKey, code: stripModifier8(rawKey) });
23670
+ out.push({ rawKey, code: stripModifier20(rawKey) });
21860
23671
  }
21861
23672
  return out;
21862
23673
  }
21863
- function buildUnknownParamDiagnostics8(unknownCodes) {
23674
+ function buildUnknownParamDiagnostics20(unknownCodes) {
21864
23675
  const validCodes = getRegisteredSearchParameters(
21865
23676
  MEDICATIONSTATEMENT_RESOURCE_TYPE
21866
23677
  ).map((p) => p.code).sort().join(", ");
@@ -21871,7 +23682,7 @@ function buildUnknownParamDiagnostics8(unknownCodes) {
21871
23682
  `Valid codes: ${validCodes}.`
21872
23683
  ].join(" ");
21873
23684
  }
21874
- function findMalformedReference8(query, searchParamKeys) {
23685
+ function findMalformedReference20(query, searchParamKeys) {
21875
23686
  const referenceCodes = new Set(
21876
23687
  getRegisteredSearchParameters(MEDICATIONSTATEMENT_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
21877
23688
  );
@@ -21894,7 +23705,7 @@ function findMalformedReference8(query, searchParamKeys) {
21894
23705
  return void 0;
21895
23706
  }
21896
23707
  async function listMedicationStatementsRoute(req, res) {
21897
- const searchParamKeys = extractSearchParamKeys8(
23708
+ const searchParamKeys = extractSearchParamKeys20(
21898
23709
  req.query
21899
23710
  );
21900
23711
  if (searchParamKeys.length === 0) {
@@ -21912,17 +23723,17 @@ async function listMedicationStatementsRoute(req, res) {
21912
23723
  const validCodes = new Set(registered.map((p) => p.code));
21913
23724
  const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
21914
23725
  if (unknownCodes.length > 0) {
21915
- return sendInvalidSearch4008(
23726
+ return sendInvalidSearch40020(
21916
23727
  res,
21917
- buildUnknownParamDiagnostics8([...new Set(unknownCodes)])
23728
+ buildUnknownParamDiagnostics20([...new Set(unknownCodes)])
21918
23729
  );
21919
23730
  }
21920
- const malformedRef = findMalformedReference8(
23731
+ const malformedRef = findMalformedReference20(
21921
23732
  req.query,
21922
23733
  searchParamKeys
21923
23734
  );
21924
23735
  if (malformedRef !== void 0) {
21925
- return sendInvalidSearch4008(
23736
+ return sendInvalidSearch40020(
21926
23737
  res,
21927
23738
  `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
21928
23739
  );
@@ -25304,30 +27115,30 @@ async function listObservationsOperation(params) {
25304
27115
 
25305
27116
  // src/data/rest-api/routes/data/observation/observation-list-route.ts
25306
27117
  var OBSERVATION_RESOURCE_TYPE = "Observation";
25307
- function stripModifier9(key) {
27118
+ function stripModifier21(key) {
25308
27119
  const idx = key.indexOf(":");
25309
27120
  return idx === -1 ? key : key.slice(0, idx);
25310
27121
  }
25311
- function isResultParameter9(key) {
27122
+ function isResultParameter21(key) {
25312
27123
  return key.startsWith("_");
25313
27124
  }
25314
- function sendInvalidSearch4009(res, diagnostics) {
27125
+ function sendInvalidSearch40021(res, diagnostics) {
25315
27126
  return res.status(400).json({
25316
27127
  resourceType: "OperationOutcome",
25317
27128
  issue: [{ severity: "error", code: "invalid", diagnostics }]
25318
27129
  });
25319
27130
  }
25320
- function extractSearchParamKeys9(query) {
27131
+ function extractSearchParamKeys21(query) {
25321
27132
  const out = [];
25322
27133
  for (const rawKey of Object.keys(query)) {
25323
- if (isResultParameter9(rawKey)) {
27134
+ if (isResultParameter21(rawKey)) {
25324
27135
  continue;
25325
27136
  }
25326
- out.push({ rawKey, code: stripModifier9(rawKey) });
27137
+ out.push({ rawKey, code: stripModifier21(rawKey) });
25327
27138
  }
25328
27139
  return out;
25329
27140
  }
25330
- function buildUnknownParamDiagnostics9(unknownCodes) {
27141
+ function buildUnknownParamDiagnostics21(unknownCodes) {
25331
27142
  const validCodes = getRegisteredSearchParameters(OBSERVATION_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
25332
27143
  const codes = unknownCodes.join(", ");
25333
27144
  const isPlural = unknownCodes.length !== 1;
@@ -25336,7 +27147,7 @@ function buildUnknownParamDiagnostics9(unknownCodes) {
25336
27147
  `Valid codes: ${validCodes}.`
25337
27148
  ].join(" ");
25338
27149
  }
25339
- function findMalformedReference9(query, searchParamKeys) {
27150
+ function findMalformedReference21(query, searchParamKeys) {
25340
27151
  const referenceCodes = new Set(
25341
27152
  getRegisteredSearchParameters(OBSERVATION_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
25342
27153
  );
@@ -25359,7 +27170,7 @@ function findMalformedReference9(query, searchParamKeys) {
25359
27170
  return void 0;
25360
27171
  }
25361
27172
  async function listObservationsRoute(req, res) {
25362
- const searchParamKeys = extractSearchParamKeys9(
27173
+ const searchParamKeys = extractSearchParamKeys21(
25363
27174
  req.query
25364
27175
  );
25365
27176
  if (searchParamKeys.length === 0) {
@@ -25375,17 +27186,17 @@ async function listObservationsRoute(req, res) {
25375
27186
  const validCodes = new Set(registered.map((p) => p.code));
25376
27187
  const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
25377
27188
  if (unknownCodes.length > 0) {
25378
- return sendInvalidSearch4009(
27189
+ return sendInvalidSearch40021(
25379
27190
  res,
25380
- buildUnknownParamDiagnostics9([...new Set(unknownCodes)])
27191
+ buildUnknownParamDiagnostics21([...new Set(unknownCodes)])
25381
27192
  );
25382
27193
  }
25383
- const malformedRef = findMalformedReference9(
27194
+ const malformedRef = findMalformedReference21(
25384
27195
  req.query,
25385
27196
  searchParamKeys
25386
27197
  );
25387
27198
  if (malformedRef !== void 0) {
25388
- return sendInvalidSearch4009(
27199
+ return sendInvalidSearch40021(
25389
27200
  res,
25390
27201
  `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
25391
27202
  );
@@ -25962,49 +27773,145 @@ async function deleteOrganizationRoute(req, res) {
25962
27773
  } catch (err) {
25963
27774
  return sendOperationOutcome500(res, err, "DELETE Organization error:");
25964
27775
  }
25965
- }
25966
-
25967
- // src/data/rest-api/routes/data/organization/organization-get-by-id-route.ts
25968
- async function getOrganizationByIdRoute(req, res) {
25969
- const id = String(req.params.id);
27776
+ }
27777
+
27778
+ // src/data/rest-api/routes/data/organization/organization-get-by-id-route.ts
27779
+ async function getOrganizationByIdRoute(req, res) {
27780
+ const id = String(req.params.id);
27781
+ const ctx = req.openhiContext;
27782
+ try {
27783
+ const result = await getOrganizationByIdOperation({ context: ctx, id });
27784
+ return res.json(result.resource);
27785
+ } catch (err) {
27786
+ const status = domainErrorToHttpStatus(err);
27787
+ if (status === 404) {
27788
+ const diagnostics = err instanceof NotFoundError ? err.message : `Organization ${id} not found`;
27789
+ return sendOperationOutcome404(res, diagnostics);
27790
+ }
27791
+ return sendOperationOutcome500(res, err, "GET Organization error:");
27792
+ }
27793
+ }
27794
+
27795
+ // src/data/operations/data/organization/organization-list-operation.ts
27796
+ async function listOrganizationsOperation(params) {
27797
+ const { context, tableName, mode } = params;
27798
+ const { tenantId, workspaceId } = context;
27799
+ const service = getDynamoDataService(tableName);
27800
+ return listDataEntitiesByWorkspace(
27801
+ service.entities.organization,
27802
+ tenantId,
27803
+ workspaceId,
27804
+ mode
27805
+ );
27806
+ }
27807
+
27808
+ // src/data/rest-api/routes/data/organization/organization-list-route.ts
27809
+ var ORGANIZATION_RESOURCE_TYPE = "Organization";
27810
+ function stripModifier22(key) {
27811
+ const idx = key.indexOf(":");
27812
+ return idx === -1 ? key : key.slice(0, idx);
27813
+ }
27814
+ function isResultParameter22(key) {
27815
+ return key.startsWith("_");
27816
+ }
27817
+ function sendInvalidSearch40022(res, diagnostics) {
27818
+ return res.status(400).json({
27819
+ resourceType: "OperationOutcome",
27820
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
27821
+ });
27822
+ }
27823
+ function extractSearchParamKeys22(query) {
27824
+ const out = [];
27825
+ for (const rawKey of Object.keys(query)) {
27826
+ if (isResultParameter22(rawKey)) {
27827
+ continue;
27828
+ }
27829
+ out.push({ rawKey, code: stripModifier22(rawKey) });
27830
+ }
27831
+ return out;
27832
+ }
27833
+ function buildUnknownParamDiagnostics22(unknownCodes) {
27834
+ const validCodes = getRegisteredSearchParameters(ORGANIZATION_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
27835
+ const codes = unknownCodes.join(", ");
27836
+ const isPlural = unknownCodes.length !== 1;
27837
+ return [
27838
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Organization: ${codes}.`,
27839
+ `Valid codes: ${validCodes}.`
27840
+ ].join(" ");
27841
+ }
27842
+ function findMalformedReference22(query, searchParamKeys) {
27843
+ const referenceCodes = new Set(
27844
+ getRegisteredSearchParameters(ORGANIZATION_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
27845
+ );
27846
+ if (referenceCodes.size === 0) {
27847
+ return void 0;
27848
+ }
27849
+ for (const { rawKey, code } of searchParamKeys) {
27850
+ if (!referenceCodes.has(code)) {
27851
+ continue;
27852
+ }
27853
+ const raw = query[rawKey];
27854
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
27855
+ for (const v of values) {
27856
+ const trimmed = v.trim();
27857
+ if (trimmed.length === 0) {
27858
+ continue;
27859
+ }
27860
+ if (parseTypedReference(trimmed) === void 0) {
27861
+ return { rawKey, value: trimmed };
27862
+ }
27863
+ }
27864
+ }
27865
+ return void 0;
27866
+ }
27867
+ async function listOrganizationsRoute(req, res) {
27868
+ const searchParamKeys = extractSearchParamKeys22(
27869
+ req.query
27870
+ );
27871
+ if (searchParamKeys.length === 0) {
27872
+ return handleListRoute({
27873
+ req,
27874
+ res,
27875
+ basePath: BASE_PATH.ORGANIZATION,
27876
+ listOperation: listOrganizationsOperation,
27877
+ errorLogContext: "GET /Organization list error:"
27878
+ });
27879
+ }
27880
+ const registered = getRegisteredSearchParameters(ORGANIZATION_RESOURCE_TYPE);
27881
+ const validCodes = new Set(registered.map((p) => p.code));
27882
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
27883
+ if (unknownCodes.length > 0) {
27884
+ return sendInvalidSearch40022(
27885
+ res,
27886
+ buildUnknownParamDiagnostics22([...new Set(unknownCodes)])
27887
+ );
27888
+ }
27889
+ const malformedRef = findMalformedReference22(
27890
+ req.query,
27891
+ searchParamKeys
27892
+ );
27893
+ if (malformedRef !== void 0) {
27894
+ return sendInvalidSearch40022(
27895
+ res,
27896
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
27897
+ );
27898
+ }
25970
27899
  const ctx = req.openhiContext;
25971
27900
  try {
25972
- const result = await getOrganizationByIdOperation({ context: ctx, id });
25973
- return res.json(result.resource);
27901
+ const result = await genericSearchOperation({
27902
+ resourceType: ORGANIZATION_RESOURCE_TYPE,
27903
+ tenantId: ctx.tenantId,
27904
+ workspaceId: ctx.workspaceId,
27905
+ query: req.query,
27906
+ resolver: defaultSearchParameterResolver
27907
+ });
27908
+ const bundle = buildSearchsetBundle(BASE_PATH.ORGANIZATION, result.entries);
27909
+ return res.json(bundle);
25974
27910
  } catch (err) {
25975
- const status = domainErrorToHttpStatus(err);
25976
- if (status === 404) {
25977
- const diagnostics = err instanceof NotFoundError ? err.message : `Organization ${id} not found`;
25978
- return sendOperationOutcome404(res, diagnostics);
25979
- }
25980
- return sendOperationOutcome500(res, err, "GET Organization error:");
27911
+ return sendOperationOutcome500(res, err, "GET /Organization search error:");
25981
27912
  }
25982
27913
  }
25983
27914
 
25984
- // src/data/operations/data/organization/organization-list-operation.ts
25985
- async function listOrganizationsOperation(params) {
25986
- const { context, tableName, mode } = params;
25987
- const { tenantId, workspaceId } = context;
25988
- const service = getDynamoDataService(tableName);
25989
- return listDataEntitiesByWorkspace(
25990
- service.entities.organization,
25991
- tenantId,
25992
- workspaceId,
25993
- mode
25994
- );
25995
- }
25996
-
25997
- // src/data/rest-api/routes/data/organization/organization-list-route.ts
25998
- async function listOrganizationsRoute(req, res) {
25999
- return handleListRoute({
26000
- req,
26001
- res,
26002
- basePath: BASE_PATH.ORGANIZATION,
26003
- listOperation: listOrganizationsOperation,
26004
- errorLogContext: "GET /Organization list error:"
26005
- });
26006
- }
26007
-
26008
27915
  // src/data/operations/data/organization/organization-update-operation.ts
26009
27916
  async function updateOrganizationOperation(params) {
26010
27917
  const { context, id, body, tableName } = params;
@@ -26380,30 +28287,30 @@ async function listPatientsOperation(params) {
26380
28287
 
26381
28288
  // src/data/rest-api/routes/data/patient/patient-list-route.ts
26382
28289
  var PATIENT_RESOURCE_TYPE = "Patient";
26383
- function stripModifier10(key) {
28290
+ function stripModifier23(key) {
26384
28291
  const idx = key.indexOf(":");
26385
28292
  return idx === -1 ? key : key.slice(0, idx);
26386
28293
  }
26387
- function isResultParameter10(key) {
28294
+ function isResultParameter23(key) {
26388
28295
  return key.startsWith("_");
26389
28296
  }
26390
- function sendInvalidSearch40010(res, diagnostics) {
28297
+ function sendInvalidSearch40023(res, diagnostics) {
26391
28298
  return res.status(400).json({
26392
28299
  resourceType: "OperationOutcome",
26393
28300
  issue: [{ severity: "error", code: "invalid", diagnostics }]
26394
28301
  });
26395
28302
  }
26396
- function extractSearchParamKeys10(query) {
28303
+ function extractSearchParamKeys23(query) {
26397
28304
  const out = [];
26398
28305
  for (const rawKey of Object.keys(query)) {
26399
- if (isResultParameter10(rawKey)) {
28306
+ if (isResultParameter23(rawKey)) {
26400
28307
  continue;
26401
28308
  }
26402
- out.push({ rawKey, code: stripModifier10(rawKey) });
28309
+ out.push({ rawKey, code: stripModifier23(rawKey) });
26403
28310
  }
26404
28311
  return out;
26405
28312
  }
26406
- function buildUnknownParamDiagnostics10(unknownCodes) {
28313
+ function buildUnknownParamDiagnostics23(unknownCodes) {
26407
28314
  const validCodes = getRegisteredSearchParameters(PATIENT_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
26408
28315
  const codes = unknownCodes.join(", ");
26409
28316
  const isPlural = unknownCodes.length !== 1;
@@ -26412,7 +28319,7 @@ function buildUnknownParamDiagnostics10(unknownCodes) {
26412
28319
  `Valid codes: ${validCodes}.`
26413
28320
  ].join(" ");
26414
28321
  }
26415
- function findMalformedReference10(query, searchParamKeys) {
28322
+ function findMalformedReference23(query, searchParamKeys) {
26416
28323
  const referenceCodes = new Set(
26417
28324
  getRegisteredSearchParameters(PATIENT_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
26418
28325
  );
@@ -26435,7 +28342,7 @@ function findMalformedReference10(query, searchParamKeys) {
26435
28342
  return void 0;
26436
28343
  }
26437
28344
  async function listPatientsRoute(req, res) {
26438
- const searchParamKeys = extractSearchParamKeys10(
28345
+ const searchParamKeys = extractSearchParamKeys23(
26439
28346
  req.query
26440
28347
  );
26441
28348
  if (searchParamKeys.length === 0) {
@@ -26451,17 +28358,17 @@ async function listPatientsRoute(req, res) {
26451
28358
  const validCodes = new Set(registered.map((p) => p.code));
26452
28359
  const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
26453
28360
  if (unknownCodes.length > 0) {
26454
- return sendInvalidSearch40010(
28361
+ return sendInvalidSearch40023(
26455
28362
  res,
26456
- buildUnknownParamDiagnostics10([...new Set(unknownCodes)])
28363
+ buildUnknownParamDiagnostics23([...new Set(unknownCodes)])
26457
28364
  );
26458
28365
  }
26459
- const malformedRef = findMalformedReference10(
28366
+ const malformedRef = findMalformedReference23(
26460
28367
  req.query,
26461
28368
  searchParamKeys
26462
28369
  );
26463
28370
  if (malformedRef !== void 0) {
26464
- return sendInvalidSearch40010(
28371
+ return sendInvalidSearch40023(
26465
28372
  res,
26466
28373
  `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
26467
28374
  );
@@ -26672,15 +28579,118 @@ async function listPaymentNoticesOperation(params) {
26672
28579
  }
26673
28580
 
26674
28581
  // src/data/rest-api/routes/data/paymentnotice/paymentnotice-list-route.ts
26675
- async function listPaymentNoticesRoute(req, res) {
26676
- return handleListRoute({
26677
- req,
26678
- res,
26679
- basePath: BASE_PATH.PAYMENTNOTICE,
26680
- listOperation: listPaymentNoticesOperation,
26681
- errorLogContext: "GET /PaymentNotice list error:"
28582
+ var PAYMENTNOTICE_RESOURCE_TYPE = "PaymentNotice";
28583
+ function stripModifier24(key) {
28584
+ const idx = key.indexOf(":");
28585
+ return idx === -1 ? key : key.slice(0, idx);
28586
+ }
28587
+ function isResultParameter24(key) {
28588
+ return key.startsWith("_");
28589
+ }
28590
+ function sendInvalidSearch40024(res, diagnostics) {
28591
+ return res.status(400).json({
28592
+ resourceType: "OperationOutcome",
28593
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
26682
28594
  });
26683
28595
  }
28596
+ function extractSearchParamKeys24(query) {
28597
+ const out = [];
28598
+ for (const rawKey of Object.keys(query)) {
28599
+ if (isResultParameter24(rawKey)) {
28600
+ continue;
28601
+ }
28602
+ out.push({ rawKey, code: stripModifier24(rawKey) });
28603
+ }
28604
+ return out;
28605
+ }
28606
+ function buildUnknownParamDiagnostics24(unknownCodes) {
28607
+ const validCodes = getRegisteredSearchParameters(PAYMENTNOTICE_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
28608
+ const codes = unknownCodes.join(", ");
28609
+ const isPlural = unknownCodes.length !== 1;
28610
+ return [
28611
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for PaymentNotice: ${codes}.`,
28612
+ `Valid codes: ${validCodes}.`
28613
+ ].join(" ");
28614
+ }
28615
+ function findMalformedReference24(query, searchParamKeys) {
28616
+ const referenceCodes = new Set(
28617
+ getRegisteredSearchParameters(PAYMENTNOTICE_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
28618
+ );
28619
+ if (referenceCodes.size === 0) {
28620
+ return void 0;
28621
+ }
28622
+ for (const { rawKey, code } of searchParamKeys) {
28623
+ if (!referenceCodes.has(code)) {
28624
+ continue;
28625
+ }
28626
+ const raw = query[rawKey];
28627
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
28628
+ for (const v of values) {
28629
+ const trimmed = v.trim();
28630
+ if (trimmed.length === 0) {
28631
+ continue;
28632
+ }
28633
+ if (parseTypedReference(trimmed) === void 0) {
28634
+ return { rawKey, value: trimmed };
28635
+ }
28636
+ }
28637
+ }
28638
+ return void 0;
28639
+ }
28640
+ async function listPaymentNoticesRoute(req, res) {
28641
+ const searchParamKeys = extractSearchParamKeys24(
28642
+ req.query
28643
+ );
28644
+ if (searchParamKeys.length === 0) {
28645
+ return handleListRoute({
28646
+ req,
28647
+ res,
28648
+ basePath: BASE_PATH.PAYMENTNOTICE,
28649
+ listOperation: listPaymentNoticesOperation,
28650
+ errorLogContext: "GET /PaymentNotice list error:"
28651
+ });
28652
+ }
28653
+ const registered = getRegisteredSearchParameters(PAYMENTNOTICE_RESOURCE_TYPE);
28654
+ const validCodes = new Set(registered.map((p) => p.code));
28655
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
28656
+ if (unknownCodes.length > 0) {
28657
+ return sendInvalidSearch40024(
28658
+ res,
28659
+ buildUnknownParamDiagnostics24([...new Set(unknownCodes)])
28660
+ );
28661
+ }
28662
+ const malformedRef = findMalformedReference24(
28663
+ req.query,
28664
+ searchParamKeys
28665
+ );
28666
+ if (malformedRef !== void 0) {
28667
+ return sendInvalidSearch40024(
28668
+ res,
28669
+ `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
28670
+ );
28671
+ }
28672
+ const ctx = req.openhiContext;
28673
+ try {
28674
+ const result = await genericSearchOperation({
28675
+ resourceType: PAYMENTNOTICE_RESOURCE_TYPE,
28676
+ tenantId: ctx.tenantId,
28677
+ workspaceId: ctx.workspaceId,
28678
+ query: req.query,
28679
+ resolver: defaultSearchParameterResolver
28680
+ });
28681
+ const bundle = buildSearchsetBundle(
28682
+ BASE_PATH.PAYMENTNOTICE,
28683
+ result.entries
28684
+ );
28685
+ return res.json(bundle);
28686
+ } catch (err) {
28687
+ return sendOperationOutcome500(
28688
+ res,
28689
+ err,
28690
+ "GET /PaymentNotice search error:"
28691
+ );
28692
+ }
28693
+ }
26684
28694
 
26685
28695
  // src/data/operations/data/paymentnotice/paymentnotice-update-operation.ts
26686
28696
  async function updatePaymentNoticeOperation(params) {
@@ -27409,63 +29419,159 @@ async function deletePractitionerRoute(req, res) {
27409
29419
  } catch (err) {
27410
29420
  return sendOperationOutcome500(res, err, "DELETE Practitioner error:");
27411
29421
  }
27412
- }
27413
-
27414
- // src/data/operations/data/practitioner/practitioner-get-by-id-operation.ts
27415
- async function getPractitionerByIdOperation(params) {
27416
- const { context, id, tableName } = params;
27417
- const { tenantId, workspaceId } = context;
27418
- const service = getDynamoDataService(tableName);
27419
- return getDataEntityById(
27420
- service.entities.practitioner,
27421
- tenantId,
27422
- workspaceId,
27423
- id,
27424
- "Practitioner"
29422
+ }
29423
+
29424
+ // src/data/operations/data/practitioner/practitioner-get-by-id-operation.ts
29425
+ async function getPractitionerByIdOperation(params) {
29426
+ const { context, id, tableName } = params;
29427
+ const { tenantId, workspaceId } = context;
29428
+ const service = getDynamoDataService(tableName);
29429
+ return getDataEntityById(
29430
+ service.entities.practitioner,
29431
+ tenantId,
29432
+ workspaceId,
29433
+ id,
29434
+ "Practitioner"
29435
+ );
29436
+ }
29437
+
29438
+ // src/data/rest-api/routes/data/practitioner/practitioner-get-by-id-route.ts
29439
+ async function getPractitionerByIdRoute(req, res) {
29440
+ const id = String(req.params.id);
29441
+ const ctx = req.openhiContext;
29442
+ try {
29443
+ const result = await getPractitionerByIdOperation({ context: ctx, id });
29444
+ return res.json(result.resource);
29445
+ } catch (err) {
29446
+ const status = domainErrorToHttpStatus(err);
29447
+ if (status === 404) {
29448
+ const diagnostics = err instanceof NotFoundError ? err.message : `Practitioner ${id} not found`;
29449
+ return sendOperationOutcome404(res, diagnostics);
29450
+ }
29451
+ return sendOperationOutcome500(res, err, "GET Practitioner error:");
29452
+ }
29453
+ }
29454
+
29455
+ // src/data/operations/data/practitioner/practitioner-list-operation.ts
29456
+ async function listPractitionersOperation(params) {
29457
+ const { context, tableName, mode } = params;
29458
+ const { tenantId, workspaceId } = context;
29459
+ const service = getDynamoDataService(tableName);
29460
+ return listDataEntitiesByWorkspace(
29461
+ service.entities.practitioner,
29462
+ tenantId,
29463
+ workspaceId,
29464
+ mode
29465
+ );
29466
+ }
29467
+
29468
+ // src/data/rest-api/routes/data/practitioner/practitioner-list-route.ts
29469
+ var PRACTITIONER_RESOURCE_TYPE = "Practitioner";
29470
+ function stripModifier25(key) {
29471
+ const idx = key.indexOf(":");
29472
+ return idx === -1 ? key : key.slice(0, idx);
29473
+ }
29474
+ function isResultParameter25(key) {
29475
+ return key.startsWith("_");
29476
+ }
29477
+ function sendInvalidSearch40025(res, diagnostics) {
29478
+ return res.status(400).json({
29479
+ resourceType: "OperationOutcome",
29480
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
29481
+ });
29482
+ }
29483
+ function extractSearchParamKeys25(query) {
29484
+ const out = [];
29485
+ for (const rawKey of Object.keys(query)) {
29486
+ if (isResultParameter25(rawKey)) {
29487
+ continue;
29488
+ }
29489
+ out.push({ rawKey, code: stripModifier25(rawKey) });
29490
+ }
29491
+ return out;
29492
+ }
29493
+ function buildUnknownParamDiagnostics25(unknownCodes) {
29494
+ const validCodes = getRegisteredSearchParameters(PRACTITIONER_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
29495
+ const codes = unknownCodes.join(", ");
29496
+ const isPlural = unknownCodes.length !== 1;
29497
+ return [
29498
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Practitioner: ${codes}.`,
29499
+ `Valid codes: ${validCodes}.`
29500
+ ].join(" ");
29501
+ }
29502
+ function findMalformedReference25(query, searchParamKeys) {
29503
+ const referenceCodes = new Set(
29504
+ getRegisteredSearchParameters(PRACTITIONER_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
29505
+ );
29506
+ if (referenceCodes.size === 0) {
29507
+ return void 0;
29508
+ }
29509
+ for (const { rawKey, code } of searchParamKeys) {
29510
+ if (!referenceCodes.has(code)) {
29511
+ continue;
29512
+ }
29513
+ const raw = query[rawKey];
29514
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
29515
+ for (const v of values) {
29516
+ const trimmed = v.trim();
29517
+ if (trimmed.length === 0) {
29518
+ continue;
29519
+ }
29520
+ if (parseTypedReference(trimmed) === void 0) {
29521
+ return { rawKey, value: trimmed };
29522
+ }
29523
+ }
29524
+ }
29525
+ return void 0;
29526
+ }
29527
+ async function listPractitionersRoute(req, res) {
29528
+ const searchParamKeys = extractSearchParamKeys25(
29529
+ req.query
29530
+ );
29531
+ if (searchParamKeys.length === 0) {
29532
+ return handleListRoute({
29533
+ req,
29534
+ res,
29535
+ basePath: BASE_PATH.PRACTITIONER,
29536
+ listOperation: listPractitionersOperation,
29537
+ errorLogContext: "GET /Practitioner list error:"
29538
+ });
29539
+ }
29540
+ const registered = getRegisteredSearchParameters(PRACTITIONER_RESOURCE_TYPE);
29541
+ const validCodes = new Set(registered.map((p) => p.code));
29542
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
29543
+ if (unknownCodes.length > 0) {
29544
+ return sendInvalidSearch40025(
29545
+ res,
29546
+ buildUnknownParamDiagnostics25([...new Set(unknownCodes)])
29547
+ );
29548
+ }
29549
+ const malformedRef = findMalformedReference25(
29550
+ req.query,
29551
+ searchParamKeys
27425
29552
  );
27426
- }
27427
-
27428
- // src/data/rest-api/routes/data/practitioner/practitioner-get-by-id-route.ts
27429
- async function getPractitionerByIdRoute(req, res) {
27430
- const id = String(req.params.id);
29553
+ if (malformedRef !== void 0) {
29554
+ return sendInvalidSearch40025(
29555
+ res,
29556
+ `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
29557
+ );
29558
+ }
27431
29559
  const ctx = req.openhiContext;
27432
29560
  try {
27433
- const result = await getPractitionerByIdOperation({ context: ctx, id });
27434
- return res.json(result.resource);
29561
+ const result = await genericSearchOperation({
29562
+ resourceType: PRACTITIONER_RESOURCE_TYPE,
29563
+ tenantId: ctx.tenantId,
29564
+ workspaceId: ctx.workspaceId,
29565
+ query: req.query,
29566
+ resolver: defaultSearchParameterResolver
29567
+ });
29568
+ const bundle = buildSearchsetBundle(BASE_PATH.PRACTITIONER, result.entries);
29569
+ return res.json(bundle);
27435
29570
  } catch (err) {
27436
- const status = domainErrorToHttpStatus(err);
27437
- if (status === 404) {
27438
- const diagnostics = err instanceof NotFoundError ? err.message : `Practitioner ${id} not found`;
27439
- return sendOperationOutcome404(res, diagnostics);
27440
- }
27441
- return sendOperationOutcome500(res, err, "GET Practitioner error:");
29571
+ return sendOperationOutcome500(res, err, "GET /Practitioner search error:");
27442
29572
  }
27443
29573
  }
27444
29574
 
27445
- // src/data/operations/data/practitioner/practitioner-list-operation.ts
27446
- async function listPractitionersOperation(params) {
27447
- const { context, tableName, mode } = params;
27448
- const { tenantId, workspaceId } = context;
27449
- const service = getDynamoDataService(tableName);
27450
- return listDataEntitiesByWorkspace(
27451
- service.entities.practitioner,
27452
- tenantId,
27453
- workspaceId,
27454
- mode
27455
- );
27456
- }
27457
-
27458
- // src/data/rest-api/routes/data/practitioner/practitioner-list-route.ts
27459
- async function listPractitionersRoute(req, res) {
27460
- return handleListRoute({
27461
- req,
27462
- res,
27463
- basePath: BASE_PATH.PRACTITIONER,
27464
- listOperation: listPractitionersOperation,
27465
- errorLogContext: "GET /Practitioner list error:"
27466
- });
27467
- }
27468
-
27469
29575
  // src/data/operations/data/practitioner/practitioner-update-operation.ts
27470
29576
  async function updatePractitionerOperation(params) {
27471
29577
  const { context, id, body, tableName } = params;
@@ -27600,15 +29706,119 @@ async function getPractitionerRoleByIdRoute(req, res) {
27600
29706
  }
27601
29707
 
27602
29708
  // src/data/rest-api/routes/data/practitionerrole/practitionerrole-list-route.ts
27603
- async function listPractitionerRolesRoute(req, res) {
27604
- return handleListRoute({
27605
- req,
27606
- res,
27607
- basePath: BASE_PATH.PRACTITIONERROLE,
27608
- listOperation: listPractitionerRolesOperation,
27609
- errorLogContext: "GET /PractitionerRole list error:"
29709
+ var PRACTITIONERROLE_RESOURCE_TYPE = "PractitionerRole";
29710
+ function stripModifier26(key) {
29711
+ const idx = key.indexOf(":");
29712
+ return idx === -1 ? key : key.slice(0, idx);
29713
+ }
29714
+ function isResultParameter26(key) {
29715
+ return key.startsWith("_");
29716
+ }
29717
+ function sendInvalidSearch40026(res, diagnostics) {
29718
+ return res.status(400).json({
29719
+ resourceType: "OperationOutcome",
29720
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
27610
29721
  });
27611
29722
  }
29723
+ function extractSearchParamKeys26(query) {
29724
+ const out = [];
29725
+ for (const rawKey of Object.keys(query)) {
29726
+ if (isResultParameter26(rawKey)) {
29727
+ continue;
29728
+ }
29729
+ out.push({ rawKey, code: stripModifier26(rawKey) });
29730
+ }
29731
+ return out;
29732
+ }
29733
+ function buildUnknownParamDiagnostics26(unknownCodes) {
29734
+ const validCodes = getRegisteredSearchParameters(
29735
+ PRACTITIONERROLE_RESOURCE_TYPE
29736
+ ).map((p) => p.code).sort().join(", ");
29737
+ const codes = unknownCodes.join(", ");
29738
+ const isPlural = unknownCodes.length !== 1;
29739
+ return [
29740
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for PractitionerRole: ${codes}.`,
29741
+ `Valid codes: ${validCodes}.`
29742
+ ].join(" ");
29743
+ }
29744
+ function findMalformedReference26(query, searchParamKeys) {
29745
+ const referenceCodes = new Set(
29746
+ getRegisteredSearchParameters(PRACTITIONERROLE_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
29747
+ );
29748
+ for (const { rawKey, code } of searchParamKeys) {
29749
+ if (!referenceCodes.has(code)) {
29750
+ continue;
29751
+ }
29752
+ const raw = query[rawKey];
29753
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
29754
+ for (const v of values) {
29755
+ const trimmed = v.trim();
29756
+ if (trimmed.length === 0) {
29757
+ continue;
29758
+ }
29759
+ if (parseTypedReference(trimmed) === void 0) {
29760
+ return { rawKey, value: trimmed };
29761
+ }
29762
+ }
29763
+ }
29764
+ return void 0;
29765
+ }
29766
+ async function listPractitionerRolesRoute(req, res) {
29767
+ const searchParamKeys = extractSearchParamKeys26(
29768
+ req.query
29769
+ );
29770
+ if (searchParamKeys.length === 0) {
29771
+ return handleListRoute({
29772
+ req,
29773
+ res,
29774
+ basePath: BASE_PATH.PRACTITIONERROLE,
29775
+ listOperation: listPractitionerRolesOperation,
29776
+ errorLogContext: "GET /PractitionerRole list error:"
29777
+ });
29778
+ }
29779
+ const registered = getRegisteredSearchParameters(
29780
+ PRACTITIONERROLE_RESOURCE_TYPE
29781
+ );
29782
+ const validCodes = new Set(registered.map((p) => p.code));
29783
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
29784
+ if (unknownCodes.length > 0) {
29785
+ return sendInvalidSearch40026(
29786
+ res,
29787
+ buildUnknownParamDiagnostics26([...new Set(unknownCodes)])
29788
+ );
29789
+ }
29790
+ const malformedRef = findMalformedReference26(
29791
+ req.query,
29792
+ searchParamKeys
29793
+ );
29794
+ if (malformedRef !== void 0) {
29795
+ return sendInvalidSearch40026(
29796
+ res,
29797
+ `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
29798
+ );
29799
+ }
29800
+ const ctx = req.openhiContext;
29801
+ try {
29802
+ const result = await genericSearchOperation({
29803
+ resourceType: PRACTITIONERROLE_RESOURCE_TYPE,
29804
+ tenantId: ctx.tenantId,
29805
+ workspaceId: ctx.workspaceId,
29806
+ query: req.query,
29807
+ resolver: defaultSearchParameterResolver
29808
+ });
29809
+ const bundle = buildSearchsetBundle(
29810
+ BASE_PATH.PRACTITIONERROLE,
29811
+ result.entries
29812
+ );
29813
+ return res.json(bundle);
29814
+ } catch (err) {
29815
+ return sendOperationOutcome500(
29816
+ res,
29817
+ err,
29818
+ "GET /PractitionerRole search error:"
29819
+ );
29820
+ }
29821
+ }
27612
29822
 
27613
29823
  // src/data/operations/data/practitionerrole/practitionerrole-update-operation.ts
27614
29824
  async function updatePractitionerRoleOperation(params) {
@@ -27801,30 +30011,30 @@ async function listProceduresOperation(params) {
27801
30011
 
27802
30012
  // src/data/rest-api/routes/data/procedure/procedure-list-route.ts
27803
30013
  var PROCEDURE_RESOURCE_TYPE = "Procedure";
27804
- function stripModifier11(key) {
30014
+ function stripModifier27(key) {
27805
30015
  const idx = key.indexOf(":");
27806
30016
  return idx === -1 ? key : key.slice(0, idx);
27807
30017
  }
27808
- function isResultParameter11(key) {
30018
+ function isResultParameter27(key) {
27809
30019
  return key.startsWith("_");
27810
30020
  }
27811
- function sendInvalidSearch40011(res, diagnostics) {
30021
+ function sendInvalidSearch40027(res, diagnostics) {
27812
30022
  return res.status(400).json({
27813
30023
  resourceType: "OperationOutcome",
27814
30024
  issue: [{ severity: "error", code: "invalid", diagnostics }]
27815
30025
  });
27816
30026
  }
27817
- function extractSearchParamKeys11(query) {
30027
+ function extractSearchParamKeys27(query) {
27818
30028
  const out = [];
27819
30029
  for (const rawKey of Object.keys(query)) {
27820
- if (isResultParameter11(rawKey)) {
30030
+ if (isResultParameter27(rawKey)) {
27821
30031
  continue;
27822
30032
  }
27823
- out.push({ rawKey, code: stripModifier11(rawKey) });
30033
+ out.push({ rawKey, code: stripModifier27(rawKey) });
27824
30034
  }
27825
30035
  return out;
27826
30036
  }
27827
- function buildUnknownParamDiagnostics11(unknownCodes) {
30037
+ function buildUnknownParamDiagnostics27(unknownCodes) {
27828
30038
  const validCodes = getRegisteredSearchParameters(PROCEDURE_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
27829
30039
  const codes = unknownCodes.join(", ");
27830
30040
  const isPlural = unknownCodes.length !== 1;
@@ -27833,7 +30043,7 @@ function buildUnknownParamDiagnostics11(unknownCodes) {
27833
30043
  `Valid codes: ${validCodes}.`
27834
30044
  ].join(" ");
27835
30045
  }
27836
- function findMalformedReference11(query, searchParamKeys) {
30046
+ function findMalformedReference27(query, searchParamKeys) {
27837
30047
  const referenceCodes = new Set(
27838
30048
  getRegisteredSearchParameters(PROCEDURE_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
27839
30049
  );
@@ -27856,7 +30066,7 @@ function findMalformedReference11(query, searchParamKeys) {
27856
30066
  return void 0;
27857
30067
  }
27858
30068
  async function listProceduresRoute(req, res) {
27859
- const searchParamKeys = extractSearchParamKeys11(
30069
+ const searchParamKeys = extractSearchParamKeys27(
27860
30070
  req.query
27861
30071
  );
27862
30072
  if (searchParamKeys.length === 0) {
@@ -27872,17 +30082,17 @@ async function listProceduresRoute(req, res) {
27872
30082
  const validCodes = new Set(registered.map((p) => p.code));
27873
30083
  const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
27874
30084
  if (unknownCodes.length > 0) {
27875
- return sendInvalidSearch40011(
30085
+ return sendInvalidSearch40027(
27876
30086
  res,
27877
- buildUnknownParamDiagnostics11([...new Set(unknownCodes)])
30087
+ buildUnknownParamDiagnostics27([...new Set(unknownCodes)])
27878
30088
  );
27879
30089
  }
27880
- const malformedRef = findMalformedReference11(
30090
+ const malformedRef = findMalformedReference27(
27881
30091
  req.query,
27882
30092
  searchParamKeys
27883
30093
  );
27884
30094
  if (malformedRef !== void 0) {
27885
- return sendInvalidSearch40011(
30095
+ return sendInvalidSearch40027(
27886
30096
  res,
27887
30097
  `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
27888
30098
  );
@@ -28679,49 +30889,149 @@ async function getRelatedPersonByIdOperation(params) {
28679
30889
  id,
28680
30890
  "RelatedPerson"
28681
30891
  );
28682
- }
28683
-
28684
- // src/data/rest-api/routes/data/relatedperson/relatedperson-get-by-id-route.ts
28685
- async function getRelatedPersonByIdRoute(req, res) {
28686
- const id = String(req.params.id);
30892
+ }
30893
+
30894
+ // src/data/rest-api/routes/data/relatedperson/relatedperson-get-by-id-route.ts
30895
+ async function getRelatedPersonByIdRoute(req, res) {
30896
+ const id = String(req.params.id);
30897
+ const ctx = req.openhiContext;
30898
+ try {
30899
+ const result = await getRelatedPersonByIdOperation({ context: ctx, id });
30900
+ return res.json(result.resource);
30901
+ } catch (err) {
30902
+ const status = domainErrorToHttpStatus(err);
30903
+ if (status === 404) {
30904
+ const diagnostics = err instanceof NotFoundError ? err.message : `RelatedPerson ${id} not found`;
30905
+ return sendOperationOutcome404(res, diagnostics);
30906
+ }
30907
+ return sendOperationOutcome500(res, err, "GET RelatedPerson error:");
30908
+ }
30909
+ }
30910
+
30911
+ // src/data/operations/data/relatedperson/relatedperson-list-operation.ts
30912
+ async function listRelatedPersonsOperation(params) {
30913
+ const { context, tableName, mode } = params;
30914
+ const { tenantId, workspaceId } = context;
30915
+ const service = getDynamoDataService(tableName);
30916
+ return listDataEntitiesByWorkspace(
30917
+ service.entities.relatedperson,
30918
+ tenantId,
30919
+ workspaceId,
30920
+ mode
30921
+ );
30922
+ }
30923
+
30924
+ // src/data/rest-api/routes/data/relatedperson/relatedperson-list-route.ts
30925
+ var RELATEDPERSON_RESOURCE_TYPE = "RelatedPerson";
30926
+ function stripModifier28(key) {
30927
+ const idx = key.indexOf(":");
30928
+ return idx === -1 ? key : key.slice(0, idx);
30929
+ }
30930
+ function isResultParameter28(key) {
30931
+ return key.startsWith("_");
30932
+ }
30933
+ function sendInvalidSearch40028(res, diagnostics) {
30934
+ return res.status(400).json({
30935
+ resourceType: "OperationOutcome",
30936
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
30937
+ });
30938
+ }
30939
+ function extractSearchParamKeys28(query) {
30940
+ const out = [];
30941
+ for (const rawKey of Object.keys(query)) {
30942
+ if (isResultParameter28(rawKey)) {
30943
+ continue;
30944
+ }
30945
+ out.push({ rawKey, code: stripModifier28(rawKey) });
30946
+ }
30947
+ return out;
30948
+ }
30949
+ function buildUnknownParamDiagnostics28(unknownCodes) {
30950
+ const validCodes = getRegisteredSearchParameters(RELATEDPERSON_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
30951
+ const codes = unknownCodes.join(", ");
30952
+ const isPlural = unknownCodes.length !== 1;
30953
+ return [
30954
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for RelatedPerson: ${codes}.`,
30955
+ `Valid codes: ${validCodes}.`
30956
+ ].join(" ");
30957
+ }
30958
+ function findMalformedReference28(query, searchParamKeys) {
30959
+ const referenceCodes = new Set(
30960
+ getRegisteredSearchParameters(RELATEDPERSON_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
30961
+ );
30962
+ for (const { rawKey, code } of searchParamKeys) {
30963
+ if (!referenceCodes.has(code)) {
30964
+ continue;
30965
+ }
30966
+ const raw = query[rawKey];
30967
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
30968
+ for (const v of values) {
30969
+ const trimmed = v.trim();
30970
+ if (trimmed.length === 0) {
30971
+ continue;
30972
+ }
30973
+ if (parseTypedReference(trimmed) === void 0) {
30974
+ return { rawKey, value: trimmed };
30975
+ }
30976
+ }
30977
+ }
30978
+ return void 0;
30979
+ }
30980
+ async function listRelatedPersonsRoute(req, res) {
30981
+ const searchParamKeys = extractSearchParamKeys28(
30982
+ req.query
30983
+ );
30984
+ if (searchParamKeys.length === 0) {
30985
+ return handleListRoute({
30986
+ req,
30987
+ res,
30988
+ basePath: BASE_PATH.RELATEDPERSON,
30989
+ listOperation: listRelatedPersonsOperation,
30990
+ errorLogContext: "GET /RelatedPerson list error:"
30991
+ });
30992
+ }
30993
+ const registered = getRegisteredSearchParameters(RELATEDPERSON_RESOURCE_TYPE);
30994
+ const validCodes = new Set(registered.map((p) => p.code));
30995
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
30996
+ if (unknownCodes.length > 0) {
30997
+ return sendInvalidSearch40028(
30998
+ res,
30999
+ buildUnknownParamDiagnostics28([...new Set(unknownCodes)])
31000
+ );
31001
+ }
31002
+ const malformedRef = findMalformedReference28(
31003
+ req.query,
31004
+ searchParamKeys
31005
+ );
31006
+ if (malformedRef !== void 0) {
31007
+ return sendInvalidSearch40028(
31008
+ res,
31009
+ `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
31010
+ );
31011
+ }
28687
31012
  const ctx = req.openhiContext;
28688
31013
  try {
28689
- const result = await getRelatedPersonByIdOperation({ context: ctx, id });
28690
- return res.json(result.resource);
31014
+ const result = await genericSearchOperation({
31015
+ resourceType: RELATEDPERSON_RESOURCE_TYPE,
31016
+ tenantId: ctx.tenantId,
31017
+ workspaceId: ctx.workspaceId,
31018
+ query: req.query,
31019
+ resolver: defaultSearchParameterResolver
31020
+ });
31021
+ const bundle = buildSearchsetBundle(
31022
+ BASE_PATH.RELATEDPERSON,
31023
+ result.entries
31024
+ );
31025
+ return res.json(bundle);
28691
31026
  } catch (err) {
28692
- const status = domainErrorToHttpStatus(err);
28693
- if (status === 404) {
28694
- const diagnostics = err instanceof NotFoundError ? err.message : `RelatedPerson ${id} not found`;
28695
- return sendOperationOutcome404(res, diagnostics);
28696
- }
28697
- return sendOperationOutcome500(res, err, "GET RelatedPerson error:");
31027
+ return sendOperationOutcome500(
31028
+ res,
31029
+ err,
31030
+ "GET /RelatedPerson search error:"
31031
+ );
28698
31032
  }
28699
31033
  }
28700
31034
 
28701
- // src/data/operations/data/relatedperson/relatedperson-list-operation.ts
28702
- async function listRelatedPersonsOperation(params) {
28703
- const { context, tableName, mode } = params;
28704
- const { tenantId, workspaceId } = context;
28705
- const service = getDynamoDataService(tableName);
28706
- return listDataEntitiesByWorkspace(
28707
- service.entities.relatedperson,
28708
- tenantId,
28709
- workspaceId,
28710
- mode
28711
- );
28712
- }
28713
-
28714
- // src/data/rest-api/routes/data/relatedperson/relatedperson-list-route.ts
28715
- async function listRelatedPersonsRoute(req, res) {
28716
- return handleListRoute({
28717
- req,
28718
- res,
28719
- basePath: BASE_PATH.RELATEDPERSON,
28720
- listOperation: listRelatedPersonsOperation,
28721
- errorLogContext: "GET /RelatedPerson list error:"
28722
- });
28723
- }
28724
-
28725
31035
  // src/data/operations/data/relatedperson/relatedperson-update-operation.ts
28726
31036
  async function updateRelatedPersonOperation(params) {
28727
31037
  const { context, id, body, tableName } = params;
@@ -30356,97 +32666,108 @@ async function listSchedulesOperation(params) {
30356
32666
  );
30357
32667
  }
30358
32668
 
30359
- // src/data/operations/data/schedule/schedule-search-by-actor-operation.ts
30360
- var DEFAULT_LIMIT2 = 100;
30361
- function buildSearchSchedulesByActorSql() {
30362
- return [
30363
- "SELECT resource_id AS id, resource",
30364
- "FROM resources",
30365
- "WHERE tenant_id = :tenantId",
30366
- " AND workspace_id = :workspaceId",
30367
- " AND resource_type = 'Schedule'",
30368
- " AND deleted_at IS NULL",
30369
- ` AND ${REFERENCE_CONTAINMENT_SQL_FRAGMENT}`,
30370
- "ORDER BY last_updated DESC",
30371
- "LIMIT :limit;"
30372
- ].join("\n");
30373
- }
30374
- async function searchSchedulesByActorOperation(params) {
30375
- const { context, actorReference } = params;
30376
- const { tenantId, workspaceId } = context;
30377
- const runner = params.runner ?? getDefaultPostgresQueryRunner();
30378
- const limit = params.limit ?? DEFAULT_LIMIT2;
30379
- const { containmentRelative, containmentUrn } = buildReferenceContainmentPayload({
30380
- shape: { kind: "array-of-references", field: "actor" },
30381
- reference: actorReference,
30382
- tenantId,
30383
- workspaceId
30384
- });
30385
- const queryParams = [
30386
- { name: "tenantId", value: tenantId },
30387
- { name: "workspaceId", value: workspaceId },
30388
- { name: "containmentRelative", value: containmentRelative },
30389
- { name: "containmentUrn", value: containmentUrn },
30390
- { name: "limit", value: limit }
30391
- ];
30392
- const rows = await runner.query(
30393
- buildSearchSchedulesByActorSql(),
30394
- queryParams
30395
- );
30396
- const entries = rows.map((row) => ({
30397
- id: row.id,
30398
- resource: { ...row.resource, id: row.id }
30399
- }));
30400
- return { entries, total: entries.length };
30401
- }
30402
-
30403
32669
  // src/data/rest-api/routes/data/schedule/schedule-list-route.ts
30404
- function singleStringQueryParam(req, name) {
30405
- const v = req.query[name];
30406
- if (typeof v !== "string") {
30407
- return void 0;
30408
- }
30409
- const trimmed = v.trim();
30410
- return trimmed === "" ? void 0 : trimmed;
32670
+ var SCHEDULE_RESOURCE_TYPE = "Schedule";
32671
+ function stripModifier29(key) {
32672
+ const idx = key.indexOf(":");
32673
+ return idx === -1 ? key : key.slice(0, idx);
30411
32674
  }
30412
- function sendInvalidSearch40012(res, diagnostics) {
32675
+ function isResultParameter29(key) {
32676
+ return key.startsWith("_");
32677
+ }
32678
+ function sendInvalidSearch40029(res, diagnostics) {
30413
32679
  return res.status(400).json({
30414
32680
  resourceType: "OperationOutcome",
30415
32681
  issue: [{ severity: "error", code: "invalid", diagnostics }]
30416
32682
  });
30417
32683
  }
30418
- async function listSchedulesRoute(req, res) {
30419
- const actorRef = singleStringQueryParam(req, "actor");
30420
- if (actorRef !== void 0) {
30421
- if (parseTypedReference(actorRef) === void 0) {
30422
- return sendInvalidSearch40012(
30423
- res,
30424
- `?actor must be a typed reference like "Practitioner/<id>"; got "${actorRef}".`
30425
- );
32684
+ function extractSearchParamKeys29(query) {
32685
+ const out = [];
32686
+ for (const rawKey of Object.keys(query)) {
32687
+ if (isResultParameter29(rawKey)) {
32688
+ continue;
30426
32689
  }
30427
- const ctx = req.openhiContext;
30428
- try {
30429
- const result = await searchSchedulesByActorOperation({
30430
- context: ctx,
30431
- actorReference: actorRef
30432
- });
30433
- const bundle = buildSearchsetBundle(BASE_PATH.SCHEDULE, result.entries);
30434
- return res.json(bundle);
30435
- } catch (err) {
30436
- return sendOperationOutcome500(
30437
- res,
30438
- err,
30439
- "GET /Schedule?actor= search error:"
30440
- );
32690
+ out.push({ rawKey, code: stripModifier29(rawKey) });
32691
+ }
32692
+ return out;
32693
+ }
32694
+ function buildUnknownParamDiagnostics29(unknownCodes) {
32695
+ const validCodes = getRegisteredSearchParameters(SCHEDULE_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
32696
+ const codes = unknownCodes.join(", ");
32697
+ const isPlural = unknownCodes.length !== 1;
32698
+ return [
32699
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Schedule: ${codes}.`,
32700
+ `Valid codes: ${validCodes}.`
32701
+ ].join(" ");
32702
+ }
32703
+ function findMalformedReference29(query, searchParamKeys) {
32704
+ const referenceCodes = new Set(
32705
+ getRegisteredSearchParameters(SCHEDULE_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
32706
+ );
32707
+ for (const { rawKey, code } of searchParamKeys) {
32708
+ if (!referenceCodes.has(code)) {
32709
+ continue;
32710
+ }
32711
+ const raw = query[rawKey];
32712
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
32713
+ for (const v of values) {
32714
+ const trimmed = v.trim();
32715
+ if (trimmed.length === 0) {
32716
+ continue;
32717
+ }
32718
+ if (parseTypedReference(trimmed) === void 0) {
32719
+ return { rawKey, value: trimmed };
32720
+ }
30441
32721
  }
30442
32722
  }
30443
- return handleListRoute({
30444
- req,
30445
- res,
30446
- basePath: BASE_PATH.SCHEDULE,
30447
- listOperation: listSchedulesOperation,
30448
- errorLogContext: "GET /Schedule list error:"
30449
- });
32723
+ return void 0;
32724
+ }
32725
+ async function listSchedulesRoute(req, res) {
32726
+ const searchParamKeys = extractSearchParamKeys29(
32727
+ req.query
32728
+ );
32729
+ if (searchParamKeys.length === 0) {
32730
+ return handleListRoute({
32731
+ req,
32732
+ res,
32733
+ basePath: BASE_PATH.SCHEDULE,
32734
+ listOperation: listSchedulesOperation,
32735
+ errorLogContext: "GET /Schedule list error:"
32736
+ });
32737
+ }
32738
+ const registered = getRegisteredSearchParameters(SCHEDULE_RESOURCE_TYPE);
32739
+ const validCodes = new Set(registered.map((p) => p.code));
32740
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
32741
+ if (unknownCodes.length > 0) {
32742
+ return sendInvalidSearch40029(
32743
+ res,
32744
+ buildUnknownParamDiagnostics29([...new Set(unknownCodes)])
32745
+ );
32746
+ }
32747
+ const malformedRef = findMalformedReference29(
32748
+ req.query,
32749
+ searchParamKeys
32750
+ );
32751
+ if (malformedRef !== void 0) {
32752
+ return sendInvalidSearch40029(
32753
+ res,
32754
+ `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
32755
+ );
32756
+ }
32757
+ const ctx = req.openhiContext;
32758
+ try {
32759
+ const result = await genericSearchOperation({
32760
+ resourceType: SCHEDULE_RESOURCE_TYPE,
32761
+ tenantId: ctx.tenantId,
32762
+ workspaceId: ctx.workspaceId,
32763
+ query: req.query,
32764
+ resolver: defaultSearchParameterResolver
32765
+ });
32766
+ const bundle = buildSearchsetBundle(BASE_PATH.SCHEDULE, result.entries);
32767
+ return res.json(bundle);
32768
+ } catch (err) {
32769
+ return sendOperationOutcome500(res, err, "GET /Schedule search error:");
32770
+ }
30450
32771
  }
30451
32772
 
30452
32773
  // src/data/operations/data/schedule/schedule-update-operation.ts
@@ -31013,42 +33334,135 @@ async function getSlotByIdRoute(req, res) {
31013
33334
  const id = String(req.params.id);
31014
33335
  const ctx = req.openhiContext;
31015
33336
  try {
31016
- const result = await getSlotByIdOperation({ context: ctx, id });
31017
- return res.json(result.resource);
33337
+ const result = await getSlotByIdOperation({ context: ctx, id });
33338
+ return res.json(result.resource);
33339
+ } catch (err) {
33340
+ const status = domainErrorToHttpStatus(err);
33341
+ if (status === 404) {
33342
+ const diagnostics = err instanceof NotFoundError ? err.message : `Slot ${id} not found`;
33343
+ return sendOperationOutcome404(res, diagnostics);
33344
+ }
33345
+ return sendOperationOutcome500(res, err, "GET Slot error:");
33346
+ }
33347
+ }
33348
+
33349
+ // src/data/operations/data/slot/slot-list-operation.ts
33350
+ async function listSlotsOperation(params) {
33351
+ const { context, tableName, mode } = params;
33352
+ const { tenantId, workspaceId } = context;
33353
+ const service = getDynamoDataService(tableName);
33354
+ return listDataEntitiesByWorkspace(
33355
+ service.entities.slot,
33356
+ tenantId,
33357
+ workspaceId,
33358
+ mode
33359
+ );
33360
+ }
33361
+
33362
+ // src/data/rest-api/routes/data/slot/slot-list-route.ts
33363
+ var SLOT_RESOURCE_TYPE = "Slot";
33364
+ function stripModifier30(key) {
33365
+ const idx = key.indexOf(":");
33366
+ return idx === -1 ? key : key.slice(0, idx);
33367
+ }
33368
+ function isResultParameter30(key) {
33369
+ return key.startsWith("_");
33370
+ }
33371
+ function sendInvalidSearch40030(res, diagnostics) {
33372
+ return res.status(400).json({
33373
+ resourceType: "OperationOutcome",
33374
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
33375
+ });
33376
+ }
33377
+ function extractSearchParamKeys30(query) {
33378
+ const out = [];
33379
+ for (const rawKey of Object.keys(query)) {
33380
+ if (isResultParameter30(rawKey)) {
33381
+ continue;
33382
+ }
33383
+ out.push({ rawKey, code: stripModifier30(rawKey) });
33384
+ }
33385
+ return out;
33386
+ }
33387
+ function buildUnknownParamDiagnostics30(unknownCodes) {
33388
+ const validCodes = getRegisteredSearchParameters(SLOT_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
33389
+ const codes = unknownCodes.join(", ");
33390
+ const isPlural = unknownCodes.length !== 1;
33391
+ return [
33392
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Slot: ${codes}.`,
33393
+ `Valid codes: ${validCodes}.`
33394
+ ].join(" ");
33395
+ }
33396
+ function findMalformedReference30(query, searchParamKeys) {
33397
+ const referenceCodes = new Set(
33398
+ getRegisteredSearchParameters(SLOT_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
33399
+ );
33400
+ for (const { rawKey, code } of searchParamKeys) {
33401
+ if (!referenceCodes.has(code)) {
33402
+ continue;
33403
+ }
33404
+ const raw = query[rawKey];
33405
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
33406
+ for (const v of values) {
33407
+ const trimmed = v.trim();
33408
+ if (trimmed.length === 0) {
33409
+ continue;
33410
+ }
33411
+ if (parseTypedReference(trimmed) === void 0) {
33412
+ return { rawKey, value: trimmed };
33413
+ }
33414
+ }
33415
+ }
33416
+ return void 0;
33417
+ }
33418
+ async function listSlotsRoute(req, res) {
33419
+ const searchParamKeys = extractSearchParamKeys30(
33420
+ req.query
33421
+ );
33422
+ if (searchParamKeys.length === 0) {
33423
+ return handleListRoute({
33424
+ req,
33425
+ res,
33426
+ basePath: BASE_PATH.SLOT,
33427
+ listOperation: listSlotsOperation,
33428
+ errorLogContext: "GET /Slot list error:"
33429
+ });
33430
+ }
33431
+ const registered = getRegisteredSearchParameters(SLOT_RESOURCE_TYPE);
33432
+ const validCodes = new Set(registered.map((p) => p.code));
33433
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
33434
+ if (unknownCodes.length > 0) {
33435
+ return sendInvalidSearch40030(
33436
+ res,
33437
+ buildUnknownParamDiagnostics30([...new Set(unknownCodes)])
33438
+ );
33439
+ }
33440
+ const malformedRef = findMalformedReference30(
33441
+ req.query,
33442
+ searchParamKeys
33443
+ );
33444
+ if (malformedRef !== void 0) {
33445
+ return sendInvalidSearch40030(
33446
+ res,
33447
+ `?${malformedRef.rawKey} must be a typed reference like "Schedule/<id>"; got "${malformedRef.value}".`
33448
+ );
33449
+ }
33450
+ const ctx = req.openhiContext;
33451
+ try {
33452
+ const result = await genericSearchOperation({
33453
+ resourceType: SLOT_RESOURCE_TYPE,
33454
+ tenantId: ctx.tenantId,
33455
+ workspaceId: ctx.workspaceId,
33456
+ query: req.query,
33457
+ resolver: defaultSearchParameterResolver
33458
+ });
33459
+ const bundle = buildSearchsetBundle(BASE_PATH.SLOT, result.entries);
33460
+ return res.json(bundle);
31018
33461
  } catch (err) {
31019
- const status = domainErrorToHttpStatus(err);
31020
- if (status === 404) {
31021
- const diagnostics = err instanceof NotFoundError ? err.message : `Slot ${id} not found`;
31022
- return sendOperationOutcome404(res, diagnostics);
31023
- }
31024
- return sendOperationOutcome500(res, err, "GET Slot error:");
33462
+ return sendOperationOutcome500(res, err, "GET /Slot search error:");
31025
33463
  }
31026
33464
  }
31027
33465
 
31028
- // src/data/operations/data/slot/slot-list-operation.ts
31029
- async function listSlotsOperation(params) {
31030
- const { context, tableName, mode } = params;
31031
- const { tenantId, workspaceId } = context;
31032
- const service = getDynamoDataService(tableName);
31033
- return listDataEntitiesByWorkspace(
31034
- service.entities.slot,
31035
- tenantId,
31036
- workspaceId,
31037
- mode
31038
- );
31039
- }
31040
-
31041
- // src/data/rest-api/routes/data/slot/slot-list-route.ts
31042
- async function listSlotsRoute(req, res) {
31043
- return handleListRoute({
31044
- req,
31045
- res,
31046
- basePath: BASE_PATH.SLOT,
31047
- listOperation: listSlotsOperation,
31048
- errorLogContext: "GET /Slot list error:"
31049
- });
31050
- }
31051
-
31052
33466
  // src/data/operations/data/slot/slot-update-operation.ts
31053
33467
  async function updateSlotOperation(params) {
31054
33468
  const { context, id, body, tableName } = params;
@@ -31239,15 +33653,111 @@ async function listSpecimensOperation(params) {
31239
33653
  }
31240
33654
 
31241
33655
  // src/data/rest-api/routes/data/specimen/specimen-list-route.ts
31242
- async function listSpecimensRoute(req, res) {
31243
- return handleListRoute({
31244
- req,
31245
- res,
31246
- basePath: BASE_PATH.SPECIMEN,
31247
- listOperation: listSpecimensOperation,
31248
- errorLogContext: "GET /Specimen list error:"
33656
+ var SPECIMEN_RESOURCE_TYPE = "Specimen";
33657
+ function stripModifier31(key) {
33658
+ const idx = key.indexOf(":");
33659
+ return idx === -1 ? key : key.slice(0, idx);
33660
+ }
33661
+ function isResultParameter31(key) {
33662
+ return key.startsWith("_");
33663
+ }
33664
+ function sendInvalidSearch40031(res, diagnostics) {
33665
+ return res.status(400).json({
33666
+ resourceType: "OperationOutcome",
33667
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
31249
33668
  });
31250
33669
  }
33670
+ function extractSearchParamKeys31(query) {
33671
+ const out = [];
33672
+ for (const rawKey of Object.keys(query)) {
33673
+ if (isResultParameter31(rawKey)) {
33674
+ continue;
33675
+ }
33676
+ out.push({ rawKey, code: stripModifier31(rawKey) });
33677
+ }
33678
+ return out;
33679
+ }
33680
+ function buildUnknownParamDiagnostics31(unknownCodes) {
33681
+ const validCodes = getRegisteredSearchParameters(SPECIMEN_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
33682
+ const codes = unknownCodes.join(", ");
33683
+ const isPlural = unknownCodes.length !== 1;
33684
+ return [
33685
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Specimen: ${codes}.`,
33686
+ `Valid codes: ${validCodes}.`
33687
+ ].join(" ");
33688
+ }
33689
+ function findMalformedReference31(query, searchParamKeys) {
33690
+ const referenceCodes = new Set(
33691
+ getRegisteredSearchParameters(SPECIMEN_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
33692
+ );
33693
+ if (referenceCodes.size === 0) {
33694
+ return void 0;
33695
+ }
33696
+ for (const { rawKey, code } of searchParamKeys) {
33697
+ if (!referenceCodes.has(code)) {
33698
+ continue;
33699
+ }
33700
+ const raw = query[rawKey];
33701
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
33702
+ for (const v of values) {
33703
+ const trimmed = v.trim();
33704
+ if (trimmed.length === 0) {
33705
+ continue;
33706
+ }
33707
+ if (parseTypedReference(trimmed) === void 0) {
33708
+ return { rawKey, value: trimmed };
33709
+ }
33710
+ }
33711
+ }
33712
+ return void 0;
33713
+ }
33714
+ async function listSpecimensRoute(req, res) {
33715
+ const searchParamKeys = extractSearchParamKeys31(
33716
+ req.query
33717
+ );
33718
+ if (searchParamKeys.length === 0) {
33719
+ return handleListRoute({
33720
+ req,
33721
+ res,
33722
+ basePath: BASE_PATH.SPECIMEN,
33723
+ listOperation: listSpecimensOperation,
33724
+ errorLogContext: "GET /Specimen list error:"
33725
+ });
33726
+ }
33727
+ const registered = getRegisteredSearchParameters(SPECIMEN_RESOURCE_TYPE);
33728
+ const validCodes = new Set(registered.map((p) => p.code));
33729
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
33730
+ if (unknownCodes.length > 0) {
33731
+ return sendInvalidSearch40031(
33732
+ res,
33733
+ buildUnknownParamDiagnostics31([...new Set(unknownCodes)])
33734
+ );
33735
+ }
33736
+ const malformedRef = findMalformedReference31(
33737
+ req.query,
33738
+ searchParamKeys
33739
+ );
33740
+ if (malformedRef !== void 0) {
33741
+ return sendInvalidSearch40031(
33742
+ res,
33743
+ `?${malformedRef.rawKey} must be a typed reference like "Patient/<id>"; got "${malformedRef.value}".`
33744
+ );
33745
+ }
33746
+ const ctx = req.openhiContext;
33747
+ try {
33748
+ const result = await genericSearchOperation({
33749
+ resourceType: SPECIMEN_RESOURCE_TYPE,
33750
+ tenantId: ctx.tenantId,
33751
+ workspaceId: ctx.workspaceId,
33752
+ query: req.query,
33753
+ resolver: defaultSearchParameterResolver
33754
+ });
33755
+ const bundle = buildSearchsetBundle(BASE_PATH.SPECIMEN, result.entries);
33756
+ return res.json(bundle);
33757
+ } catch (err) {
33758
+ return sendOperationOutcome500(res, err, "GET /Specimen search error:");
33759
+ }
33760
+ }
31251
33761
 
31252
33762
  // src/data/operations/data/specimen/specimen-update-operation.ts
31253
33763
  async function updateSpecimenOperation(params) {
@@ -34120,171 +36630,108 @@ async function listTasksOperation(params) {
34120
36630
  );
34121
36631
  }
34122
36632
 
34123
- // src/data/operations/data/task/task-search-by-owner-operation.ts
34124
- var DEFAULT_LIMIT3 = 100;
34125
- function buildSearchTasksByOwnerSql() {
34126
- return [
34127
- "SELECT resource_id AS id, resource",
34128
- "FROM resources",
34129
- "WHERE tenant_id = :tenantId",
34130
- " AND workspace_id = :workspaceId",
34131
- " AND resource_type = 'Task'",
34132
- " AND deleted_at IS NULL",
34133
- ` AND ${REFERENCE_CONTAINMENT_SQL_FRAGMENT}`,
34134
- "ORDER BY last_updated DESC",
34135
- "LIMIT :limit;"
34136
- ].join("\n");
36633
+ // src/data/rest-api/routes/data/task/task-list-route.ts
36634
+ var TASK_RESOURCE_TYPE = "Task";
36635
+ function stripModifier32(key) {
36636
+ const idx = key.indexOf(":");
36637
+ return idx === -1 ? key : key.slice(0, idx);
34137
36638
  }
34138
- async function searchTasksByOwnerOperation(params) {
34139
- const { context, ownerReference } = params;
34140
- const { tenantId, workspaceId } = context;
34141
- const runner = params.runner ?? getDefaultPostgresQueryRunner();
34142
- const limit = params.limit ?? DEFAULT_LIMIT3;
34143
- const { containmentRelative, containmentUrn } = buildReferenceContainmentPayload({
34144
- shape: { kind: "scalar", field: "owner" },
34145
- reference: ownerReference,
34146
- tenantId,
34147
- workspaceId
36639
+ function isResultParameter32(key) {
36640
+ return key.startsWith("_");
36641
+ }
36642
+ function sendInvalidSearch40032(res, diagnostics) {
36643
+ return res.status(400).json({
36644
+ resourceType: "OperationOutcome",
36645
+ issue: [{ severity: "error", code: "invalid", diagnostics }]
34148
36646
  });
34149
- const queryParams = [
34150
- { name: "tenantId", value: tenantId },
34151
- { name: "workspaceId", value: workspaceId },
34152
- { name: "containmentRelative", value: containmentRelative },
34153
- { name: "containmentUrn", value: containmentUrn },
34154
- { name: "limit", value: limit }
34155
- ];
34156
- const rows = await runner.query(
34157
- buildSearchTasksByOwnerSql(),
34158
- queryParams
34159
- );
34160
- const entries = rows.map((row) => ({
34161
- id: row.id,
34162
- resource: { ...row.resource, id: row.id }
34163
- }));
34164
- return { entries, total: entries.length };
34165
36647
  }
34166
-
34167
- // src/data/operations/data/task/task-search-by-requester-operation.ts
34168
- var DEFAULT_LIMIT4 = 100;
34169
- function buildSearchTasksByRequesterSql() {
36648
+ function extractSearchParamKeys32(query) {
36649
+ const out = [];
36650
+ for (const rawKey of Object.keys(query)) {
36651
+ if (isResultParameter32(rawKey)) {
36652
+ continue;
36653
+ }
36654
+ out.push({ rawKey, code: stripModifier32(rawKey) });
36655
+ }
36656
+ return out;
36657
+ }
36658
+ function buildUnknownParamDiagnostics32(unknownCodes) {
36659
+ const validCodes = getRegisteredSearchParameters(TASK_RESOURCE_TYPE).map((p) => p.code).sort().join(", ");
36660
+ const codes = unknownCodes.join(", ");
36661
+ const isPlural = unknownCodes.length !== 1;
34170
36662
  return [
34171
- "SELECT resource_id AS id, resource",
34172
- "FROM resources",
34173
- "WHERE tenant_id = :tenantId",
34174
- " AND workspace_id = :workspaceId",
34175
- " AND resource_type = 'Task'",
34176
- " AND deleted_at IS NULL",
34177
- ` AND ${REFERENCE_CONTAINMENT_SQL_FRAGMENT}`,
34178
- "ORDER BY last_updated DESC",
34179
- "LIMIT :limit;"
34180
- ].join("\n");
36663
+ `Unknown search ${isPlural ? "parameters" : "parameter"} for Task: ${codes}.`,
36664
+ `Valid codes: ${validCodes}.`
36665
+ ].join(" ");
34181
36666
  }
34182
- async function searchTasksByRequesterOperation(params) {
34183
- const { context, requesterReference } = params;
34184
- const { tenantId, workspaceId } = context;
34185
- const runner = params.runner ?? getDefaultPostgresQueryRunner();
34186
- const limit = params.limit ?? DEFAULT_LIMIT4;
34187
- const { containmentRelative, containmentUrn } = buildReferenceContainmentPayload({
34188
- shape: { kind: "scalar", field: "requester" },
34189
- reference: requesterReference,
34190
- tenantId,
34191
- workspaceId
34192
- });
34193
- const queryParams = [
34194
- { name: "tenantId", value: tenantId },
34195
- { name: "workspaceId", value: workspaceId },
34196
- { name: "containmentRelative", value: containmentRelative },
34197
- { name: "containmentUrn", value: containmentUrn },
34198
- { name: "limit", value: limit }
34199
- ];
34200
- const rows = await runner.query(
34201
- buildSearchTasksByRequesterSql(),
34202
- queryParams
36667
+ function findMalformedReference32(query, searchParamKeys) {
36668
+ const referenceCodes = new Set(
36669
+ getRegisteredSearchParameters(TASK_RESOURCE_TYPE).filter((p) => p.type === "reference").map((p) => p.code)
34203
36670
  );
34204
- const entries = rows.map((row) => ({
34205
- id: row.id,
34206
- resource: { ...row.resource, id: row.id }
34207
- }));
34208
- return { entries, total: entries.length };
34209
- }
34210
-
34211
- // src/data/rest-api/routes/data/task/task-list-route.ts
34212
- function singleStringQueryParam2(req, name) {
34213
- const v = req.query[name];
34214
- if (typeof v !== "string") {
34215
- return void 0;
36671
+ for (const { rawKey, code } of searchParamKeys) {
36672
+ if (!referenceCodes.has(code)) {
36673
+ continue;
36674
+ }
36675
+ const raw = query[rawKey];
36676
+ const values = typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw.flatMap((v) => v.split(",")) : [];
36677
+ for (const v of values) {
36678
+ const trimmed = v.trim();
36679
+ if (trimmed.length === 0) {
36680
+ continue;
36681
+ }
36682
+ if (parseTypedReference(trimmed) === void 0) {
36683
+ return { rawKey, value: trimmed };
36684
+ }
36685
+ }
34216
36686
  }
34217
- const trimmed = v.trim();
34218
- return trimmed === "" ? void 0 : trimmed;
34219
- }
34220
- function sendInvalidSearch40013(res, diagnostics) {
34221
- return res.status(400).json({
34222
- resourceType: "OperationOutcome",
34223
- issue: [{ severity: "error", code: "invalid", diagnostics }]
34224
- });
36687
+ return void 0;
34225
36688
  }
34226
36689
  async function listTasksRoute(req, res) {
34227
- const ownerRef = singleStringQueryParam2(req, "owner");
34228
- const requesterRef = singleStringQueryParam2(req, "requester");
34229
- if (ownerRef !== void 0 && requesterRef !== void 0) {
34230
- return sendInvalidSearch40013(
36690
+ const searchParamKeys = extractSearchParamKeys32(
36691
+ req.query
36692
+ );
36693
+ if (searchParamKeys.length === 0) {
36694
+ return handleListRoute({
36695
+ req,
36696
+ res,
36697
+ basePath: BASE_PATH.TASK,
36698
+ listOperation: listTasksOperation,
36699
+ errorLogContext: "GET /Task list error:"
36700
+ });
36701
+ }
36702
+ const registered = getRegisteredSearchParameters(TASK_RESOURCE_TYPE);
36703
+ const validCodes = new Set(registered.map((p) => p.code));
36704
+ const unknownCodes = searchParamKeys.map((k) => k.code).filter((code) => !validCodes.has(code));
36705
+ if (unknownCodes.length > 0) {
36706
+ return sendInvalidSearch40032(
34231
36707
  res,
34232
- "?owner= and ?requester= cannot be combined on the same request."
36708
+ buildUnknownParamDiagnostics32([...new Set(unknownCodes)])
34233
36709
  );
34234
36710
  }
34235
- if (ownerRef !== void 0) {
34236
- if (parseTypedReference(ownerRef) === void 0) {
34237
- return sendInvalidSearch40013(
34238
- res,
34239
- `?owner must be a typed reference like "Practitioner/<id>"; got "${ownerRef}".`
34240
- );
34241
- }
34242
- const ctx = req.openhiContext;
34243
- try {
34244
- const result = await searchTasksByOwnerOperation({
34245
- context: ctx,
34246
- ownerReference: ownerRef
34247
- });
34248
- const bundle = buildSearchsetBundle(BASE_PATH.TASK, result.entries);
34249
- return res.json(bundle);
34250
- } catch (err) {
34251
- return sendOperationOutcome500(
34252
- res,
34253
- err,
34254
- "GET /Task?owner= search error:"
34255
- );
34256
- }
36711
+ const malformedRef = findMalformedReference32(
36712
+ req.query,
36713
+ searchParamKeys
36714
+ );
36715
+ if (malformedRef !== void 0) {
36716
+ return sendInvalidSearch40032(
36717
+ res,
36718
+ `?${malformedRef.rawKey} must be a typed reference like "Practitioner/<id>"; got "${malformedRef.value}".`
36719
+ );
34257
36720
  }
34258
- if (requesterRef !== void 0) {
34259
- if (parseTypedReference(requesterRef) === void 0) {
34260
- return sendInvalidSearch40013(
34261
- res,
34262
- `?requester must be a typed reference like "Practitioner/<id>"; got "${requesterRef}".`
34263
- );
34264
- }
34265
- const ctx = req.openhiContext;
34266
- try {
34267
- const result = await searchTasksByRequesterOperation({
34268
- context: ctx,
34269
- requesterReference: requesterRef
34270
- });
34271
- const bundle = buildSearchsetBundle(BASE_PATH.TASK, result.entries);
34272
- return res.json(bundle);
34273
- } catch (err) {
34274
- return sendOperationOutcome500(
34275
- res,
34276
- err,
34277
- "GET /Task?requester= search error:"
34278
- );
34279
- }
36721
+ const ctx = req.openhiContext;
36722
+ try {
36723
+ const result = await genericSearchOperation({
36724
+ resourceType: TASK_RESOURCE_TYPE,
36725
+ tenantId: ctx.tenantId,
36726
+ workspaceId: ctx.workspaceId,
36727
+ query: req.query,
36728
+ resolver: defaultSearchParameterResolver
36729
+ });
36730
+ const bundle = buildSearchsetBundle(BASE_PATH.TASK, result.entries);
36731
+ return res.json(bundle);
36732
+ } catch (err) {
36733
+ return sendOperationOutcome500(res, err, "GET /Task search error:");
34280
36734
  }
34281
- return handleListRoute({
34282
- req,
34283
- res,
34284
- basePath: BASE_PATH.TASK,
34285
- listOperation: listTasksOperation,
34286
- errorLogContext: "GET /Task list error:"
34287
- });
34288
36735
  }
34289
36736
 
34290
36737
  // src/data/operations/data/task/task-update-operation.ts