Skip to content

Commit

Permalink
Adding IPT variables into linelist FactART
Browse files Browse the repository at this point in the history
  • Loading branch information
Marymary-dev committed May 3, 2024
1 parent 421c5b2 commit 592a62a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Scripts/NDWH/C&T FACT TABLES/load_FactLatestObs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ select
Pregnant,
breastfeeding,
TBScreening,
OnIPT,
StartIPT,
EverOnIPT,
cast(getdate() as date) as LoadDate
into NDWH.dbo.FactLatestObs
from ODS.dbo.intermediate_LatestObs obs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ UPDATE [ODS].[DBO].[CT_Ipt]
WHEN IndicationForIPT = '1' THEN 'Screened'
WHEN IndicationForIPT IN ('TB Screening not done', '0') THEN 'Not Screened'
END
WHERE TBScreening IN ('1', 'Screening not done', '0')
WHERE TBScreening IN ('1','TB Screening not done','0')

GO

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,20 @@ latest_Who as (
visits.TBScreening,
visits.SiteCode,
visits.VisitDate,
visits.VisitID
visits.VisitID,
visits.OnIPT,
visits.StartIPT,
visits.EverOnIPT
from ODS.dbo.CT_IPT as visits
WHERE VISITS.VOIDED=0
),
latest_TBScreening as (
select
distinct Screening.PatientPK,
Screening.TBScreening,
Screening.OnIPT,
Screening.StartIPT,
Screening.EverOnIPT,
Screening.SiteCode
from last_TBScreening as Screening
inner join ODS.dbo.Intermediate_LastVisitDate as last_visit on Screening.SiteCode = last_visit.SiteCode
Expand All @@ -173,6 +179,9 @@ latest_Who as (
latest_breastfeeding.GestationAge,
latest_Who.WhoStage,
latest_TBScreening.TBScreening,
latest_TBScreening.OnIPT,
latest_TBScreening.StartIPT,
latest_TBScreening.EverOnIPT,
cast(getdate() as date) as LoadDate
into ODS.dbo.intermediate_LatestObs
from ODS.dbo.CT_Patient as patient
Expand Down
3 changes: 3 additions & 0 deletions Scripts/REPORTING/1_load_Linelist-FACTART.sql
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ Select distinct
art.Pregnant,
art.Breastfeeding,
art.IsRTTLast12MonthsAfter3monthsIIT,
obs.OnIPT,
obs.StartIPT,
obs.EverOnIPT,
cast (AsOfDateKey as date) as EndofMonthDate,
cast(getdate() as date) as LoadDate
INTO [REPORTING].[dbo].[Linelist_FACTART]
Expand Down

0 comments on commit 592a62a

Please sign in to comment.