Skip to content

Commit

Permalink
Update getting cqf expresioon for _text, _required and _readOnly
Browse files Browse the repository at this point in the history
  • Loading branch information
vesnushka committed Nov 18, 2024
1 parent 6ec346a commit 9842988
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions sdc-qrf/src/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@ import {
QuestionItemProps,
QuestionItemsProps,
} from './types';
import {
calcContext,
findExtensionByUrl,
getBranchItems,
getEnabledQuestions,
wrapAnswerValue,
} from './utils';
import { calcContext, getBranchItems, getEnabledQuestions, wrapAnswerValue } from './utils';

export function usePreviousValue<T = any>(value: T) {
const prevValue = useRef<T>();
Expand Down Expand Up @@ -57,8 +51,6 @@ export function QuestionItems(props: QuestionItemsProps) {
);
}

const cqfExpressionExtensionUrl = 'http://hl7.org/fhir/StructureDefinition/cqf-expression';

export function QuestionItem(props: QuestionItemProps) {
const { questionItem: initialQuestionItem, context: initialContext, parentPath } = props;
const {
Expand Down Expand Up @@ -147,8 +139,7 @@ export function QuestionItem(props: QuestionItemProps) {

useEffect(() => {
if (itemContext && _text) {
const extension = findExtensionByUrl(cqfExpressionExtensionUrl, _text.extension);
const cqfExpression = extension?.valueExpression;
const cqfExpression = _text.cqfExpression;
const calculatedValue =
evaluateQuestionItemExpression(
linkId,
Expand All @@ -166,8 +157,7 @@ export function QuestionItem(props: QuestionItemProps) {
}

if (itemContext && _readOnly) {
const extension = findExtensionByUrl(cqfExpressionExtensionUrl, _readOnly.extension);
const cqfExpression = extension?.valueExpression;
const cqfExpression = _readOnly.cqfExpression;
const calculatedValue =
evaluateQuestionItemExpression(
linkId,
Expand All @@ -185,8 +175,7 @@ export function QuestionItem(props: QuestionItemProps) {
}

if (itemContext && _required) {
const extension = findExtensionByUrl(cqfExpressionExtensionUrl, _required.extension);
const cqfExpression = extension?.valueExpression;
const cqfExpression = _required.cqfExpression;
const calculatedValue =
evaluateQuestionItemExpression(
linkId,
Expand Down

0 comments on commit 9842988

Please sign in to comment.