Patient profile returns a server error for a person with observation periods but no clinical records

未关闭 适合新手
#2,592 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@DG47 已经在做这个了。

开始于 2026年11月11日。

  • #2593 来自 @DG47 —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
75/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
java, postgresql, spring-boot
领域
api, backend

调研方向

从 PersonService.java:156 的 PersonService.getPersonProfile 开始,这里会选择索引日期并用它计算观察期偏移量。使用一个有观察期但没有事件记录的人来重现此问题,分别测试不指定 cohort,以及指定一个该人不属于的 cohort。完成标准是两种请求都返回包含空记录列表和有效偏移量的个人资料,而不是 HTTP 500。

由索引模型根据 Issue 内容生成。

描述

Expected behavior

GET /{sourceKey}/person/{personId} returns the profile (demographics and observation periods, with an empty record list) for any person in the CDM. Its documentation says day offsets are relative to the cohort start date or the initial date of observation.

Actual behavior

When the person has at least one observation_period row but no rows in any of the record tables the profile reads (drug_exposure, drug_era, condition_occurrence, condition_era, observation, visit_occurrence, death, measurement, device_exposure, procedure_occurrence, specimen), the request fails with:

java.lang.NullPointerException: Cannot invoke "java.time.temporal.Temporal.until(java.time.temporal.Temporal, java.time.temporal.TemporalUnit)" because "temporal1Inclusive" is null
    at org.ohdsi.webapi.person.PersonService.getPersonProfile(PersonService.java:156)

getPersonProfile takes the index date from the requested cohort's start, or else from the earliest record. With no records and no matching cohort entry, the index date stays null, and ChronoUnit.DAYS.between(null, ...) for the observation period offsets throws. This happens:

  • with /{sourceKey}/person/{personId} (no cohort parameter), for example an enrollee with coverage but no claims, which is common in claims-based CDMs;
  • with ?cohort={id} when the person is not in that cohort.

People in the requested cohort are not affected, because the cohort start date is used.

Steps to reproduce

On a Postgres CDM:

insert into cdm.person (person_id, gender_concept_id, year_of_birth, ...) values (1, 8532, 1970, ...);
insert into cdm.observation_period (observation_period_id, person_id, observation_period_start_date,
  observation_period_end_date, period_type_concept_id) values (10, 1, '2019-01-01', '2019-12-31', 32813);
-- no rows for person 1 in the event tables

then GET /WebAPI/{sourceKey}/person/1, or open #/profiles/{sourceKey}/1 in ATLAS. Result: HTTP 500 with the NullPointerException above.

Versions

WebAPI master (89de588d, JDK 21 / Spring Boot 3), Postgres CDM. The index date code is unchanged from 2.x, so earlier releases behave the same.

主要语言
Java
星标
153
派生
186
平均合并
2 天 19 小时
30 天内合并 PR
19

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

OHDSI/WebAPI 的其他 Issue

查看 OHDSI/WebAPI 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。