Skip to content

Commit bf9bf7e

Browse files
committed
Visit Occurrence RTDS Fix
1 parent 66f2a94 commit bf9bf7e

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

OmopTransformer/RTDS/VisitOccurrence/RtdsVisitOccurrence.xml

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
<Query>
22
<Sql>
3-
4-
with results as (
5-
select
6-
distinct
7-
(select top 1 PatientId from omop_staging.rtds_1_demographics b where b.PatientSer = a.PatientSer) as PatientId,
8-
a.start_date as event_start_date,
9-
a.end_date as event_end_date
10-
from omop_staging.rtds_2b_plan a
11-
)
12-
select
13-
PatientId,
14-
event_start_date,
15-
event_end_date
16-
from results
17-
where
18-
PatientId is not null
19-
and regexp_matches(PatientId, '\d{10}');
20-
3+
with results as (
4+
select
5+
distinct
6+
(select PatientId from omop_staging.rtds_1_demographics d where d.PatientSer = a.PatientSer limit 1) as NhsNumber,
7+
a.start_date as event_start_date,
8+
a.end_date as event_end_date
9+
from omop_staging.rtds_2b_plan a
10+
)
11+
select
12+
NhsNumber,
13+
event_start_date,
14+
event_end_date
15+
from results
16+
where
17+
NhsNumber is not null
18+
and regexp_matches(NhsNumber, '\d{10}');
2119
</Sql>
2220
<Explanations>
2321
<Explanation columnName="PatientId">

0 commit comments

Comments
 (0)