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