@medplum/core 0.9.34 → 0.9.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client.d.ts +1 -1
- package/dist/cjs/index.js +89 -39
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.min.js +1 -1
- package/dist/cjs/index.min.js.map +1 -1
- package/dist/cjs/searchparams.d.ts +1 -3
- package/dist/cjs/types.d.ts +14 -3
- package/dist/esm/client.d.ts +1 -1
- package/dist/esm/client.js +4 -3
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/fhirpath/utils.js +16 -17
- package/dist/esm/fhirpath/utils.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.min.js +1 -1
- package/dist/esm/index.min.js.map +1 -1
- package/dist/esm/outcomes.js +3 -3
- package/dist/esm/outcomes.js.map +1 -1
- package/dist/esm/searchparams.d.ts +1 -3
- package/dist/esm/searchparams.js +23 -6
- package/dist/esm/searchparams.js.map +1 -1
- package/dist/esm/types.d.ts +14 -3
- package/dist/esm/types.js +45 -13
- package/dist/esm/types.js.map +1 -1
- package/package.json +3 -3
package/dist/esm/outcomes.js
CHANGED
|
@@ -12,7 +12,7 @@ const allOk = {
|
|
|
12
12
|
issue: [
|
|
13
13
|
{
|
|
14
14
|
severity: 'information',
|
|
15
|
-
code: '
|
|
15
|
+
code: 'informational',
|
|
16
16
|
details: {
|
|
17
17
|
text: 'All OK',
|
|
18
18
|
},
|
|
@@ -25,7 +25,7 @@ const created = {
|
|
|
25
25
|
issue: [
|
|
26
26
|
{
|
|
27
27
|
severity: 'information',
|
|
28
|
-
code: '
|
|
28
|
+
code: 'informational',
|
|
29
29
|
details: {
|
|
30
30
|
text: 'Created',
|
|
31
31
|
},
|
|
@@ -38,7 +38,7 @@ const notModified = {
|
|
|
38
38
|
issue: [
|
|
39
39
|
{
|
|
40
40
|
severity: 'information',
|
|
41
|
-
code: '
|
|
41
|
+
code: 'informational',
|
|
42
42
|
details: {
|
|
43
43
|
text: 'Not Modified',
|
|
44
44
|
},
|
package/dist/esm/outcomes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outcomes.js","sources":["../../src/outcomes.ts"],"sourcesContent":["import { OperationOutcome } from '@medplum/fhirtypes';\n\nconst OK_ID = 'ok';\nconst CREATED_ID = 'created';\nconst GONE_ID = 'gone';\nconst NOT_MODIFIED_ID = 'not-modified';\nconst NOT_FOUND_ID = 'not-found';\nconst UNAUTHORIZED_ID = 'unauthorized';\nconst FORBIDDEN_ID = 'forbidden';\nconst TOO_MANY_REQUESTS_ID = 'too-many-requests';\n\nexport const allOk: OperationOutcome = {\n resourceType: 'OperationOutcome',\n id: OK_ID,\n issue: [\n {\n severity: 'information',\n code: '
|
|
1
|
+
{"version":3,"file":"outcomes.js","sources":["../../src/outcomes.ts"],"sourcesContent":["import { OperationOutcome } from '@medplum/fhirtypes';\n\nconst OK_ID = 'ok';\nconst CREATED_ID = 'created';\nconst GONE_ID = 'gone';\nconst NOT_MODIFIED_ID = 'not-modified';\nconst NOT_FOUND_ID = 'not-found';\nconst UNAUTHORIZED_ID = 'unauthorized';\nconst FORBIDDEN_ID = 'forbidden';\nconst TOO_MANY_REQUESTS_ID = 'too-many-requests';\n\nexport const allOk: OperationOutcome = {\n resourceType: 'OperationOutcome',\n id: OK_ID,\n issue: [\n {\n severity: 'information',\n code: 'informational',\n details: {\n text: 'All OK',\n },\n },\n ],\n};\n\nexport const created: OperationOutcome = {\n resourceType: 'OperationOutcome',\n id: CREATED_ID,\n issue: [\n {\n severity: 'information',\n code: 'informational',\n details: {\n text: 'Created',\n },\n },\n ],\n};\n\nexport const notModified: OperationOutcome = {\n resourceType: 'OperationOutcome',\n id: NOT_MODIFIED_ID,\n issue: [\n {\n severity: 'information',\n code: 'informational',\n details: {\n text: 'Not Modified',\n },\n },\n ],\n};\n\nexport const notFound: OperationOutcome = {\n resourceType: 'OperationOutcome',\n id: NOT_FOUND_ID,\n issue: [\n {\n severity: 'error',\n code: 'not-found',\n details: {\n text: 'Not found',\n },\n },\n ],\n};\n\nexport const unauthorized: OperationOutcome = {\n resourceType: 'OperationOutcome',\n id: UNAUTHORIZED_ID,\n issue: [\n {\n severity: 'error',\n code: 'login',\n details: {\n text: 'Unauthorized',\n },\n },\n ],\n};\n\nexport const forbidden: OperationOutcome = {\n resourceType: 'OperationOutcome',\n id: FORBIDDEN_ID,\n issue: [\n {\n severity: 'error',\n code: 'forbidden',\n details: {\n text: 'Forbidden',\n },\n },\n ],\n};\n\nexport const gone: OperationOutcome = {\n resourceType: 'OperationOutcome',\n id: GONE_ID,\n issue: [\n {\n severity: 'error',\n code: 'gone',\n details: {\n text: 'Gone',\n },\n },\n ],\n};\n\nexport const tooManyRequests: OperationOutcome = {\n resourceType: 'OperationOutcome',\n id: TOO_MANY_REQUESTS_ID,\n issue: [\n {\n severity: 'error',\n code: 'throttled',\n details: {\n text: 'Too Many Requests',\n },\n },\n ],\n};\n\nexport function badRequest(details: string, expression?: string): OperationOutcome {\n return {\n resourceType: 'OperationOutcome',\n issue: [\n {\n severity: 'error',\n code: 'invalid',\n details: {\n text: details,\n },\n expression: expression ? [expression] : undefined,\n },\n ],\n };\n}\n\nexport function isOk(outcome: OperationOutcome): boolean {\n return outcome.id === OK_ID || outcome.id === CREATED_ID || outcome.id === NOT_MODIFIED_ID;\n}\n\nexport function isNotFound(outcome: OperationOutcome): boolean {\n return outcome.id === NOT_FOUND_ID;\n}\n\nexport function isGone(outcome: OperationOutcome): boolean {\n return outcome.id === GONE_ID;\n}\n\nexport function getStatus(outcome: OperationOutcome): number {\n if (outcome.id === OK_ID) {\n return 200;\n } else if (outcome.id === CREATED_ID) {\n return 201;\n } else if (outcome.id === NOT_MODIFIED_ID) {\n return 304;\n } else if (outcome.id === UNAUTHORIZED_ID) {\n return 401;\n } else if (outcome.id === FORBIDDEN_ID) {\n return 403;\n } else if (outcome.id === NOT_FOUND_ID) {\n return 404;\n } else if (outcome.id === GONE_ID) {\n return 410;\n } else if (outcome.id === TOO_MANY_REQUESTS_ID) {\n return 429;\n } else {\n return 400;\n }\n}\n\n/**\n * Asserts that the operation completed successfully and that the resource is defined.\n * @param outcome The operation outcome.\n * @param resource The resource that may or may not have been returned.\n */\nexport function assertOk<T>(outcome: OperationOutcome, resource: T | undefined): asserts resource is T {\n if (!isOk(outcome) || resource === undefined) {\n throw new OperationOutcomeError(outcome);\n }\n}\n\nexport class OperationOutcomeError extends Error {\n readonly outcome: OperationOutcome;\n\n constructor(outcome: OperationOutcome) {\n super(outcome?.issue?.[0].details?.text);\n this.outcome = outcome;\n }\n}\n\n/**\n * Normalizes an error object into a displayable error string.\n * @param error The error value which could be a string, Error, OperationOutcome, or other unknown type.\n * @returns A display string for the error.\n */\nexport function normalizeErrorString(error: unknown): string {\n if (!error) {\n return 'Unknown error';\n }\n if (typeof error === 'string') {\n return error;\n }\n if (error instanceof Error) {\n return error.message;\n }\n if (typeof error === 'object' && 'resourceType' in error) {\n const outcome = error as OperationOutcome;\n return outcome.issue?.[0]?.details?.text ?? 'Unknown error';\n }\n return JSON.stringify(error);\n}\n"],"names":[],"mappings":"AAEA,MAAM,KAAK,GAAG,IAAI,CAAC;AACnB,MAAM,UAAU,GAAG,SAAS,CAAC;AAC7B,MAAM,OAAO,GAAG,MAAM,CAAC;AACvB,MAAM,eAAe,GAAG,cAAc,CAAC;AACvC,MAAM,YAAY,GAAG,WAAW,CAAC;AACjC,MAAM,eAAe,GAAG,cAAc,CAAC;AACvC,MAAM,YAAY,GAAG,WAAW,CAAC;AACjC,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;AAEpC,MAAA,KAAK,GAAqB;AACrC,IAAA,YAAY,EAAE,kBAAkB;AAChC,IAAA,EAAE,EAAE,KAAK;AACT,IAAA,KAAK,EAAE;AACL,QAAA;AACE,YAAA,QAAQ,EAAE,aAAa;AACvB,YAAA,IAAI,EAAE,eAAe;AACrB,YAAA,OAAO,EAAE;AACP,g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GAAA,EAAA,CAAE,IAAI,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,eAAe,CAAC;AAC7D,KAAA;AACD,IAAA,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAC/B;;;;"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ElementDefinition, SearchParameter } from '@medplum/fhirtypes';
|
|
2
|
-
import { IndexedStructureDefinition } from './types';
|
|
3
2
|
export declare enum SearchParameterType {
|
|
4
3
|
BOOLEAN = "BOOLEAN",
|
|
5
4
|
NUMBER = "NUMBER",
|
|
@@ -26,10 +25,9 @@ export interface SearchParameterDetails {
|
|
|
26
25
|
* 2) The "token" type includes enums and booleans.
|
|
27
26
|
* 3) Arrays/multiple values are not reflected at all.
|
|
28
27
|
*
|
|
29
|
-
* @param structureDefinitions Collection of StructureDefinition resources indexed by name.
|
|
30
28
|
* @param resourceType The root resource type.
|
|
31
29
|
* @param searchParam The search parameter.
|
|
32
30
|
* @returns The search parameter type details.
|
|
33
31
|
*/
|
|
34
|
-
export declare function getSearchParameterDetails(
|
|
32
|
+
export declare function getSearchParameterDetails(resourceType: string, searchParam: SearchParameter): SearchParameterDetails;
|
|
35
33
|
export declare function getExpressionForResourceType(resourceType: string, expression: string): string | undefined;
|
package/dist/esm/searchparams.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PropertyType } from './types.js';
|
|
1
|
+
import { globalSchema, PropertyType } from './types.js';
|
|
2
2
|
import { capitalize } from './utils.js';
|
|
3
3
|
|
|
4
4
|
var SearchParameterType;
|
|
@@ -22,17 +22,32 @@ var SearchParameterType;
|
|
|
22
22
|
* 2) The "token" type includes enums and booleans.
|
|
23
23
|
* 3) Arrays/multiple values are not reflected at all.
|
|
24
24
|
*
|
|
25
|
-
* @param structureDefinitions Collection of StructureDefinition resources indexed by name.
|
|
26
25
|
* @param resourceType The root resource type.
|
|
27
26
|
* @param searchParam The search parameter.
|
|
28
27
|
* @returns The search parameter type details.
|
|
29
28
|
*/
|
|
30
|
-
function getSearchParameterDetails(
|
|
29
|
+
function getSearchParameterDetails(resourceType, searchParam) {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
let result = (_b = (_a = globalSchema.types[resourceType]) === null || _a === void 0 ? void 0 : _a.searchParamsDetails) === null || _b === void 0 ? void 0 : _b[searchParam.code];
|
|
32
|
+
if (!result) {
|
|
33
|
+
result = buildSearchParamterDetails(resourceType, searchParam);
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
function setSearchParamterDetails(resourceType, code, details) {
|
|
38
|
+
const typeSchema = globalSchema.types[resourceType];
|
|
39
|
+
if (!typeSchema.searchParamsDetails) {
|
|
40
|
+
typeSchema.searchParamsDetails = {};
|
|
41
|
+
}
|
|
42
|
+
typeSchema.searchParamsDetails[code] = details;
|
|
43
|
+
}
|
|
44
|
+
function buildSearchParamterDetails(resourceType, searchParam) {
|
|
31
45
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
32
46
|
if (searchParam.code === '_lastUpdated') {
|
|
33
47
|
return { columnName: 'lastUpdated', type: SearchParameterType.DATETIME };
|
|
34
48
|
}
|
|
35
|
-
const
|
|
49
|
+
const code = searchParam.code;
|
|
50
|
+
const columnName = convertCodeToColumnName(code);
|
|
36
51
|
const expression = (_a = getExpressionForResourceType(resourceType, searchParam.expression)) === null || _a === void 0 ? void 0 : _a.split('.');
|
|
37
52
|
if (!expression) {
|
|
38
53
|
// This happens on compound types
|
|
@@ -47,7 +62,7 @@ function getSearchParameterDetails(structureDefinitions, resourceType, searchPar
|
|
|
47
62
|
for (let i = 1; i < expression.length; i++) {
|
|
48
63
|
const propertyName = expression[i];
|
|
49
64
|
elementDefinition =
|
|
50
|
-
(_d = (_c = (_b =
|
|
65
|
+
(_d = (_c = (_b = globalSchema.types[baseType]) === null || _b === void 0 ? void 0 : _b.properties) === null || _c === void 0 ? void 0 : _c[propertyName]) !== null && _d !== void 0 ? _d : (_f = (_e = globalSchema.types[baseType]) === null || _e === void 0 ? void 0 : _e.properties) === null || _f === void 0 ? void 0 : _f[propertyName + '[x]'];
|
|
51
66
|
if (!elementDefinition) {
|
|
52
67
|
throw new Error(`Element definition not found for ${resourceType} ${searchParam.code}`);
|
|
53
68
|
}
|
|
@@ -70,7 +85,9 @@ function getSearchParameterDetails(structureDefinitions, resourceType, searchPar
|
|
|
70
85
|
}
|
|
71
86
|
}
|
|
72
87
|
const type = getSearchParameterType(searchParam, propertyType);
|
|
73
|
-
|
|
88
|
+
const result = { columnName, type, elementDefinition, array };
|
|
89
|
+
setSearchParamterDetails(resourceType, code, result);
|
|
90
|
+
return result;
|
|
74
91
|
}
|
|
75
92
|
/**
|
|
76
93
|
* Converts a hyphen-delimited code to camelCase string.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchparams.js","sources":["../../src/searchparams.ts"],"sourcesContent":["import { ElementDefinition, SearchParameter } from '@medplum/fhirtypes';\nimport { IndexedStructureDefinition, PropertyType } from './types';\nimport { capitalize } from './utils';\n\nexport enum SearchParameterType {\n BOOLEAN = 'BOOLEAN',\n NUMBER = 'NUMBER',\n QUANTITY = 'QUANTITY',\n TEXT = 'TEXT',\n REFERENCE = 'REFERENCE',\n DATE = 'DATE',\n DATETIME = 'DATETIME',\n PERIOD = 'PERIOD',\n}\n\nexport interface SearchParameterDetails {\n readonly columnName: string;\n readonly type: SearchParameterType;\n readonly elementDefinition?: ElementDefinition;\n readonly array?: boolean;\n}\n\n/**\n * Returns the type details of a SearchParameter.\n *\n * The SearchParameter resource has a \"type\" parameter, but that is missing some critical information.\n *\n * For example:\n * 1) The \"date\" type includes \"date\", \"datetime\", and \"period\".\n * 2) The \"token\" type includes enums and booleans.\n * 3) Arrays/multiple values are not reflected at all.\n *\n * @param structureDefinitions Collection of StructureDefinition resources indexed by name.\n * @param resourceType The root resource type.\n * @param searchParam The search parameter.\n * @returns The search parameter type details.\n */\nexport function getSearchParameterDetails(\n structureDefinitions: IndexedStructureDefinition,\n resourceType: string,\n searchParam: SearchParameter\n): SearchParameterDetails {\n if (searchParam.code === '_lastUpdated') {\n return { columnName: 'lastUpdated', type: SearchParameterType.DATETIME };\n }\n\n const columnName = convertCodeToColumnName(searchParam.code as string);\n const expression = getExpressionForResourceType(resourceType, searchParam.expression as string)?.split('.');\n if (!expression) {\n // This happens on compound types\n // In the future, explore returning multiple column definitions\n return { columnName, type: SearchParameterType.TEXT };\n }\n\n const defaultType = getSearchParameterType(searchParam);\n let baseType = resourceType;\n let elementDefinition = undefined;\n let propertyType = undefined;\n let array = false;\n\n for (let i = 1; i < expression.length; i++) {\n const propertyName = expression[i];\n elementDefinition =\n structureDefinitions.types[baseType]?.properties?.[propertyName] ??\n structureDefinitions.types[baseType]?.properties?.[propertyName + '[x]'];\n if (!elementDefinition) {\n throw new Error(`Element definition not found for ${resourceType} ${searchParam.code}`);\n }\n\n if (elementDefinition.max === '*') {\n array = true;\n }\n\n propertyType = elementDefinition.type?.[0].code;\n if (!propertyType) {\n // This happens when one of parent properties uses contentReference\n // In the future, explore following the reference\n return { columnName, type: defaultType, array };\n }\n\n if (i < expression.length - 1) {\n if (propertyType === 'Element' || propertyType === 'BackboneElement') {\n baseType = baseType + capitalize(propertyName);\n } else {\n baseType = propertyType;\n }\n }\n }\n\n const type = getSearchParameterType(searchParam, propertyType as PropertyType);\n return { columnName, type, elementDefinition, array };\n}\n\n/**\n * Converts a hyphen-delimited code to camelCase string.\n * @param code The search parameter code.\n * @returns The SQL column name.\n */\nfunction convertCodeToColumnName(code: string): string {\n return code.split('-').reduce((result, word, index) => result + (index ? capitalize(word) : word), '');\n}\n\nfunction getSearchParameterType(searchParam: SearchParameter, propertyType?: PropertyType): SearchParameterType {\n let type = SearchParameterType.TEXT;\n switch (searchParam.type) {\n case 'date':\n if (propertyType === PropertyType.dateTime || propertyType === PropertyType.instant) {\n type = SearchParameterType.DATETIME;\n } else {\n type = SearchParameterType.DATE;\n }\n break;\n case 'number':\n type = SearchParameterType.NUMBER;\n break;\n case 'quantity':\n type = SearchParameterType.QUANTITY;\n break;\n case 'reference':\n type = SearchParameterType.REFERENCE;\n break;\n case 'token':\n if (propertyType === 'boolean') {\n type = SearchParameterType.BOOLEAN;\n }\n break;\n }\n return type;\n}\n\nexport function getExpressionForResourceType(resourceType: string, expression: string): string | undefined {\n const expressions = expression.split(' | ');\n for (const e of expressions) {\n if (isIgnoredExpression(e)) {\n continue;\n }\n const simplified = simplifyExpression(e);\n if (simplified.startsWith(resourceType + '.')) {\n return simplified;\n }\n }\n return undefined;\n}\n\nfunction isIgnoredExpression(input: string): boolean {\n return input.includes(' as Period') || input.includes(' as SampledDate');\n}\n\nfunction simplifyExpression(input: string): string {\n let result = input.trim();\n\n if (result.startsWith('(') && result.endsWith(')')) {\n result = result.substring(1, result.length - 1);\n }\n\n if (result.includes('[0]')) {\n result = result.replaceAll('[0]', '');\n }\n\n const stopStrings = [' != ', ' as ', '.as(', '.exists(', '.where('];\n for (const stopString of stopStrings) {\n if (result.includes(stopString)) {\n result = result.substring(0, result.indexOf(stopString));\n }\n }\n\n return result;\n}\n"],"names":[],"mappings":";;;IAIY,oBASX;AATD,CAAA,UAAY,mBAAmB,EAAA;AAC7B,IAAA,mBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,mBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,mBAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACrB,IAAA,mBAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,mBAAA,CAAA,WAAA,CAAA,GAAA,WAAuB,CAAA;AACvB,IAAA,mBAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,mBAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACrB,IAAA,mBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACnB,CA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EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;AACpE,IAAA,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;AACpC,QAAA,IAAI,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;AAC/B,YAAA,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;AAC1D,SAAA;AACF,KAAA;AAED,IAAA,OAAO,MAAM,CAAC;AAChB;;;;"}
|
|
1
|
+
{"version":3,"file":"searchparams.js","sources":["../../src/searchparams.ts"],"sourcesContent":["import { ElementDefinition, SearchParameter } from '@medplum/fhirtypes';\nimport { globalSchema, PropertyType } from './types';\nimport { capitalize } from './utils';\n\nexport enum SearchParameterType {\n BOOLEAN = 'BOOLEAN',\n NUMBER = 'NUMBER',\n QUANTITY = 'QUANTITY',\n TEXT = 'TEXT',\n REFERENCE = 'REFERENCE',\n DATE = 'DATE',\n DATETIME = 'DATETIME',\n PERIOD = 'PERIOD',\n}\n\nexport interface SearchParameterDetails {\n readonly columnName: string;\n readonly type: SearchParameterType;\n readonly elementDefinition?: ElementDefinition;\n readonly array?: boolean;\n}\n\n/**\n * Returns the type details of a SearchParameter.\n *\n * The SearchParameter resource has a \"type\" parameter, but that is missing some critical information.\n *\n * For example:\n * 1) The \"date\" type includes \"date\", \"datetime\", and \"period\".\n * 2) The \"token\" type includes enums and booleans.\n * 3) Arrays/multiple values are not reflected at all.\n *\n * @param resourceType The root resource type.\n * @param searchParam The search parameter.\n * @returns The search parameter type details.\n */\nexport function getSearchParameterDetails(resourceType: string, searchParam: SearchParameter): SearchParameterDetails {\n let result: SearchParameterDetails | undefined =\n globalSchema.types[resourceType]?.searchParamsDetails?.[searchParam.code as string];\n if (!result) {\n result = buildSearchParamterDetails(resourceType, searchParam);\n }\n return result;\n}\n\nfunction setSearchParamterDetails(resourceType: string, code: string, details: SearchParameterDetails): void {\n const typeSchema = globalSchema.types[resourceType];\n if (!typeSchema.searchParamsDetails) {\n typeSchema.searchParamsDetails = {};\n }\n typeSchema.searchParamsDetails[code] = details;\n}\n\nfunction buildSearchParamterDetails(resourceType: string, searchParam: SearchParameter): SearchParameterDetails {\n if (searchParam.code === '_lastUpdated') {\n return { columnName: 'lastUpdated', type: SearchParameterType.DATETIME };\n }\n\n const code = searchParam.code as string;\n const columnName = convertCodeToColumnName(code);\n const expression = getExpressionForResourceType(resourceType, searchParam.expression as string)?.split('.');\n if (!expression) {\n // This happens on compound types\n // In the future, explore returning multiple column definitions\n return { columnName, type: SearchParameterType.TEXT };\n }\n\n const defaultType = getSearchParameterType(searchParam);\n let baseType = resourceType;\n let elementDefinition = undefined;\n let propertyType = undefined;\n let array = false;\n\n for (let i = 1; i < expression.length; i++) {\n const propertyName = expression[i];\n elementDefinition =\n globalSchema.types[baseType]?.properties?.[propertyName] ??\n globalSchema.types[baseType]?.properties?.[propertyName + '[x]'];\n if (!elementDefinition) {\n throw new Error(`Element definition not found for ${resourceType} ${searchParam.code}`);\n }\n\n if (elementDefinition.max === '*') {\n array = true;\n }\n\n propertyType = elementDefinition.type?.[0].code;\n if (!propertyType) {\n // This happens when one of parent properties uses contentReference\n // In the future, explore following the reference\n return { columnName, type: defaultType, array };\n }\n\n if (i < expression.length - 1) {\n if (propertyType === 'Element' || propertyType === 'BackboneElement') {\n baseType = baseType + capitalize(propertyName);\n } else {\n baseType = propertyType;\n }\n }\n }\n\n const type = getSearchParameterType(searchParam, propertyType as PropertyType);\n const result = { columnName, type, elementDefinition, array };\n setSearchParamterDetails(resourceType, code, result);\n return result;\n}\n\n/**\n * Converts a hyphen-delimited code to camelCase string.\n * @param code The search parameter code.\n * @returns The SQL column name.\n */\nfunction convertCodeToColumnName(code: string): string {\n return code.split('-').reduce((result, word, index) => result + (index ? capitalize(word) : word), '');\n}\n\nfunction getSearchParameterType(searchParam: SearchParameter, propertyType?: PropertyType): SearchParameterType {\n let type = SearchParameterType.TEXT;\n switch (searchParam.type) {\n case 'date':\n if (propertyType === PropertyType.dateTime || propertyType === PropertyType.instant) {\n type = SearchParameterType.DATETIME;\n } else {\n type = SearchParameterType.DATE;\n }\n break;\n case 'number':\n type = SearchParameterType.NUMBER;\n break;\n case 'quantity':\n type = SearchParameterType.QUANTITY;\n break;\n case 'reference':\n type = SearchParameterType.REFERENCE;\n break;\n case 'token':\n if (propertyType === 'boolean') {\n type = SearchParameterType.BOOLEAN;\n }\n break;\n }\n return type;\n}\n\nexport function getExpressionForResourceType(resourceType: string, expression: string): string | undefined {\n const expressions = expression.split(' | ');\n for (const e of expressions) {\n if (isIgnoredExpression(e)) {\n continue;\n }\n const simplified = simplifyExpression(e);\n if (simplified.startsWith(resourceType + '.')) {\n return simplified;\n }\n }\n return undefined;\n}\n\nfunction isIgnoredExpression(input: string): boolean {\n return input.includes(' as Period') || input.includes(' as SampledDate');\n}\n\nfunction simplifyExpression(input: string): string {\n let result = input.trim();\n\n if (result.startsWith('(') && result.endsWith(')')) {\n result = result.substring(1, result.length - 1);\n }\n\n if (result.includes('[0]')) {\n result = result.replaceAll('[0]', '');\n }\n\n const stopStrings = [' != ', ' as ', '.as(', '.exists(', '.where('];\n for (const stopString of stopStrings) {\n if (result.includes(stopString)) {\n result = result.substring(0, result.indexOf(stopString));\n }\n }\n\n return result;\n}\n"],"names":[],"mappings":";;;IAIY,oBASX;AATD,CAAA,UAAY,mBAAmB,EAAA;AAC7B,IAAA,mBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,mBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,mBAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACrB,IAAA,mBAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,mBAAA,CAAA,WAAA,CAAA,GAAA,WAAuB,CAAA;AACvB,IAAA,mBAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,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AC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;AAC1D,SAAA;AACF,KAAA;AAED,IAAA,OAAO,MAAM,CAAC;AAChB;;;;"}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Bundle, ElementDefinition, SearchParameter, StructureDefinition } from '@medplum/fhirtypes';
|
|
2
|
+
import { SearchParameterDetails } from './searchparams';
|
|
2
3
|
/**
|
|
3
4
|
* List of property types.
|
|
4
5
|
* http://www.hl7.org/fhir/valueset-defined-types.html
|
|
@@ -113,6 +114,9 @@ export interface TypeSchema {
|
|
|
113
114
|
searchParams?: {
|
|
114
115
|
[code: string]: SearchParameter;
|
|
115
116
|
};
|
|
117
|
+
searchParamsDetails?: {
|
|
118
|
+
[code: string]: SearchParameterDetails;
|
|
119
|
+
};
|
|
116
120
|
description?: string;
|
|
117
121
|
parentType?: string;
|
|
118
122
|
}
|
|
@@ -130,19 +134,26 @@ export declare function indexStructureDefinitionBundle(bundle: Bundle): void;
|
|
|
130
134
|
/**
|
|
131
135
|
* Indexes a StructureDefinition for fast lookup.
|
|
132
136
|
* See comments on IndexedStructureDefinition for more details.
|
|
133
|
-
* @param schema The output IndexedStructureDefinition.
|
|
134
137
|
* @param structureDefinition The original StructureDefinition.
|
|
135
138
|
*/
|
|
136
|
-
export declare function indexStructureDefinition(
|
|
139
|
+
export declare function indexStructureDefinition(structureDefinition: StructureDefinition): void;
|
|
137
140
|
/**
|
|
138
141
|
* Indexes a SearchParameter resource for fast lookup.
|
|
139
142
|
* Indexes by SearchParameter.code, which is the query string parameter name.
|
|
140
143
|
* @param schema The output IndexedStructureDefinition.
|
|
141
144
|
* @param searchParam The SearchParameter resource.
|
|
142
145
|
*/
|
|
143
|
-
export declare function indexSearchParameter(
|
|
146
|
+
export declare function indexSearchParameter(searchParam: SearchParameter): void;
|
|
144
147
|
export declare function buildTypeName(components: string[]): string;
|
|
145
148
|
export declare function getPropertyDisplayName(path: string): string;
|
|
149
|
+
/**
|
|
150
|
+
* Returns an element definition by type and property name.
|
|
151
|
+
* Handles content references.
|
|
152
|
+
* @param typeName The type name.
|
|
153
|
+
* @param propertyName The property name.
|
|
154
|
+
* @returns The element definition if found.
|
|
155
|
+
*/
|
|
156
|
+
export declare function getElementDefinition(typeName: string, propertyName: string): ElementDefinition | undefined;
|
|
146
157
|
/**
|
|
147
158
|
* Global schema singleton.
|
|
148
159
|
*/
|
package/dist/esm/types.js
CHANGED
|
@@ -93,17 +93,16 @@ function indexStructureDefinitionBundle(bundle) {
|
|
|
93
93
|
for (const entry of bundle.entry) {
|
|
94
94
|
const resource = entry.resource;
|
|
95
95
|
if (resource.resourceType === 'StructureDefinition') {
|
|
96
|
-
indexStructureDefinition(
|
|
96
|
+
indexStructureDefinition(resource);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
101
|
* Indexes a StructureDefinition for fast lookup.
|
|
102
102
|
* See comments on IndexedStructureDefinition for more details.
|
|
103
|
-
* @param schema The output IndexedStructureDefinition.
|
|
104
103
|
* @param structureDefinition The original StructureDefinition.
|
|
105
104
|
*/
|
|
106
|
-
function indexStructureDefinition(
|
|
105
|
+
function indexStructureDefinition(structureDefinition) {
|
|
107
106
|
var _a;
|
|
108
107
|
const typeName = structureDefinition.name;
|
|
109
108
|
if (!typeName) {
|
|
@@ -112,9 +111,9 @@ function indexStructureDefinition(schema, structureDefinition) {
|
|
|
112
111
|
const elements = (_a = structureDefinition.snapshot) === null || _a === void 0 ? void 0 : _a.element;
|
|
113
112
|
if (elements) {
|
|
114
113
|
// First pass, build types
|
|
115
|
-
elements.forEach((element) => indexType(
|
|
114
|
+
elements.forEach((element) => indexType(structureDefinition, element));
|
|
116
115
|
// Second pass, build properties
|
|
117
|
-
elements.forEach((element) => indexProperty(
|
|
116
|
+
elements.forEach((element) => indexProperty(element));
|
|
118
117
|
}
|
|
119
118
|
}
|
|
120
119
|
/**
|
|
@@ -124,7 +123,7 @@ function indexStructureDefinition(schema, structureDefinition) {
|
|
|
124
123
|
* @param schema The output IndexedStructureDefinition.
|
|
125
124
|
* @param element The input ElementDefinition.
|
|
126
125
|
*/
|
|
127
|
-
function indexType(
|
|
126
|
+
function indexType(structureDefinition, elementDefinition) {
|
|
128
127
|
var _a, _b;
|
|
129
128
|
const path = elementDefinition.path;
|
|
130
129
|
const typeCode = (_b = (_a = elementDefinition.type) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.code;
|
|
@@ -133,22 +132,22 @@ function indexType(schema, structureDefinition, elementDefinition) {
|
|
|
133
132
|
}
|
|
134
133
|
const parts = path.split('.');
|
|
135
134
|
const typeName = buildTypeName(parts);
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
globalSchema.types[typeName] = createTypeSchema(typeName, structureDefinition, elementDefinition);
|
|
136
|
+
globalSchema.types[typeName].parentType = buildTypeName(parts.slice(0, parts.length - 1));
|
|
138
137
|
}
|
|
139
138
|
/**
|
|
140
139
|
* Indexes PropertySchema from an ElementDefinition.
|
|
141
140
|
* @param schema The output IndexedStructureDefinition.
|
|
142
141
|
* @param element The input ElementDefinition.
|
|
143
142
|
*/
|
|
144
|
-
function indexProperty(
|
|
143
|
+
function indexProperty(element) {
|
|
145
144
|
const path = element.path;
|
|
146
145
|
const parts = path.split('.');
|
|
147
146
|
if (parts.length === 1) {
|
|
148
147
|
return;
|
|
149
148
|
}
|
|
150
149
|
const typeName = buildTypeName(parts.slice(0, parts.length - 1));
|
|
151
|
-
const typeSchema =
|
|
150
|
+
const typeSchema = globalSchema.types[typeName];
|
|
152
151
|
if (!typeSchema) {
|
|
153
152
|
return;
|
|
154
153
|
}
|
|
@@ -161,17 +160,23 @@ function indexProperty(schema, element) {
|
|
|
161
160
|
* @param schema The output IndexedStructureDefinition.
|
|
162
161
|
* @param searchParam The SearchParameter resource.
|
|
163
162
|
*/
|
|
164
|
-
function indexSearchParameter(
|
|
163
|
+
function indexSearchParameter(searchParam) {
|
|
165
164
|
if (!searchParam.base) {
|
|
166
165
|
return;
|
|
167
166
|
}
|
|
168
167
|
for (const resourceType of searchParam.base) {
|
|
169
|
-
const typeSchema =
|
|
168
|
+
const typeSchema = globalSchema.types[resourceType];
|
|
170
169
|
if (!typeSchema) {
|
|
171
170
|
continue;
|
|
172
171
|
}
|
|
173
172
|
if (!typeSchema.searchParams) {
|
|
174
173
|
typeSchema.searchParams = {
|
|
174
|
+
_id: {
|
|
175
|
+
base: [resourceType],
|
|
176
|
+
code: '_id',
|
|
177
|
+
type: 'token',
|
|
178
|
+
expression: resourceType + '.id',
|
|
179
|
+
},
|
|
175
180
|
_lastUpdated: {
|
|
176
181
|
base: [resourceType],
|
|
177
182
|
code: '_lastUpdated',
|
|
@@ -211,10 +216,37 @@ function getPropertyDisplayName(path) {
|
|
|
211
216
|
.replace('_', ' ')
|
|
212
217
|
.replace(/\s+/g, ' ');
|
|
213
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* Returns an element definition by type and property name.
|
|
221
|
+
* Handles content references.
|
|
222
|
+
* @param typeName The type name.
|
|
223
|
+
* @param propertyName The property name.
|
|
224
|
+
* @returns The element definition if found.
|
|
225
|
+
*/
|
|
226
|
+
function getElementDefinition(typeName, propertyName) {
|
|
227
|
+
var _a;
|
|
228
|
+
const typeSchema = globalSchema.types[typeName];
|
|
229
|
+
if (!typeSchema) {
|
|
230
|
+
return undefined;
|
|
231
|
+
}
|
|
232
|
+
const property = (_a = typeSchema.properties[propertyName]) !== null && _a !== void 0 ? _a : typeSchema.properties[propertyName + '[x]'];
|
|
233
|
+
if (!property) {
|
|
234
|
+
return undefined;
|
|
235
|
+
}
|
|
236
|
+
if (property.contentReference) {
|
|
237
|
+
// Content references start with a "#"
|
|
238
|
+
// Remove the "#" character
|
|
239
|
+
const contentReference = property.contentReference.substring(1).split('.');
|
|
240
|
+
const referencePropertyName = contentReference.pop();
|
|
241
|
+
const referenceTypeName = buildTypeName(contentReference);
|
|
242
|
+
return getElementDefinition(referenceTypeName, referencePropertyName);
|
|
243
|
+
}
|
|
244
|
+
return property;
|
|
245
|
+
}
|
|
214
246
|
/**
|
|
215
247
|
* Global schema singleton.
|
|
216
248
|
*/
|
|
217
249
|
const globalSchema = baseSchema;
|
|
218
250
|
|
|
219
|
-
export { PropertyType, buildTypeName, createSchema, getPropertyDisplayName, globalSchema, indexSearchParameter, indexStructureDefinition, indexStructureDefinitionBundle };
|
|
251
|
+
export { PropertyType, buildTypeName, createSchema, getElementDefinition, getPropertyDisplayName, globalSchema, indexSearchParameter, indexStructureDefinition, indexStructureDefinitionBundle };
|
|
220
252
|
//# sourceMappingURL=types.js.map
|
package/dist/esm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../src/types.ts"],"sourcesContent":["import {\n Bundle,\n BundleEntry,\n ElementDefinition,\n Resource,\n SearchParameter,\n StructureDefinition,\n} from '@medplum/fhirtypes';\nimport baseSchema from './base-schema.json';\nimport { capitalize } from './utils';\n\n/**\n * List of property types.\n * http://www.hl7.org/fhir/valueset-defined-types.html\n * The list here includes additions found from StructureDefinition resources.\n */\nexport enum PropertyType {\n Address = 'Address',\n Age = 'Age',\n Annotation = 'Annotation',\n Attachment = 'Attachment',\n BackboneElement = 'BackboneElement',\n CodeableConcept = 'CodeableConcept',\n Coding = 'Coding',\n ContactDetail = 'ContactDetail',\n ContactPoint = 'ContactPoint',\n Contributor = 'Contributor',\n Count = 'Count',\n DataRequirement = 'DataRequirement',\n Distance = 'Distance',\n Dosage = 'Dosage',\n Duration = 'Duration',\n Expression = 'Expression',\n Extension = 'Extension',\n HumanName = 'HumanName',\n Identifier = 'Identifier',\n MarketingStatus = 'MarketingStatus',\n Meta = 'Meta',\n Money = 'Money',\n Narrative = 'Narrative',\n ParameterDefinition = 'ParameterDefinition',\n Period = 'Period',\n Population = 'Population',\n ProdCharacteristic = 'ProdCharacteristic',\n ProductShelfLife = 'ProductShelfLife',\n Quantity = 'Quantity',\n Range = 'Range',\n Ratio = 'Ratio',\n Reference = 'Reference',\n RelatedArtifact = 'RelatedArtifact',\n SampledData = 'SampledData',\n Signature = 'Signature',\n SubstanceAmount = 'SubstanceAmount',\n SystemString = 'http://hl7.org/fhirpath/System.String',\n Timing = 'Timing',\n TriggerDefinition = 'TriggerDefinition',\n UsageContext = 'UsageContext',\n base64Binary = 'base64Binary',\n boolean = 'boolean',\n canonical = 'canonical',\n code = 'code',\n date = 'date',\n dateTime = 'dateTime',\n decimal = 'decimal',\n id = 'id',\n instant = 'instant',\n integer = 'integer',\n markdown = 'markdown',\n oid = 'oid',\n positiveInt = 'positiveInt',\n string = 'string',\n time = 'time',\n unsignedInt = 'unsignedInt',\n uri = 'uri',\n url = 'url',\n uuid = 'uuid',\n}\n\n/**\n * An IndexedStructureDefinition is a lookup-optimized version of a StructureDefinition.\n *\n * StructureDefinition resources contain schema information for other resource types.\n * These schemas can be used to automatically generate user interface elements for\n * resources.\n *\n * However, a StructureDefinition resource is not optimized for realtime lookups. All\n * resource types, sub types, and property definitions are stored in a flat array of\n * ElementDefinition objects. Therefore, to lookup the schema for a property (i.e., \"Patient.name\")\n * requires a linear scan of all ElementDefinition objects\n *\n * A StructureDefinition resource contains information about one or more types.\n * For example, the \"Patient\" StructureDefinition includes \"Patient\", \"Patient_Contact\",\n * \"Patient_Communication\", and \"Patient_Link\". This is inefficient.\n *\n * Instead, we create an indexed version of the StructureDefinition, called IndexedStructureDefinition.\n * In an IndexedStructureDefinition, retrieving a property definition is a hashtable lookup.\n *\n * The hierarchy is:\n * IndexedStructureDefinition - top level for one resource type\n * TypeSchema - one per resource type and all contained BackboneElements\n * PropertySchema - one per property/field\n */\nexport interface IndexedStructureDefinition {\n types: { [resourceType: string]: TypeSchema };\n}\n\n/**\n * An indexed TypeSchema.\n *\n * Example: The IndexedStructureDefinition for \"Patient\" would include the following TypeSchemas:\n * 1) Patient\n * 2) Patient_Contact\n * 3) Patient_Communication\n * 4) Patient_Link\n */\nexport interface TypeSchema {\n structureDefinition: StructureDefinition;\n elementDefinition: ElementDefinition;\n display: string;\n properties: { [name: string]: ElementDefinition };\n searchParams?: { [code: string]: SearchParameter };\n description?: string;\n parentType?: string;\n}\n\n/**\n * Creates a new empty IndexedStructureDefinition.\n * @returns The empty IndexedStructureDefinition.\n * @deprecated Use globalSchema\n */\nexport function createSchema(): IndexedStructureDefinition {\n return { types: {} };\n}\n\nfunction createTypeSchema(\n typeName: string,\n structureDefinition: StructureDefinition,\n elementDefinition: ElementDefinition\n): TypeSchema {\n return {\n structureDefinition,\n elementDefinition,\n display: typeName,\n description: elementDefinition.definition,\n properties: {},\n };\n}\n\n/**\n * Indexes a bundle of StructureDefinitions for faster lookup.\n * @param bundle A FHIR bundle StructureDefinition resources.\n */\nexport function indexStructureDefinitionBundle(bundle: Bundle): void {\n for (const entry of bundle.entry as BundleEntry[]) {\n const resource = entry.resource as Resource;\n if (resource.resourceType === 'StructureDefinition') {\n indexStructureDefinition(globalSchema, resource);\n }\n }\n}\n\n/**\n * Indexes a StructureDefinition for fast lookup.\n * See comments on IndexedStructureDefinition for more details.\n * @param schema The output IndexedStructureDefinition.\n * @param structureDefinition The original StructureDefinition.\n */\nexport function indexStructureDefinition(\n schema: IndexedStructureDefinition,\n structureDefinition: StructureDefinition\n): void {\n const typeName = structureDefinition.name;\n if (!typeName) {\n return;\n }\n\n const elements = structureDefinition.snapshot?.element;\n if (elements) {\n // First pass, build types\n elements.forEach((element) => indexType(schema, structureDefinition, element));\n\n // Second pass, build properties\n elements.forEach((element) => indexProperty(schema, element));\n }\n}\n\n/**\n * Indexes TypeSchema from an ElementDefinition.\n * In the common case, there will be many ElementDefinition instances per TypeSchema.\n * Only the first occurrence is saved.\n * @param schema The output IndexedStructureDefinition.\n * @param element The input ElementDefinition.\n */\nfunction indexType(\n schema: IndexedStructureDefinition,\n structureDefinition: StructureDefinition,\n elementDefinition: ElementDefinition\n): void {\n const path = elementDefinition.path as string;\n const typeCode = elementDefinition.type?.[0]?.code;\n if (typeCode !== undefined && typeCode !== 'Element' && typeCode !== 'BackboneElement') {\n return;\n }\n const parts = path.split('.');\n const typeName = buildTypeName(parts);\n schema.types[typeName] = createTypeSchema(typeName, structureDefinition, elementDefinition);\n schema.types[typeName].parentType = buildTypeName(parts.slice(0, parts.length - 1));\n}\n\n/**\n * Indexes PropertySchema from an ElementDefinition.\n * @param schema The output IndexedStructureDefinition.\n * @param element The input ElementDefinition.\n */\nfunction indexProperty(schema: IndexedStructureDefinition, element: ElementDefinition): void {\n const path = element.path as string;\n const parts = path.split('.');\n if (parts.length === 1) {\n return;\n }\n const typeName = buildTypeName(parts.slice(0, parts.length - 1));\n const typeSchema = schema.types[typeName];\n if (!typeSchema) {\n return;\n }\n const key = parts[parts.length - 1];\n typeSchema.properties[key] = element;\n}\n\n/**\n * Indexes a SearchParameter resource for fast lookup.\n * Indexes by SearchParameter.code, which is the query string parameter name.\n * @param schema The output IndexedStructureDefinition.\n * @param searchParam The SearchParameter resource.\n */\nexport function indexSearchParameter(schema: IndexedStructureDefinition, searchParam: SearchParameter): void {\n if (!searchParam.base) {\n return;\n }\n\n for (const resourceType of searchParam.base) {\n const typeSchema = schema.types[resourceType];\n if (!typeSchema) {\n continue;\n }\n\n if (!typeSchema.searchParams) {\n typeSchema.searchParams = {\n _lastUpdated: {\n base: [resourceType],\n code: '_lastUpdated',\n type: 'date',\n expression: resourceType + '.meta.lastUpdated',\n } as SearchParameter,\n };\n }\n\n typeSchema.searchParams[searchParam.code as string] = searchParam;\n }\n}\n\nexport function buildTypeName(components: string[]): string {\n if (components.length === 1) {\n return components[0];\n }\n return components.map(capitalize).join('');\n}\n\nexport function getPropertyDisplayName(path: string): string {\n // Get the property name, which is the remainder after the last period\n // For example, for path \"Patient.birthDate\"\n // the property name is \"birthDate\"\n const propertyName = path.replaceAll('[x]', '').split('.').pop() as string;\n\n // Special case for ID\n if (propertyName === 'id') {\n return 'ID';\n }\n\n // Split by capital letters\n // Capitalize the first letter of each word\n // Join together with spaces in between\n // Then normalize whitespace to single space character\n // For example, for property name \"birthDate\",\n // the display name is \"Birth Date\".\n return propertyName\n .split(/(?=[A-Z])/)\n .map(capitalize)\n .join(' ')\n .replace('_', ' ')\n .replace(/\\s+/g, ' ');\n}\n\n/**\n * Global schema singleton.\n */\nexport const globalSchema = baseSchema as unknown as IndexedStructureDefinition;\n"],"names":[],"mappings":";;;AAWA;;;;AAIG;IACS,aA4DX;AA5DD,CAAA,UAAY,YAAY,EAAA;AACtB,IAAA,YAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,YAAA,CAAA,KAAA,CAAA,GAAA,KAAW,CAAA;AACX,IAAA,YAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AACzB,IAAA,YAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AACzB,IAAA,YAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC,CAAA;AACnC,IAAA,YAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC,CAAA;AACnC,IAAA,YAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,YAAA,CAAA,eAAA,CAAA,GAAA,eAA+B,CAAA;AAC/B,IAAA,YAAA,CAAA,cAAA,CAAA,GAAA,cAA6B,CAAA;AAC7B,IAAA,YAAA,CAAA,aAAA,CAAA,GAAA,aAA2B,CAAA;AAC3B,IAAA,YAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACf,IAAA,YAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC,CAAA;AACnC,IAAA,YAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACrB,IAAA,YAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,YAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACrB,IAAA,YAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AACzB,IAAA,YAAA,CAAA,WAAA,CAAA,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AC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC7C,CAAC;AAEK,SAAU,sBAAsB,CAAC,IAAY,EAAA;;;;AAIjD,IAAA,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAY,CAAC;;IAG3E,IAAI,YAAY,KAAK,IAAI,EAAE;AACzB,QAAA,OAAO,IAAI,CAAC;AACb,KAAA;;;;;;;AAQD,IAAA,OAAO,YAAY;SAChB,KAAK,CAAC,WAAW,CAAC;SAClB,GAAG,CAAC,UAAU,CAAC;SACf,IAAI,CAAC,GAAG,CAAC;AACT,SAAA,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC;AACjB,SAAA,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC1B,CAAC;AAED;;AAEG;AACI,MAAM,YAAY,GAAG;;;;"}
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../src/types.ts"],"sourcesContent":["import {\n Bundle,\n BundleEntry,\n ElementDefinition,\n Resource,\n SearchParameter,\n StructureDefinition,\n} from '@medplum/fhirtypes';\nimport baseSchema from './base-schema.json';\nimport { SearchParameterDetails } from './searchparams';\nimport { capitalize } from './utils';\n\n/**\n * List of property types.\n * http://www.hl7.org/fhir/valueset-defined-types.html\n * The list here includes additions found from StructureDefinition resources.\n */\nexport enum PropertyType {\n Address = 'Address',\n Age = 'Age',\n Annotation = 'Annotation',\n Attachment = 'Attachment',\n BackboneElement = 'BackboneElement',\n CodeableConcept = 'CodeableConcept',\n Coding = 'Coding',\n ContactDetail = 'ContactDetail',\n ContactPoint = 'ContactPoint',\n Contributor = 'Contributor',\n Count = 'Count',\n DataRequirement = 'DataRequirement',\n Distance = 'Distance',\n Dosage = 'Dosage',\n Duration = 'Duration',\n Expression = 'Expression',\n Extension = 'Extension',\n HumanName = 'HumanName',\n Identifier = 'Identifier',\n MarketingStatus = 'MarketingStatus',\n Meta = 'Meta',\n Money = 'Money',\n Narrative = 'Narrative',\n ParameterDefinition = 'ParameterDefinition',\n Period = 'Period',\n Population = 'Population',\n ProdCharacteristic = 'ProdCharacteristic',\n ProductShelfLife = 'ProductShelfLife',\n Quantity = 'Quantity',\n Range = 'Range',\n Ratio = 'Ratio',\n Reference = 'Reference',\n RelatedArtifact = 'RelatedArtifact',\n SampledData = 'SampledData',\n Signature = 'Signature',\n SubstanceAmount = 'SubstanceAmount',\n SystemString = 'http://hl7.org/fhirpath/System.String',\n Timing = 'Timing',\n TriggerDefinition = 'TriggerDefinition',\n UsageContext = 'UsageContext',\n base64Binary = 'base64Binary',\n boolean = 'boolean',\n canonical = 'canonical',\n code = 'code',\n date = 'date',\n dateTime = 'dateTime',\n decimal = 'decimal',\n id = 'id',\n instant = 'instant',\n integer = 'integer',\n markdown = 'markdown',\n oid = 'oid',\n positiveInt = 'positiveInt',\n string = 'string',\n time = 'time',\n unsignedInt = 'unsignedInt',\n uri = 'uri',\n url = 'url',\n uuid = 'uuid',\n}\n\n/**\n * An IndexedStructureDefinition is a lookup-optimized version of a StructureDefinition.\n *\n * StructureDefinition resources contain schema information for other resource types.\n * These schemas can be used to automatically generate user interface elements for\n * resources.\n *\n * However, a StructureDefinition resource is not optimized for realtime lookups. All\n * resource types, sub types, and property definitions are stored in a flat array of\n * ElementDefinition objects. Therefore, to lookup the schema for a property (i.e., \"Patient.name\")\n * requires a linear scan of all ElementDefinition objects\n *\n * A StructureDefinition resource contains information about one or more types.\n * For example, the \"Patient\" StructureDefinition includes \"Patient\", \"Patient_Contact\",\n * \"Patient_Communication\", and \"Patient_Link\". This is inefficient.\n *\n * Instead, we create an indexed version of the StructureDefinition, called IndexedStructureDefinition.\n * In an IndexedStructureDefinition, retrieving a property definition is a hashtable lookup.\n *\n * The hierarchy is:\n * IndexedStructureDefinition - top level for one resource type\n * TypeSchema - one per resource type and all contained BackboneElements\n * PropertySchema - one per property/field\n */\nexport interface IndexedStructureDefinition {\n types: { [resourceType: string]: TypeSchema };\n}\n\n/**\n * An indexed TypeSchema.\n *\n * Example: The IndexedStructureDefinition for \"Patient\" would include the following TypeSchemas:\n * 1) Patient\n * 2) Patient_Contact\n * 3) Patient_Communication\n * 4) Patient_Link\n */\nexport interface TypeSchema {\n structureDefinition: StructureDefinition;\n elementDefinition: ElementDefinition;\n display: string;\n properties: { [name: string]: ElementDefinition };\n searchParams?: { [code: string]: SearchParameter };\n searchParamsDetails?: { [code: string]: SearchParameterDetails };\n description?: string;\n parentType?: string;\n}\n\n/**\n * Creates a new empty IndexedStructureDefinition.\n * @returns The empty IndexedStructureDefinition.\n * @deprecated Use globalSchema\n */\nexport function createSchema(): IndexedStructureDefinition {\n return { types: {} };\n}\n\nfunction createTypeSchema(\n typeName: string,\n structureDefinition: StructureDefinition,\n elementDefinition: ElementDefinition\n): TypeSchema {\n return {\n structureDefinition,\n elementDefinition,\n display: typeName,\n description: elementDefinition.definition,\n properties: {},\n };\n}\n\n/**\n * Indexes a bundle of StructureDefinitions for faster lookup.\n * @param bundle A FHIR bundle StructureDefinition resources.\n */\nexport function indexStructureDefinitionBundle(bundle: Bundle): void {\n for (const entry of bundle.entry as BundleEntry[]) {\n const resource = entry.resource as Resource;\n if (resource.resourceType === 'StructureDefinition') {\n indexStructureDefinition(resource);\n }\n }\n}\n\n/**\n * Indexes a StructureDefinition for fast lookup.\n * See comments on IndexedStructureDefinition for more details.\n * @param structureDefinition The original StructureDefinition.\n */\nexport function indexStructureDefinition(structureDefinition: StructureDefinition): void {\n const typeName = structureDefinition.name;\n if (!typeName) {\n return;\n }\n\n const elements = structureDefinition.snapshot?.element;\n if (elements) {\n // First pass, build types\n elements.forEach((element) => indexType(structureDefinition, element));\n\n // Second pass, build properties\n elements.forEach((element) => indexProperty(element));\n }\n}\n\n/**\n * Indexes TypeSchema from an ElementDefinition.\n * In the common case, there will be many ElementDefinition instances per TypeSchema.\n * Only the first occurrence is saved.\n * @param schema The output IndexedStructureDefinition.\n * @param element The input ElementDefinition.\n */\nfunction indexType(structureDefinition: StructureDefinition, elementDefinition: ElementDefinition): void {\n const path = elementDefinition.path as string;\n const typeCode = elementDefinition.type?.[0]?.code;\n if (typeCode !== undefined && typeCode !== 'Element' && typeCode !== 'BackboneElement') {\n return;\n }\n const parts = path.split('.');\n const typeName = buildTypeName(parts);\n globalSchema.types[typeName] = createTypeSchema(typeName, structureDefinition, elementDefinition);\n globalSchema.types[typeName].parentType = buildTypeName(parts.slice(0, parts.length - 1));\n}\n\n/**\n * Indexes PropertySchema from an ElementDefinition.\n * @param schema The output IndexedStructureDefinition.\n * @param element The input ElementDefinition.\n */\nfunction indexProperty(element: ElementDefinition): void {\n const path = element.path as string;\n const parts = path.split('.');\n if (parts.length === 1) {\n return;\n }\n const typeName = buildTypeName(parts.slice(0, parts.length - 1));\n const typeSchema = globalSchema.types[typeName];\n if (!typeSchema) {\n return;\n }\n const key = parts[parts.length - 1];\n typeSchema.properties[key] = element;\n}\n\n/**\n * Indexes a SearchParameter resource for fast lookup.\n * Indexes by SearchParameter.code, which is the query string parameter name.\n * @param schema The output IndexedStructureDefinition.\n * @param searchParam The SearchParameter resource.\n */\nexport function indexSearchParameter(searchParam: SearchParameter): void {\n if (!searchParam.base) {\n return;\n }\n\n for (const resourceType of searchParam.base) {\n const typeSchema = globalSchema.types[resourceType];\n if (!typeSchema) {\n continue;\n }\n\n if (!typeSchema.searchParams) {\n typeSchema.searchParams = {\n _id: {\n base: [resourceType],\n code: '_id',\n type: 'token',\n expression: resourceType + '.id',\n } as SearchParameter,\n _lastUpdated: {\n base: [resourceType],\n code: '_lastUpdated',\n type: 'date',\n expression: resourceType + '.meta.lastUpdated',\n } as SearchParameter,\n };\n }\n\n typeSchema.searchParams[searchParam.code as string] = searchParam;\n }\n}\n\nexport function buildTypeName(components: string[]): string {\n if (components.length === 1) {\n return components[0];\n }\n return components.map(capitalize).join('');\n}\n\nexport function getPropertyDisplayName(path: string): string {\n // Get the property name, which is the remainder after the last period\n // For example, for path \"Patient.birthDate\"\n // the property name is \"birthDate\"\n const propertyName = path.replaceAll('[x]', '').split('.').pop() as string;\n\n // Special case for ID\n if (propertyName === 'id') {\n return 'ID';\n }\n\n // Split by capital letters\n // Capitalize the first letter of each word\n // Join together with spaces in between\n // Then normalize whitespace to single space character\n // For example, for property name \"birthDate\",\n // the display name is \"Birth Date\".\n return propertyName\n .split(/(?=[A-Z])/)\n .map(capitalize)\n .join(' ')\n .replace('_', ' ')\n .replace(/\\s+/g, ' ');\n}\n\n/**\n * Returns an element definition by type and property name.\n * Handles content references.\n * @param typeName The type name.\n * @param propertyName The property name.\n * @returns The element definition if found.\n */\nexport function getElementDefinition(typeName: string, propertyName: string): ElementDefinition | undefined {\n const typeSchema = globalSchema.types[typeName];\n if (!typeSchema) {\n return undefined;\n }\n\n const property = typeSchema.properties[propertyName] ?? typeSchema.properties[propertyName + '[x]'];\n if (!property) {\n return undefined;\n }\n\n if (property.contentReference) {\n // Content references start with a \"#\"\n // Remove the \"#\" character\n const contentReference = property.contentReference.substring(1).split('.');\n const referencePropertyName = contentReference.pop() as string;\n const referenceTypeName = buildTypeName(contentReference);\n return getElementDefinition(referenceTypeName, referencePropertyName);\n }\n\n return property;\n}\n\n/**\n * Global schema singleton.\n */\nexport const globalSchema = baseSchema as unknown as IndexedStructureDefinition;\n"],"names":[],"mappings":";;;AAYA;;;;AAIG;IACS,aA4DX;AA5DD,CAAA,UAAY,YAAY,EAAA;AACtB,IAAA,YAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,YAAA,CAAA,KAAA,CAAA,GAAA,KAAW,CAAA;AACX,IAAA,YAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AACzB,IAAA,YAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AACzB,IAAA,YAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC,CAAA;AACnC,IAAA,YAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC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ED;;;;;;AAMG;AACa,SAAA,oBAAoB,CAAC,QAAgB,EAAE,YAAoB,EAAA;;IACzE,MAAM,UAAU,GAAG,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAChD,IAAI,CAAC,UAAU,EAAE;AACf,QAAA,OAAO,SAAS,CAAC;AAClB,KAAA;AAED,IAAA,MAAM,QAAQ,GAAG,CAAA,EAAA,GAAA,UAAU,CAAC,UAAU,CAAC,YAAY,CAAC,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,UAAU,CAAC,UAAU,CAAC,YAAY,GAAG,KAAK,CAAC,CAAC;IACpG,IAAI,CAAC,QAAQ,EAAE;AACb,QAAA,OAAO,SAAS,CAAC;AAClB,KAAA;IAED,IAAI,QAAQ,CAAC,gBAAgB,EAAE;;;AAG7B,QAAA,MAAM,gBAAgB,GAAG,QAAQ,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC3E,QAAA,MAAM,qBAAqB,GAAG,gBAAgB,CAAC,GAAG,EAAY,CAAC;AAC/D,QAAA,MAAM,iBAAiB,GAAG,aAAa,CAAC,gBAAgB,CAAC,CAAC;AAC1D,QAAA,OAAO,oBAAoB,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,CAAC;AACvE,KAAA;AAED,IAAA,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;AAEG;AACI,MAAM,YAAY,GAAG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medplum/core",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.35",
|
|
4
4
|
"description": "Medplum TS/JS Library",
|
|
5
5
|
"author": "Medplum <hello@medplum.com>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"test": "jest"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@medplum/definitions": "0.9.
|
|
21
|
-
"@medplum/fhirtypes": "0.9.
|
|
20
|
+
"@medplum/definitions": "0.9.35",
|
|
21
|
+
"@medplum/fhirtypes": "0.9.35"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"pdfmake": "0.2.5"
|