Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support memberOf check against new CodeableReference datatype #3634

Closed
lmsurpre opened this issue May 16, 2022 · 2 comments
Closed

support memberOf check against new CodeableReference datatype #3634

lmsurpre opened this issue May 16, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@lmsurpre
Copy link
Member

Is your feature request related to a problem? Please describe.
In the current r4b-rebased branch, one of our ClinicalUseDefinition examples fails validation due to the following:

Caused by: java.lang.RuntimeException: An error occurred while validating constraint: clinicalUseDefinition-5 with location: indication.intendedEffect and expression: $this.memberOf('http://hl7.org/fhir/ValueSet/product-intended-use', 'preferred') at path: ClinicalUseDefinition
	at com.ibm.fhir.validation.FHIRValidator$ValidatingNodeVisitor.validate(FHIRValidator.java:436)
	at com.ibm.fhir.validation.FHIRValidator$ValidatingNodeVisitor.validate(FHIRValidator.java:368)
	at com.ibm.fhir.validation.FHIRValidator$ValidatingNodeVisitor.validate(FHIRValidator.java:337)
	at com.ibm.fhir.validation.FHIRValidator$ValidatingNodeVisitor.doVisit(FHIRValidator.java:297)
	at com.ibm.fhir.path.visitor.FHIRPathDefaultNodeVisitor.visit(FHIRPathDefaultNodeVisitor.java:81)
	at com.ibm.fhir.path.FHIRPathResourceNode.accept(FHIRPathResourceNode.java:197)
	at com.ibm.fhir.validation.FHIRValidator$ValidatingNodeVisitor.validate(FHIRValidator.java:269)
	at com.ibm.fhir.validation.FHIRValidator.validate(FHIRValidator.java:217)
	... 36 more
Caused by: com.ibm.fhir.path.exception.FHIRPathException: java.lang.IllegalArgumentException: The 'memberOf' function must be invoked on a coded element node, quantity element node, string element node, or uri element node  [probeId=7f-0-0-1-427f7dfa-6586-4683-a347-a9e1266e3bb0]
	at com.ibm.fhir.path.evaluator.FHIRPathEvaluator.evaluate(FHIRPathEvaluator.java:257)
	at com.ibm.fhir.validation.FHIRValidator$ValidatingNodeVisitor.validate(FHIRValidator.java:414)
	... 43 more
Caused by: java.lang.IllegalArgumentException: The 'memberOf' function must be invoked on a coded element node, quantity element node, string element node, or uri element node
	at com.ibm.fhir.path.function.MemberOfFunction.apply(MemberOfFunction.java:88)
	at com.ibm.fhir.path.evaluator.FHIRPathEvaluator$EvaluatingVisitor.visitFunction(FHIRPathEvaluator.java:1200)
	at com.ibm.fhir.path.evaluator.FHIRPathEvaluator$EvaluatingVisitor.visitFunction(FHIRPathEvaluator.java:1)
	at com.ibm.fhir.path.FHIRPathParser$FunctionContext.accept(FHIRPathParser.java:1140)
	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46)
	at com.ibm.fhir.path.evaluator.FHIRPathEvaluator$EvaluatingVisitor.visitFunctionInvocation(FHIRPathEvaluator.java:1124)
	at com.ibm.fhir.path.evaluator.FHIRPathEvaluator$EvaluatingVisitor.visitFunctionInvocation(FHIRPathEvaluator.java:1)
	at com.ibm.fhir.path.FHIRPathParser$FunctionInvocationContext.accept(FHIRPathParser.java:1051)
	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
	at com.ibm.fhir.path.evaluator.FHIRPathEvaluator$EvaluatingVisitor.visitInvocationExpression(FHIRPathEvaluator.java:863)
	at com.ibm.fhir.path.evaluator.FHIRPathEvaluator$EvaluatingVisitor.visitInvocationExpression(FHIRPathEvaluator.java:1)
	at com.ibm.fhir.path.FHIRPathParser$InvocationExpressionContext.accept(FHIRPathParser.java:279)
	at com.ibm.fhir.path.evaluator.FHIRPathEvaluator$EvaluatingVisitor.evaluate(FHIRPathEvaluator.java:302)
	at com.ibm.fhir.path.evaluator.FHIRPathEvaluator.evaluate(FHIRPathEvaluator.java:255)
	... 44 more

I think its because this indication.intendedEffect is of type "CodeableReference"

Describe the solution you'd like
Allow memberOf to execute against FHIR elements with this new data type.

Describe alternatives you've considered

Acceptance Criteria

  1. validation should work against instances that use this new datatype like ClinicalUseDefinition

Additional context

@lmsurpre lmsurpre added the enhancement New feature or request label May 16, 2022
@lmsurpre lmsurpre self-assigned this May 17, 2022
lmsurpre added a commit that referenced this issue May 17, 2022
Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
lmsurpre added a commit that referenced this issue May 17, 2022
Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
lmsurpre added a commit that referenced this issue May 24, 2022
issue #3634 - memberOf works with CodeableReference elements
@punktilious
Copy link
Collaborator

Check we can CREATE all the ClinicalUseDefinition resources in our examples:

for file in $(find /path/to/git/FHIR/fhir-examples -name 'ClinicalUseDefinition*.json'); do
    curl -k -i \
    -H 'Content-Type: application/json' \
    -X POST \
    -u 'fhiruser:change-password' 'https://localhost:9443/fhir-server/api/v4/ClinicalUseDefinition' \
    -d "@${file}"
done

Every example gets a 201 response.

@punktilious
Copy link
Collaborator

Note search parameters do not currently work for the CodeableReference datatype. See #3854

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants