Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New check request: overlapping observation periods #510

Open
MaximMoinat opened this issue Nov 24, 2023 · 1 comment
Open

New check request: overlapping observation periods #510

MaximMoinat opened this issue Nov 24, 2023 · 1 comment
Labels
new check New DQ check to be added

Comments

@MaximMoinat
Copy link
Collaborator

From the OMOP Observation Period conventions:

For each Person, one or more OBSERVATION_PERIOD records may be present, but they will not overlap or be back to back to each other.

The former is checked, the latter two conditions are not. Below query would give you the violating records for overlapping observation periods. By adding one day to the end dates, this also captures observation periods ending and starting within a day (i.e. back to back, without a gap).

SELECT *
FROM observation_period AS a
JOIN observation_period AS b ON
      a.person_id = b.person_id 
  AND a.observation_period_start_date <= DATEADD(d, 1, b.observation_period_end_date)
  AND DATEADD(d, 1, a.observation_period_end_date) >= b.observation_period_start_date
  AND a.observation_period_id <> b.observation_period_id
;
@MaximMoinat MaximMoinat added the new check New DQ check to be added label Nov 24, 2023
@katy-sadowski
Copy link
Collaborator

Love this idea, this is a very important one to check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new check New DQ check to be added
Projects
None yet
Development

No branches or pull requests

2 participants