Patient Profile fails when CDM and Vocabulary are configured in separate schemas (WebAPI 2.15.1)

Aperta
#2,596 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
java, postgresql
Ambito
backend, databases

Direzione di ricerca

Read src/main/resources/resources/person/sql/personInfo.sql and compare its vocabulary table qualifier with the master version linked in the issue. Then inspect the other Patient Profile SQL templates for the same schema assumption and check the related tests. Done means profile queries use the configured Vocabulary schema consistently; the issue does not identify specific tests.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description

We encountered an issue in OHDSI ATLAS when attempting to view patient profiles, either directly through the Profiles section or through the Samples tab of a generated cohort.

Although the patients exist in the CDM and cohort generation and sampling work correctly, ATLAS displays the following error:

Can't find [patientID]

Environment

  • WebAPI version: 2.15.1
  • Build: 2.15.1-SNAPSHOT
  • Commit: ba50f13a
  • Database: PostgreSQL 16.4
  • Deployment: Docker

Data source configuration

Our CDM and Vocabulary are configured in separate schemas using webapi.source_daimon:

Daimon type Schema
CDM (0) clinical_cdm
Vocabulary (1) shared_vocabulary
Results (2) clinical_cdm_results

The vocabulary schema is shared across multiple CDM data sources.

Steps to reproduce

  1. Configure a data source with separate CDM and Vocabulary schemas.
  2. Ensure that the person table exists in the CDM schema and the concept table exists only in the Vocabulary schema.
  3. Open the Profiles section in ATLAS.
  4. Select the configured data source.
  5. Search for a valid person ID.

Actual behavior

WebAPI returns HTTP 500, and ATLAS displays Can't find [patientID].

The WebAPI logs show:

org.springframework.jdbc.BadSqlGrammarException

ERROR: relation "clinical_cdm.concept" does not exist

at org.ohdsi.webapi.service.PersonService.getPersonProfile(PersonService.java:81)

The executed SQL is:

SELECT gender_concept_id,
       year_of_birth,
       concept_name AS gender
FROM clinical_cdm.person p
JOIN clinical_cdm.concept c
    ON p.gender_concept_id = c.concept_id
WHERE person_id = ?;

Root cause

The SQL template personInfo.sql uses the same @tableQualifier parameter for both the person and concept tables, ignoring the separately configured Vocabulary schema.

Affected source file:

https://github.com/OHDSI/WebAPI/blob/ba50f13a/src/main/resources/resources/person/sql/personInfo.sql

Expected behavior

Patient Profile queries should use the CDM schema for clinical tables and the configured Vocabulary schema for vocabulary tables.

The expected SQL template would be:

SELECT gender_concept_id,
       year_of_birth,
       concept_name AS gender
FROM @tableQualifier.person p
JOIN @vocabularyTableQualifier.concept c
    ON p.gender_concept_id = c.concept_id
WHERE person_id = @personId;

Confirmed workaround

We created a PostgreSQL view in the CDM schema pointing to the shared vocabulary table:

CREATE VIEW clinical_cdm.concept AS
SELECT *
FROM shared_vocabulary.concept;

After creating this view, patient profiles were successfully displayed in ATLAS.

Additional observations

The same SQL template in the v2.15.2 tag still references the CDM schema for the concept table:

https://github.com/OHDSI/WebAPI/blob/v2.15.2/src/main/resources/resources/person/sql/personInfo.sql

However, the current master branch appears to contain a correction using @vocabularyTableQualifier:

https://github.com/OHDSI/WebAPI/blob/master/src/main/resources/resources/person/sql/personInfo.sql

Could you please confirm whether this issue has already been addressed and whether the fix is planned to be included in a stable release of the 2.15.x series?

It would also be helpful to verify that all other Patient Profile queries consistently respect the configured Vocabulary schema.

Thank you for maintaining WebAPI and ATLAS.

Lingua principale
Java
Stelle
154
Fork
185
Merge medio
3g 57m
PR unite (30g)
14

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OHDSI/WebAPI

Tutte le issue di OHDSI/WebAPI

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.