Skip to content

Commit

Permalink
Merge branch 'release/0.9.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
dermatologist authored Jun 5, 2021
2 parents b932a4f + cda56c2 commit 04a61bd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
9 changes: 9 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"image": "mcr.microsoft.com/vscode/devcontainers/typescript-node:0-12",
"extensions": [
"dbaeumer.vscode-eslint"
],
"forwardPorts": [
3000
]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
8 changes: 5 additions & 3 deletions src/ques-mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,17 @@ 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') {
item.answerOption?.forEach(function(choice, _) {
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);

Expand Down Expand Up @@ -264,7 +266,7 @@ const GetControlType = (item: R4.IQuestionnaire_Item) => {
}

if (coding?.code === EXTENSION_SLIDER) {
return 'number'
return 'integer'
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/resp-mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const formValueToFhirAnswer = (
);
answer.push({
[propertyName]: {
code: formDataValue,
code: formDataValue !== null && formDataValue !== void 0 ? `${formDataValue}` : formDataValue,
display: enumNames[valueIndex] || null,
},
});
Expand Down

0 comments on commit 04a61bd

Please sign in to comment.