LinuxForHealth / FHIR

The LinuxForHealth FHIR® Server and related projects

Home Page:https://linuxforhealth.github.io/FHIR

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueSet-validate-code: FHIRegistry looks up CodeSystem instance and not ValueSet instance leading to ClassCastException

paulolaup opened this issue · comments

Describe the bug
If the ValueSet-validate-code operation is used to validate some code against some value set, the server falsely returns a CodeSystem isntance during processing even though the correct class to look for is specified. This leads to a ClassCastException and terminates the operation unsuccessfully.

The origin is the org.linuxforhealth.fhir.registry.FHIRRegistry::getResource method.

If requested, I can provide error logs containing the stacktrace.

Environment
I'm using version 5.1.1 of the server.

To Reproduce
Steps to reproduce the behavior:

  1. Post CodeSystem and ValueSet instance to server with same value in url-element (this might and shoudl not matter).
  2. Post ValueSet-validate-code operation with parameters url, code and system to the server (url and system with same value).

Expected behavior
Irrespective of the URL used to identifiy the value set the FHIRRegistry should look up a ValueSet instance and not a CodeSystem instant and process the request properly.

Agree we should do better in this case, but this url field is like the canonical id of this definitional resource and, per the spec, should be globally unique. In my opinion, it is unwise to use the same canonical uri for both the codesystem and the valueset.

hi @paulolaup , how are you doing? I'm a software engineer and working on FHIR server recently. I was wondering is it possible to ask you how to import a IG package into this FHIR server? If you can share your experience or provide some related links, it would be a big help for me. Thank you so much and have a great one.