-
Notifications
You must be signed in to change notification settings - Fork 3
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
Hiv cs tx continuity #451
base: dev
Are you sure you want to change the base?
Hiv cs tx continuity #451
Changes from 6 commits
f9e7f2e
fc70681
ff60925
4b0ca17
5c83242
161f9dc
f573f93
19db9ac
5c683b2
a6469dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,19 +8,20 @@ BEGIN | |
,Facility.County | ||
,Facility.SubCounty | ||
,Patient.PatientPKHash | ||
,Patient.PatientKey | ||
,Patient.Gender | ||
,Patient.DOB | ||
,[AgeGroup].DATIMAgeGroup | ||
,FactARTHistory.AgeGroup | ||
,[Partner].PartnerName | ||
,case | ||
when ARTOutcome.ARTOutcomeDescription in ('LOSS TO FOLLOW UP','UNDOCUMENTED LOSS') Then 'IIT' | ||
when ARTOutcome.ARTOutcomeDescription in ('DEAD') Then 'MORTALITY' | ||
else ARTOutcome.ARTOutcomeDescription | ||
end ARTOutcome | ||
,asofdatekey | ||
|
||
,[Date].[Date] As asofdate | ||
,YEAR(TRY_CAST(DateConfirmedHIVPositiveKey AS DATETIME2)) As CohortYear | ||
,TRY_CAST(DateConfirmedHIVPositiveKey AS DATETIME2) As CohortYearMonth | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure the CohortYearMonth is set to EndofMonth for ease of filtering There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Marymary-dev this has since been addressed. |
||
,cast(asofdatekey as datetime2) As OutcomeYearMonth | ||
,COUNT(1) AS NoOfClients | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @DennisGibz, do we need this column here since this is a patient level dataset ? |
||
INTO [HIVCaseSurveillance].[dbo].[CsTxContinuity] | ||
FROM [NDWH].[dbo].[FactARTHistory] FactARTHistory | ||
|
@@ -36,10 +37,8 @@ BEGIN | |
on FactARTHistory.ARTOutcomeKey = ARTOutcome.ARTOutcomeKey | ||
LEFT OUTER JOIN [NDWH].[dbo].[DimDate] [Date] | ||
ON FactARTHistory.AsOfDateKey = [Date].[Date] | ||
LEFT OUTER JOIN [NDWH].[dbo].[DimAgeGroup] [AgeGroup] | ||
ON FactARTHistory.AgeGroup = [AgeGroup].DATIMAgeGroup | ||
WHERE Facility.MFLCode IS NOT NULL AND FactARTHistory.ARTOutcomeKey in (2,3,6,8) -- MORTALITY{2="DEAD"},Txcurr{6="ACTIVE},IIT{8=UNDOCUMENTED LOSS" 3="LOSS TO FOLLOW UP"} | ||
AND YEAR(AsOfDateKey) <= YEAR(GETDATE()) | ||
AND YEAR(AsOfDateKey) <= YEAR(GETDATE()) | ||
GROUP BY Facility.FacilityName | ||
,Facility.MFLCode | ||
,Facility.County | ||
|
@@ -49,9 +48,11 @@ BEGIN | |
,Patient.DOB | ||
,[Partner].PartnerName | ||
,ARTOutcome.ARTOutcomeDescription | ||
,asofdatekey | ||
,[Date].[Date] | ||
,Patient.PatientKey | ||
,DateConfirmedHIVPositiveKey | ||
,[AgeGroup].DATIMAgeGroup | ||
,FactARTHistory.AgeGroup | ||
ORDER BY DateConfirmedHIVPositiveKey DESC; | ||
END | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DennisGibz not sure, I thought since this is a Fact we should be using an AgeGroupKey?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DennisGibz please recheck on this.