diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_ARTPatients.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_ARTPatients.sql new file mode 100644 index 00000000..dd024fe5 --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_ARTPatients.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_AdverseEvents.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_AdverseEvents.sql new file mode 100644 index 00000000..689519a8 --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_AdverseEvents.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_AllergiesChronicIllness.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_AllergiesChronicIllness.sql new file mode 100644 index 00000000..16d69830 --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_AllergiesChronicIllness.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_ArtFastTrack.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_ArtFastTrack.sql new file mode 100644 index 00000000..d3315208 --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_ArtFastTrack.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_CancerScreening.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_CancerScreening.sql new file mode 100644 index 00000000..8f574514 --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_CancerScreening.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_CervicalCancerScreening.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_CervicalCancerScreening.sql new file mode 100644 index 00000000..5463aeaa --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_CervicalCancerScreening.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_ContactListing.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_ContactListing.sql new file mode 100644 index 00000000..a1649e95 --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_ContactListing.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_Covid.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_Covid.sql new file mode 100644 index 00000000..869fa2dd --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_Covid.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_DefaulterTracing.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_DefaulterTracing.sql new file mode 100644 index 00000000..a20b1143 --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_DefaulterTracing.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_DepressionScreening.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_DepressionScreening.sql new file mode 100644 index 00000000..88e2862b --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_DepressionScreening.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_DrugAlcoholScreening.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_DrugAlcoholScreening.sql new file mode 100644 index 00000000..b04c5af6 --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_DrugAlcoholScreening.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_EnhancedAdherenceCounselling.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_EnhancedAdherenceCounselling.sql new file mode 100644 index 00000000..38d667ea --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_EnhancedAdherenceCounselling.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_FacilityManifest.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_FacilityManifest.sql new file mode 100644 index 00000000..512aaeda --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_FacilityManifest.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_GbvScreening.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_GbvScreening.sql new file mode 100644 index 00000000..c39598e5 --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_GbvScreening.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_IITRiskScores.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_IITRiskScores.sql new file mode 100644 index 00000000..05d2d9cd --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_IITRiskScores.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_Ipt.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_Ipt.sql new file mode 100644 index 00000000..65ce687d --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_Ipt.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_Otz.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_Otz.sql new file mode 100644 index 00000000..775c0bbb --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_Otz.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_Ovc.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_Ovc.sql new file mode 100644 index 00000000..d7d7a4ac --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_Ovc.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_Patient.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_Patient.sql new file mode 100644 index 00000000..7df75d8e --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_Patient.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_PatientBaselines.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_PatientBaselines.sql new file mode 100644 index 00000000..4e270863 --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_PatientBaselines.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_PatientLabs.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_PatientLabs.sql new file mode 100644 index 00000000..f31cfe2e --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_PatientLabs.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_PatientPharmacy.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_PatientPharmacy.sql new file mode 100644 index 00000000..8531072d --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_PatientPharmacy.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_PatientStatus.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_PatientStatus.sql new file mode 100644 index 00000000..19d1a29c --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_PatientStatus.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_PatientVisits.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_PatientVisits.sql new file mode 100644 index 00000000..329989f2 --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_PatientVisits.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_PatientVisits_Opt.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_PatientVisits_Opt.sql new file mode 100644 index 00000000..1225f028 --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_PatientVisits_Opt.sql @@ -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 \ No newline at end of file diff --git a/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_Relationships.sql b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_Relationships.sql new file mode 100644 index 00000000..6e9bbc97 --- /dev/null +++ b/Scripts/ODS/DQC/Get_Voided_Null_Patients/CT_Relationships.sql @@ -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 diff --git a/Scripts/ODS/DQC/Update_Voided_Null_Patients/CT_ARTPatients.sql b/Scripts/ODS/DQC/Update_Voided_Null_Patients/CT_ARTPatients.sql new file mode 100644 index 00000000..a0e3eeb5 --- /dev/null +++ b/Scripts/ODS/DQC/Update_Voided_Null_Patients/CT_ARTPatients.sql @@ -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; \ No newline at end of file diff --git a/Scripts/ODS/DQC/Update_Voided_Null_Patients/CT_Ipt.sql b/Scripts/ODS/DQC/Update_Voided_Null_Patients/CT_Ipt.sql new file mode 100644 index 00000000..6415fab1 --- /dev/null +++ b/Scripts/ODS/DQC/Update_Voided_Null_Patients/CT_Ipt.sql @@ -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; \ No newline at end of file diff --git a/Scripts/ODS/DQC/Update_Voided_Null_Patients/CT_PatientBaselines.sql b/Scripts/ODS/DQC/Update_Voided_Null_Patients/CT_PatientBaselines.sql new file mode 100644 index 00000000..0e478798 --- /dev/null +++ b/Scripts/ODS/DQC/Update_Voided_Null_Patients/CT_PatientBaselines.sql @@ -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; \ No newline at end of file diff --git a/Scripts/ODS/DQC/Update_Voided_Null_Patients/CT_PatientLabs.sql b/Scripts/ODS/DQC/Update_Voided_Null_Patients/CT_PatientLabs.sql new file mode 100644 index 00000000..896ee71f --- /dev/null +++ b/Scripts/ODS/DQC/Update_Voided_Null_Patients/CT_PatientLabs.sql @@ -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; \ No newline at end of file diff --git a/Scripts/ODS/DQC/Update_Voided_Null_Patients/CT_PatientPharmacy.sql b/Scripts/ODS/DQC/Update_Voided_Null_Patients/CT_PatientPharmacy.sql new file mode 100644 index 00000000..50931986 --- /dev/null +++ b/Scripts/ODS/DQC/Update_Voided_Null_Patients/CT_PatientPharmacy.sql @@ -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; \ No newline at end of file