omoponfhir / omoponfhir-omopv5-sql

OMOPonFHIR Database SQLRender Implementation
Apache License 2.0
4 stars 3 forks source link

ERROR: syntax error at or near ".." #21

Open emffls opened 3 months ago

emffls commented 3 months ago

An error occurs when searching by patientid in Observation

2024-08-20 03:57:10.429 [http-nio-8080-exec-2] WARN  e.g.chai.omopv5.dba.util.SqlUtil [SqlUtil.java:120] Annotation for Table class: java.lang.Object is null
org.postgresql.util.PSQLException: ERROR: syntax error at or near ".."
  Position: 394
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2712)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2400)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:367)
        at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:498)
        at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:415)
        at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:335)
        at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:321)
        at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:297)
        at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:246)
        at com.zaxxer.hikari.pool.ProxyStatement.executeQuery(ProxyStatement.java:110)
        at com.zaxxer.hikari.pool.HikariProxyStatement.executeQuery(HikariProxyStatement.java)
        at edu.gatech.chai.omopv5.dba.service.FactRelationshipServiceImp.searchMeasurementUsingMethod(FactRelationshipServiceImp.java:107)
        at edu.gatech.chai.omoponfhir.omopv5.r4.mapping.OmopObservation.constructFHIR(OmopObservation.java:421)
        at edu.gatech.chai.omoponfhir.omopv5.r4.mapping.OmopObservation.constructFHIR(OmopObservation.java:80)
        at edu.gatech.chai.omoponfhir.omopv5.r4.mapping.BaseOmopResource.constructResource(BaseOmopResource.java:139)
        at edu.gatech.chai.omoponfhir.omopv5.r4.mapping.OmopObservation.searchWithParams(OmopObservation.java:1937)
        at edu.gatech.chai.omoponfhir.r4.provider.ObservationResourceProvider$MyBundleProvider.getResources(ObservationResourceProvider.java:372)
        at ca.uhn.fhir.rest.api.server.IBundleProvider.getResources(IBundleProvider.java:163)
        at ca.uhn.fhir.rest.server.method.ResponseBundleBuilder.pagingBuildResourceList(ResponseBundleBuilder.java:163)
        at ca.uhn.fhir.rest.server.method.ResponseBundleBuilder.buildResponsePage(ResponseBundleBuilder.java:115)
        at ca.uhn.fhir.rest.server.method.ResponseBundleBuilder.buildResponseBundle(ResponseBundleBuilder.java:57)
        at ca.uhn.fhir.rest.server.method.BaseResourceReturningMethodBinding.doInvokeServer(BaseResourceReturningMethodBinding.java:201)
        at ca.uhn.fhir.rest.server.method.BaseResourceReturningMethodBinding.invokeServer(BaseResourceReturningMethodBinding.java:275)
        at ca.uhn.fhir.rest.server.RestfulServer.handleRequest(RestfulServer.java:1198)
        at ca.uhn.fhir.rest.server.RestfulServer.doGet(RestfulServer.java:424)
        at ca.uhn.fhir.rest.server.RestfulServer.service(RestfulServer.java:1931)
        at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:195)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:483)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
        at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:663)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:384)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:904)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1741)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
        at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1190)
        at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63)
        at java.base/java.lang.Thread.run(Unknown Source)

https://github.com/omoponfhir/omoponfhir-omopv5-sql/blob/c1766d4de4a737653ad7baa781dbf4f4fefb886a/src/main/java/edu/gatech/chai/omopv5/dba/service/FactRelationshipServiceImp.java schema = schema + "."; It seems to be running multiple times.

error in postgresql

SELECT fact_relationship.domain_concept_id_1 as fact_relationship_domain_concept_id_1, fact_relationship.fact_id_1 as fact_relationship_fact_id_1, fact_relationship.domain_concept_id_2 as fact_relationship_domain_concept_id_2, fact_relationship.fact_id_2 as fact_reationship_fact_id_2, fact_relationship.relationship_concept_id as fact_relationship_relationship_concept_id FROM schema........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................fact_relationship fact_relationship WHERE fact_relationship.domain_concept_id_1 = 21 AND fact_relationship.fact_id_1 = 10041740 AND fact_relationship.domain_concept_id_2 = 26 AND fact_relationship.relationship_concept_id = 44818721
myungchoi commented 3 months ago

ah... I should've not done a = a + "." when a is the annotated variable from properties. I will fix this and make a new release. It's simple fix but, I have some deadline. I will make the update in couple days. Sorry and thank you for the findings.

myungchoi commented 3 months ago

Fix is applied to the FactRelationshipServiceImp.java and other places that have same use of the annotated variable. Thank you for posting the issue. Please try again and let us know if you still have this issue.