-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #434 from NewtonMutugi/dev
Added ODS DQC scripts
- Loading branch information
Showing
31 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_ARTPatients] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
5 changes: 5 additions & 0 deletions
5
Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_AdverseEvents.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT SiteCode,Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_AdverseEvents] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [voided] =0 | ||
GROUP BY SiteCode | ||
HAVING Count(1) > 1 |
5 changes: 5 additions & 0 deletions
5
Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_AllergiesChronicIllness.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_AllergiesChronicIllness] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_ArtFastTrack] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
5 changes: 5 additions & 0 deletions
5
Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_CancerScreening.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [Sitecode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_CancerScreening] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [Voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
5 changes: 5 additions & 0 deletions
5
Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_CervicalCancerScreening.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_CervicalCancerScreening] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [Voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
5 changes: 5 additions & 0 deletions
5
Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_ContactListing.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_ContactListing] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_Covid] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
5 changes: 5 additions & 0 deletions
5
Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_DefaulterTracing.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_DefaulterTracing] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
5 changes: 5 additions & 0 deletions
5
Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_DepressionScreening.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_DepressionScreening] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
5 changes: 5 additions & 0 deletions
5
Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_DrugAlcoholScreening.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_DrugAlcoholScreening] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
5 changes: 5 additions & 0 deletions
5
Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_EnhancedAdherenceCounselling.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_EnhancedAdherenceCounselling] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
5 changes: 5 additions & 0 deletions
5
Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_FacilityManifest.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_FacilityManifest] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [Voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_GbvScreening] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
5 changes: 5 additions & 0 deletions
5
Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_IITRiskScores.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_IITRiskScores] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [Voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_Ipt] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_Otz] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_Ovc] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_Patient] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
5 changes: 5 additions & 0 deletions
5
Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_PatientBaselines.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_PatientBaselines] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_PatientLabs] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
5 changes: 5 additions & 0 deletions
5
Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_PatientPharmacy.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_PatientPharmacy] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
5 changes: 5 additions & 0 deletions
5
Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_PatientStatus.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_PatientStatus] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
5 changes: 5 additions & 0 deletions
5
Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_PatientVisits.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_PatientVisits] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
5 changes: 5 additions & 0 deletions
5
Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_PatientVisits_Opt.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_PatientVisits_Opt] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
5 changes: 5 additions & 0 deletions
5
Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_Relationships.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT [SiteCode],Count(1)NullPatientPK_IDHash | ||
FROM [ODS].[dbo].[CT_Relationships] | ||
WHERE PatientPKHash IS NULL OR PatientIDHash IS NULL AND [Voided] = 0 | ||
GROUP BY [SiteCode] | ||
HAVING Count(1) > 1 |
7 changes: 7 additions & 0 deletions
7
Scripts/ODS/DQC/Update_Voided_Null_Patients/CT_ARTPatients.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
UPDATE ap | ||
SET ap.voided = 1 | ||
FROM [ODS].[dbo].[CT_ARTPatients] ap | ||
LEFT JOIN [ODS].[dbo].[CT_Patient] p | ||
ON ap.PatientIDHash = p.PatientIDHash AND ap.PatientPKHash = p.PatientPKHash | ||
WHERE (ap.PatientIDHash IS NULL OR ap.PatientPKHash IS NULL) | ||
AND ap.voided = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
UPDATE ap | ||
SET ap.voided = 1 | ||
FROM [ODS].[dbo].[CT_Ipt] ap | ||
LEFT JOIN [ODS].[dbo].[CT_Patient] p | ||
ON ap.PatientIDHash = p.PatientIDHash AND ap.PatientPKHash = p.PatientPKHash | ||
WHERE (ap.PatientIDHash IS NULL OR ap.PatientPKHash IS NULL) | ||
AND ap.voided = 0; |
7 changes: 7 additions & 0 deletions
7
Scripts/ODS/DQC/Update_Voided_Null_Patients/CT_PatientBaselines.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
UPDATE ap | ||
SET ap.voided = 1 | ||
FROM [ODS].[dbo].[CT_PatientBaselines] ap | ||
LEFT JOIN [ODS].[dbo].[CT_Patient] p | ||
ON ap.PatientIDHash = p.PatientIDHash AND ap.PatientPKHash = p.PatientPKHash | ||
WHERE (ap.PatientIDHash IS NULL OR ap.PatientPKHash IS NULL) | ||
AND ap.voided = 0; |
7 changes: 7 additions & 0 deletions
7
Scripts/ODS/DQC/Update_Voided_Null_Patients/CT_PatientLabs.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
UPDATE ap | ||
SET ap.voided = 1 | ||
FROM [ODS].[dbo].[CT_PatientLabs] ap | ||
LEFT JOIN [ODS].[dbo].[CT_Patient] p | ||
ON ap.PatientIDHash = p.PatientIDHash AND ap.PatientPKHash = p.PatientPKHash | ||
WHERE (ap.PatientIDHash IS NULL OR ap.PatientPKHash IS NULL) | ||
AND ap.voided = 0; |
7 changes: 7 additions & 0 deletions
7
Scripts/ODS/DQC/Update_Voided_Null_Patients/CT_PatientPharmacy.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
UPDATE ap | ||
SET ap.voided = 1 | ||
FROM [ODS].[dbo].[CT_PatientPharmacy] ap | ||
LEFT JOIN [ODS].[dbo].[CT_Patient] p | ||
ON ap.PatientIDHash = p.PatientIDHash AND ap.PatientPKHash = p.PatientPKHash | ||
WHERE (ap.PatientIDHash IS NULL OR ap.PatientPKHash IS NULL) | ||
AND ap.voided = 0; |