From 074a9ca3a33ffbb91d9bba5a77b4aeae26a175df Mon Sep 17 00:00:00 2001 From: beapen Date: Fri, 4 Jun 2021 19:21:18 -0400 Subject: [PATCH 1/4] Add devcontainer config --- .devcontainer/devcontainer.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..e2f1c07 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,9 @@ +{ + "image": "mcr.microsoft.com/vscode/devcontainers/typescript-node:0-12", + "extensions": [ + "dbaeumer.vscode-eslint" + ], + "forwardPorts": [ + 3000 + ] +} \ No newline at end of file From 8a2ea5430a2f171a89f88402ef5568a81e9fc48c Mon Sep 17 00:00:00 2001 From: Marco Ferreira Date: Sat, 5 Jun 2021 14:31:39 +0200 Subject: [PATCH 2/4] fix range input value type convertion --- src/ques-mapper.ts | 8 +++++--- src/resp-mapper.ts | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ques-mapper.ts b/src/ques-mapper.ts index 033a19c..4b7626a 100644 --- a/src/ques-mapper.ts +++ b/src/ques-mapper.ts @@ -154,7 +154,7 @@ const ProcessQuestionnaireItem = (item: R4.IQuestionnaire_Item) => { }; const GetOptions = (item: R4.IQuestionnaire_Item) => { - let enumOptions: string[] = []; + let enumOptions: (string|number)[] = []; let enumNames: string[] = []; if (typeof item.answerOption !== 'undefined') { @@ -162,7 +162,9 @@ const GetOptions = (item: R4.IQuestionnaire_Item) => { let code = typeof choice.valueCoding === 'undefined' ? '' - : choice.valueCoding.code?.toString(); + : GetControlType(item) === 'integer' + ? choice.valueCoding.code && parseInt(choice.valueCoding.code) + : choice.valueCoding.code?.toString(); enumOptions.push(typeof code === 'undefined' ? '' : code); @@ -264,7 +266,7 @@ const GetControlType = (item: R4.IQuestionnaire_Item) => { } if (coding?.code === EXTENSION_SLIDER) { - return 'number' + return 'integer' } } diff --git a/src/resp-mapper.ts b/src/resp-mapper.ts index b712ce4..7a51b32 100644 --- a/src/resp-mapper.ts +++ b/src/resp-mapper.ts @@ -86,7 +86,7 @@ const formValueToFhirAnswer = ( ); answer.push({ [propertyName]: { - code: formDataValue, + code: `${formDataValue}`, display: enumNames[valueIndex] || null, }, }); From 966b800c593c7e5674ea7c754336993ed2d453e3 Mon Sep 17 00:00:00 2001 From: Marco Ferreira Date: Sat, 5 Jun 2021 14:45:52 +0200 Subject: [PATCH 3/4] fix: dont convert null/undefined to string --- src/resp-mapper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resp-mapper.ts b/src/resp-mapper.ts index 7a51b32..9f14733 100644 --- a/src/resp-mapper.ts +++ b/src/resp-mapper.ts @@ -86,7 +86,7 @@ const formValueToFhirAnswer = ( ); answer.push({ [propertyName]: { - code: `${formDataValue}`, + code: formDataValue !== null && formDataValue !== void 0 ? `${formDataValue}` : formDataValue, display: enumNames[valueIndex] || null, }, }); From cda56c215652dbc21e4a91f11d36c87bb170a708 Mon Sep 17 00:00:00 2001 From: Bell Eapen Date: Sat, 5 Jun 2021 18:28:04 +0000 Subject: [PATCH 4/4] update 0.9.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 144af53..65d4203 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "fhirformjs", "description": "FHIR Questionnaire To Form Converter for rendering", - "version": "0.9.1", + "version": "0.9.2", "license": "MIT", "main": "dist/index.js", "typings": "dist/index.d.ts",