PharmaLedger-IMI / ctr-workspace

UC8 Clinical Trials Recruitment
MIT License
2 stars 0 forks source link

ctr-backoffice-backend LFormsService.enrichWithCriteria will not skip invisible questions with answers #15

Open joaoluis-pdm opened 3 years ago

joaoluis-pdm commented 3 years ago

ctr-backoffice-backend LFormsService.enrichWithCriteria will not skip invisible questions with answers. A question might be invisible, and still have an answer, but there is nothing in the item JSON that shows it. Example:

Checking item {
  value: {
    code: 'yesNrAxSpA',
    text: 'Yes, I have non-radiographic Axial Spondyloarthritis (nr-axSpA)',
    label: null,
    score: null,
    system: null
  },
  header: false,
  linkId: 'haveAxSpa',
  answers: [
    {
      code: 'yesAxSpA',
      text: 'Yes, I have Ankylosing Spondylitis (AS)',
      label: null,
      score: null,
      system: null
    },
    {
      code: 'yesNrAxSpA',
      text: 'Yes, I have non-radiographic Axial Spondyloarthritis (nr-axSpA)',
      label: null,
      score: null,
      system: null
    },
    {
      code: 'yesUnspec',
      text: 'Yes, I have total ankylosis of the spine',
      label: null,
      score: null,
      system: null
    },
    {
      code: 'noNotSure',
      text: 'No, or I am not sure.',
      label: null,
      score: null,
      system: null
    }
  ],
  dataType: 'CNE',
  editable: '1',
  question: 'Have you being diagnosed with Axial Spondyloarthritis ?',
  ctrExtension: {
    cqtId: 'd666a5a5-07c3-4536-90d0-de8843ba07e7',
    qtCriteria: 'code!="noNotSure"&&code!="yesUnspec"'
  },
  displayControl: { answerLayout: { type: 'RADIO_CHECKBOX' } },
  answerCardinality: { max: '1', min: '1' },
  localQuestionCode: 'haveAxSpa',
  questionCardinality: { max: '1', min: '1' }
}
Checking item {
  value: { code: 'yes', text: 'Yes', label: null, score: null, system: null },
  header: false,
  linkId: 'haveAxSpaXRay',
  answers: [
    { code: 'yes', text: 'Yes', label: null, score: null, system: null },
    { code: 'no', text: 'No', label: null, score: null, system: null }
  ],
  dataType: 'CNE',
  editable: '1',
  question: 'Did your doctor perform an x-ray to confirm your diagnosis of Ankylosing Spondylitis (AS)?',
  skipLogic: { logic: 'ALL', action: 'show', conditions: [{"source": "haveAxSpa", "trigger": {"value": {"code": "yesAxSpA"}}}] },
  ctrExtension: {
    cqtId: 'e838919e-28f1-45f5-bf8e-0b50ad6bad5c',
    qtCriteria: 'code=="yes"'
  },
  displayControl: { answerLayout: { type: 'RADIO_CHECKBOX' } },
  answerCardinality: { max: '1', min: '1' },
  localQuestionCode: 'haveAxSpaXRay',
  questionCardinality: { max: '1', min: '1' }
}

The second item has an answer, but it should be considered a hidden questions, because the user changed the answer to the first item to be 'yesNrAxSpA' which should hide the second item. There seems to be no way of knowing that without evaluating the "skipLogic" of each item.