Open atuonufure opened 1 year ago
Describe the bug
When we try to get a questionnaire in FHIR format, an error occurs and the questionnaire remains in Aidbox format.
Request URL: http://localhost:8080/fhir/Questionnaire/new-appointment Request Method: GET Status Code: 500 Internal Server Error Remote Address: [::1]:8080 Referrer Policy: strict-origin-when-cross-origin Content-Length: 4323 Content-Type: application/json Date: Wed, 29 Mar 2023 08:03:18 GMT License-Mode: normal Server: http-kit X-Duration: 5 X-Request-Id: 7e4b7638-4a72-42e8-9fbc-d2005fd77d22 Provisional headers are shown Learn more accept: application/json content-type: application/json Referer: http://localhost:8080/ui/console sec-ch-ua: "Google Chrome";v="111", "Not(A:Brand";v="8", "Chromium";v="111" sec-ch-ua-mobile: ?0 sec-ch-ua-platform: "Linux" User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36
Severity
Critical.
Steps to reproduce the behavior:
Prepare the following test data
Make an API call http://localhost:8080/fhir/Questionnaire/new-appointment
Receive the following errored response
{ "resourceType": "OperationOutcome", "id": "exception", "text": { "status": "generated", "div": "class clojure.lang.MapEntry cannot be cast to class clojure.lang.IPersistentMap (clojure.lang.MapEntry and clojure.lang.IPersistentMap are in unnamed module of loader 'app')" }, "issue": [ { "severity": "fatal", "code": "exception", "diagnostics": "java.lang.ClassCastException: class clojure.lang.MapEntry cannot be cast to class clojure.lang.IPersistentMap (clojure.lang.MapEntry and clojure.lang.IPersistentMap are in unnamed module of loader 'app')\n at clojure.lang.RT.dissoc (RT.java:891)\n clojure.core$dissoc.invokeStatic (core.clj:1526)\n clojure.core$dissoc.invoke (core.clj:1519)\n fhir.conv3$export_reference_value.invokeStatic (conv3.clj:88)\n fhir.conv3$export_reference_value.invoke (conv3.clj:85)\n fhir.conv3$export_extension$mk_ext__19523.invoke (conv3.clj:229)\n clojure.core$mapv$fn__8535.invoke (core.clj:6979)\n clojure.core.protocols$iter_reduce.invokeStatic (protocols.clj:49)\n clojure.core.protocols$fn__8230.invokeStatic (protocols.clj:75)\n clojure.core.protocols/fn (protocols.clj:75)\n clojure.core.protocols$fn__8178$G__8173__8191.invoke (protocols.clj:13)\n clojure.core$reduce.invokeStatic (core.clj:6886)\n clojure.core$mapv.invokeStatic (core.clj:6970)\n clojure.core$mapv.invoke (core.clj:6970)\n fhir.conv3$export_extension.invokeStatic (conv3.clj:236)\n fhir.conv3$export_extension.invoke (conv3.clj:209)\n fhir.conv3$_STAR_export.invokeStatic (conv3.clj:509)\n fhir.conv3$_STAR_export.invoke (conv3.clj:462)\n fhir.conv3$export.invokeStatic (conv3.clj:586)\n fhir.conv3$export.doInvoke (conv3.clj:582)\n clojure.lang.RestFn.invoke (RestFn.java:442)\n fhir.conv3$export_BANG_.invokeStatic (conv3.clj:832)\n fhir.conv3$export_BANG_.invoke (conv3.clj:828)\n fhir.core$fn__38040.invokeStatic (core.clj:224)\n fhir.core/fn (core.clj:215)\n clojure.lang.MultiFn.invoke (MultiFn.java:229)\n unifn.core$_STAR_apply_impl$fn__9888.invoke (core.clj:44)\n unifn.core$_STAR_apply_impl.invokeStatic (core.clj:44)\n unifn.core$_STAR_apply_impl.invoke (core.clj:37)\n unifn.core$_STAR_apply.invokeStatic (core.clj:71)\n unifn.core$_STAR_apply.invoke (core.clj:68)\n unifn.core$_STAR_apply.invokeStatic (core.clj:77)\n unifn.core$_STAR_apply.invoke (core.clj:68)\n fhir.core$transformator.invokeStatic (core.clj:239)\n fhir.core$transformator.invoke (core.clj:239)\n fhir.core$fn__38059.invokeStatic (core.clj:253)\n fhir.core/fn (core.clj:253)\n clojure.lang.MultiFn.invoke (MultiFn.java:229)\n unifn.core$_STAR_apply_impl$fn__9888.invoke (core.clj:44)\n unifn.core$_STAR_apply_impl.invokeStatic (core.clj:44)\n unifn.core$_STAR_apply_impl.invoke (core.clj:37)\n unifn.core$_STAR_apply.invokeStatic (core.clj:71)\n unifn.core$_STAR_apply.invoke (core.clj:68)\n proto.box$fn__46286.invokeStatic (box.clj:187)\n proto.box/fn (box.clj:174)\n clojure.lang.MultiFn.invoke (MultiFn.java:229)\n unifn.core$_STAR_apply_impl$fn__9888.invoke (core.clj:44)\n unifn.core$_STAR_apply_impl.invokeStatic (core.clj:44)\n unifn.core$_STAR_apply_impl.invoke (core.clj:37)\n unifn.core$_STAR_apply.invokeStatic (core.clj:71)\n unifn.core$_STAR_apply.invoke (core.clj:68)\n unifn.core$_STAR_apply.invokeStatic (core.clj:77)\n unifn.core$_STAR_apply.invoke (core.clj:68)\n proto.box$handle_to_ctx.invokeStatic (box.clj:331)\n proto.box$handle_to_ctx.invoke (box.clj:271)\n proto.box$start$fn__46501.doInvoke (box.clj:695)\n clojure.lang.RestFn.invoke (RestFn.java:410)\n web.core$mk_handler$fn__44448.invoke (core.clj:116)\n web.core$healthcheck$fn__44436.invoke (core.clj:96)\n ring.middleware.cookies$wrap_cookies$fn__44333.invoke (cookies.clj:214)\n ring.middleware.content_type$wrap_content_type$fn__44163.invoke (content_type.clj:34)\n ring.middleware.not_modified$wrap_not_modified$fn__44387.invoke (not_modified.clj:61)\n org.httpkit.server.HttpHandler.run (RingHandler.java:123)\n java.util.concurrent.Executors$RunnableAdapter.call (:-1)\n java.util.concurrent.FutureTask.run (:-1)\n java.util.concurrent.ThreadPoolExecutor.runWorker (:-1)\n java.util.concurrent.ThreadPoolExecutor$Worker.run (:-1)\n java.lang.Thread.run (:-1)\n" } ] }
Stacktrace:
devbox 07:33:28 w2 GET /fhir/Questionnaire/new-appointment devbox 07:33:28 w2 policy devbox-policy devbox 07:33:28 w1 POST /rpc?_format=transit&_m=aidbox.product/mixpanel-track-event devbox 07:33:28 w7 POST /rpc?_format=transit&_m=aidbox.product/mixpanel-track-event devbox 07:33:28 w7 policy devbox-policy devbox 07:33:28 w1 policy devbox-policy devbox 07:33:28 :info w1 [0ms] :rpc/call {:rpc_p {:type "Questionnaire.new"}, :rpc_m aidbox.product/mixpanel-track-event, :rpc_u {:email nil}, :op "rpc:mixpanel-track-event", :d 0, :ctx "23a328c0-fb31-4bb7-bcb9-4aa28f8fc8cf"} devbox 07:33:28 :info w7 [0ms] :rpc/call {:rpc_p {:type "Questionnaire.view"}, :rpc_m aidbox.product/mixpanel-track-event, :rpc_u {:email nil}, :op "rpc:mixpanel-track-event", :d 0, :ctx "ed887984-d486-4b20-aa92-21916d3202ad"} devbox 07:33:28 w1 [2ms] 200 devbox 07:33:28 w7 [2ms] 200 devbox 07:33:28 w2 [2ms] SELECT * FROM ((SELECT id, txid, ts, resource_type, status::text AS status, resource, cts FROM "questionnaire" as t WHERE (t.id = ?)) UNION (SELECT id, txid, ts, resource_type, status::text AS status, resource, cts FROM "questionnaire_history" as t WHERE (t.id = ? AND t.status = ?))) _ ORDER BY ts DESC LIMIT ? ["new-appointment" "new-appointment" "deleted" "1"] devbox 07:33:28 :error w2 java.lang.ClassCastException: class clojure.lang.MapEntry cannot be cast to class clojure.lang.IPersistentMap (clojure.lang.MapEntry and clojure.lang.IPersistentMap are in unnamed module of loader 'app') at clojure.lang.RT.dissoc (RT.java:891) clojure.core$dissoc.invokeStatic (core.clj:1526) clojure.core$dissoc.invoke (core.clj:1519) fhir.conv3$export_reference_value.invokeStatic (conv3.clj:88) fhir.conv3$export_reference_value.invoke (conv3.clj:85) fhir.conv3$export_extension$mk_ext__19523.invoke (conv3.clj:229) clojure.core$mapv$fn__8535.invoke (core.clj:6979) clojure.core.protocols$iter_reduce.invokeStatic (protocols.clj:49) clojure.core.protocols$fn__8230.invokeStatic (protocols.clj:75) clojure.core.protocols/fn (protocols.clj:75) clojure.core.protocols$fn__8178$G__8173__8191.invoke (protocols.clj:13) clojure.core$reduce.invokeStatic (core.clj:6886) clojure.core$mapv.invokeStatic (core.clj:6970) clojure.core$mapv.invoke (core.clj:6970) fhir.conv3$export_extension.invokeStatic (conv3.clj:236) fhir.conv3$export_extension.invoke (conv3.clj:209) fhir.conv3$_STAR_export.invokeStatic (conv3.clj:509) fhir.conv3$_STAR_export.invoke (conv3.clj:462) fhir.conv3$export.invokeStatic (conv3.clj:586) fhir.conv3$export.doInvoke (conv3.clj:582) clojure.lang.RestFn.invoke (RestFn.java:442) fhir.conv3$export_BANG_.invokeStatic (conv3.clj:832) fhir.conv3$export_BANG_.invoke (conv3.clj:828) fhir.core$fn__38040.invokeStatic (core.clj:224) fhir.core/fn (core.clj:215) clojure.lang.MultiFn.invoke (MultiFn.java:229) unifn.core$_STAR_apply_impl$fn__9888.invoke (core.clj:44) unifn.core$_STAR_apply_impl.invokeStatic (core.clj:44) unifn.core$_STAR_apply_impl.invoke (core.clj:37) unifn.core$_STAR_apply.invokeStatic (core.clj:71) unifn.core$_STAR_apply.invoke (core.clj:68) unifn.core$_STAR_apply.invokeStatic (core.clj:77) unifn.core$_STAR_apply.invoke (core.clj:68) fhir.core$transformator.invokeStatic (core.clj:239) fhir.core$transformator.invoke (core.clj:239) fhir.core$fn__38059.invokeStatic (core.clj:253) fhir.core/fn (core.clj:253) clojure.lang.MultiFn.invoke (MultiFn.java:229) unifn.core$_STAR_apply_impl$fn__9888.invoke (core.clj:44) unifn.core$_STAR_apply_impl.invokeStatic (core.clj:44) unifn.core$_STAR_apply_impl.invoke (core.clj:37) unifn.core$_STAR_apply.invokeStatic (core.clj:71) unifn.core$_STAR_apply.invoke (core.clj:68) proto.box$fn__46286.invokeStatic (box.clj:187) proto.box/fn (box.clj:174) clojure.lang.MultiFn.invoke (MultiFn.java:229) unifn.core$_STAR_apply_impl$fn__9888.invoke (core.clj:44) unifn.core$_STAR_apply_impl.invokeStatic (core.clj:44) unifn.core$_STAR_apply_impl.invoke (core.clj:37) unifn.core$_STAR_apply.invokeStatic (core.clj:71) unifn.core$_STAR_apply.invoke (core.clj:68) unifn.core$_STAR_apply.invokeStatic (core.clj:77) unifn.core$_STAR_apply.invoke (core.clj:68) proto.box$handle_to_ctx.invokeStatic (box.clj:331) proto.box$handle_to_ctx.invoke (box.clj:271) proto.box$start$fn__46501.doInvoke (box.clj:695) clojure.lang.RestFn.invoke (RestFn.java:410) web.core$mk_handler$fn__44448.invoke (core.clj:116) web.core$healthcheck$fn__44436.invoke (core.clj:96) ring.middleware.cookies$wrap_cookies$fn__44333.invoke (cookies.clj:214) ring.middleware.content_type$wrap_content_type$fn__44163.invoke (content_type.clj:34) ring.middleware.not_modified$wrap_not_modified$fn__44387.invoke (not_modified.clj:61) org.httpkit.server.HttpHandler.run (RingHandler.java:123) java.util.concurrent.Executors$RunnableAdapter.call (:-1) java.util.concurrent.FutureTask.run (:-1) java.util.concurrent.ThreadPoolExecutor.runWorker (:-1) java.util.concurrent.ThreadPoolExecutor$Worker.run (:-1) java.lang.Thread.run (:-1) java.lang.ClassCastException: class clojure.lang.MapEntry cannot be cast to class clojure.lang.IPersistentMap (clojure.lang.MapEntry and clojure.lang.IPersistentMap are in unnamed module of loader 'app') at clojure.lang.RT.dissoc (RT.java:891) clojure.core$dissoc.invokeStatic (core.clj:1526) clojure.core$dissoc.invoke (core.clj:1519) fhir.conv3$export_reference_value.invokeStatic (conv3.clj:88) fhir.conv3$export_reference_value.invoke (conv3.clj:85) fhir.conv3$export_extension$mk_ext__19523.invoke (conv3.clj:229) clojure.core$mapv$fn__8535.invoke (core.clj:6979) clojure.core.protocols$iter_reduce.invokeStatic (protocols.clj:49) clojure.core.protocols$fn__8230.invokeStatic (protocols.clj:75) clojure.core.protocols/fn (protocols.clj:75) clojure.core.protocols$fn__8178$G__8173__8191.invoke (protocols.clj:13) clojure.core$reduce.invokeStatic (core.clj:6886) clojure.core$mapv.invokeStatic (core.clj:6970) clojure.core$mapv.invoke (core.clj:6970) fhir.conv3$export_extension.invokeStatic (conv3.clj:236) fhir.conv3$export_extension.invoke (conv3.clj:209) fhir.conv3$_STAR_export.invokeStatic (conv3.clj:509) fhir.conv3$_STAR_export.invoke (conv3.clj:462) fhir.conv3$export.invokeStatic (conv3.clj:586) fhir.conv3$export.doInvoke (conv3.clj:582) clojure.lang.RestFn.invoke (RestFn.java:442) fhir.conv3$export_BANG_.invokeStatic (conv3.clj:832) fhir.conv3$export_BANG_.invoke (conv3.clj:828) fhir.core$fn__38040.invokeStatic (core.clj:224) fhir.core/fn (core.clj:215) clojure.lang.MultiFn.invoke (MultiFn.java:229) unifn.core$_STAR_apply_impl$fn__9888.invoke (core.clj:44) unifn.core$_STAR_apply_impl.invokeStatic (core.clj:44) unifn.core$_STAR_apply_impl.invoke (core.clj:37) unifn.core$_STAR_apply.invokeStatic (core.clj:71) unifn.core$_STAR_apply.invoke (core.clj:68) unifn.core$_STAR_apply.invokeStatic (core.clj:77) unifn.core$_STAR_apply.invoke (core.clj:68) fhir.core$transformator.invokeStatic (core.clj:239) fhir.core$transformator.invoke (core.clj:239) fhir.core$fn__38059.invokeStatic (core.clj:253) fhir.core/fn (core.clj:253) clojure.lang.MultiFn.invoke (MultiFn.java:229) unifn.core$_STAR_apply_impl$fn__9888.invoke (core.clj:44) unifn.core$_STAR_apply_impl.invokeStatic (core.clj:44) unifn.core$_STAR_apply_impl.invoke (core.clj:37) unifn.core$_STAR_apply.invokeStatic (core.clj:71) unifn.core$_STAR_apply.invoke (core.clj:68) proto.box$fn__46286.invokeStatic (box.clj:187) proto.box/fn (box.clj:174) clojure.lang.MultiFn.invoke (MultiFn.java:229) unifn.core$_STAR_apply_impl$fn__9888.invoke (core.clj:44) unifn.core$_STAR_apply_impl.invokeStatic (core.clj:44) unifn.core$_STAR_apply_impl.invoke (core.clj:37) unifn.core$_STAR_apply.invokeStatic (core.clj:71) unifn.core$_STAR_apply.invoke (core.clj:68) unifn.core$_STAR_apply.invokeStatic (core.clj:77) unifn.core$_STAR_apply.invoke (core.clj:68) proto.box$handle_to_ctx.invokeStatic (box.clj:331) proto.box$handle_to_ctx.invoke (box.clj:271) proto.box$start$fn__46501.doInvoke (box.clj:695) clojure.lang.RestFn.invoke (RestFn.java:410) web.core$mk_handler$fn__44448.invoke (core.clj:116) web.core$healthcheck$fn__44436.invoke (core.clj:96) ring.middleware.cookies$wrap_cookies$fn__44333.invoke (cookies.clj:214) ring.middleware.content_type$wrap_content_type$fn__44163.invoke (content_type.clj:34) ring.middleware.not_modified$wrap_not_modified$fn__44387.invoke (not_modified.clj:61) org.httpkit.server.HttpHandler.run (RingHandler.java:123) java.util.concurrent.Executors$RunnableAdapter.call (:-1) java.util.concurrent.FutureTask.run (:-1) java.util.concurrent.ThreadPoolExecutor.runWorker (:-1) java.util.concurrent.ThreadPoolExecutor$Worker.run (:-1) java.lang.Thread.run (:-1) devbox 07:33:28 w2 [6ms] 500 devbox 07:33:28 w3 POST /rpc?_format=transit&_m=aidbox.product/mixpanel-track-event devbox 07:33:28 w3 policy devbox-policy devbox 07:33:28 :info w3 [0ms] :rpc/call {:rpc_p {:type "Questionnaire.new"}, :rpc_m aidbox.product/mixpanel-track-event, :rpc_u {:email nil}, :op "rpc:mixpanel-track-event", :d 0, :ctx "a74e3f2f-4ff5-45bd-8a79-2f017d0a58b1"} devbox 07:33:28 w3 [1ms] 200
Expected behavior
Get the questionnaire in FHIR format
Versions
Aidbox image:
All questionnaires that do not transform to FHIR format have a property that other questionnaires do not have - sourceQueries. If remove sourceQueries, converting to FHIR format works.
Describe the bug
When we try to get a questionnaire in FHIR format, an error occurs and the questionnaire remains in Aidbox format.
Severity
Critical.
Steps to reproduce the behavior:
Prepare the following test data
Make an API call http://localhost:8080/fhir/Questionnaire/new-appointment
Receive the following errored response
Stacktrace:
Expected behavior
Get the questionnaire in FHIR format
Versions
Aidbox image: