Use optional fhirpath.evaluate from QRFContext#45
Conversation
src/types.ts
Outdated
| }; | ||
|
|
||
| export type EvaluateFhirpath = ( | ||
| fhirData: any, |
There was a problem hiding this comment.
evaluate fhirpath should be (context, path, env) => any[]. (pay attention to naming, it's important)
It will make our sdc-qrf model-independent, and we can use it like:
evaluateFhirpath={(context, path, env) => fhirpath(context, path, env, models.r4b, {userInvocationTable: {...}})}
| () => getBranchItems(fieldPath, initialContext.questionnaire, initialContext.resource), | ||
| [fieldPath, initialContext.questionnaire, initialContext.resource], | ||
| ); | ||
| const { contexts } = useQuestionItemContext({ |
There was a problem hiding this comment.
pass evaluateFhirpath also here - this function uses evaluateFHIRPathExpression too
and in resolveTemplateExpr
export function resolveTemplateExpr(
str: string,
context: ItemContext,
path: string,
evaluateFhirpath,
returnNullIfUnresolved?: false,
)
and in parseFhirQueryExpression use default evaluateFhirpath
ruscoder
left a comment
There was a problem hiding this comment.
@alexlipovka please have a look
|
@alexlipovka also it will be good to extend isQuestionEnabled with evaluateFhirpath, as well as getEnabledQuestions and removeDIsabledAnswers. |
| export function parseFhirQueryExpression( | ||
| expression: string, | ||
| context: ItemContext, | ||
| path: string = 'unknown', |
There was a problem hiding this comment.
add evaluateFhirpath=defaultFhirpathEvaluate
There was a problem hiding this comment.
Do we really need that default? It internally calls evaluateFHIRPathExpression via resolveTamplateExpr which calls default, when evaluateFhirpath is undefined.
No description provided.