Avg n dx types per laptop
Jump to navigation
Jump to search
Ad-hoc query to get the average number of Dx Types per D_ID across laptops. We wouldn't expect this to be a perfect match, and some differences between sites and certainly between programs would be expected, but large differences might point to collection differences. Discussed with Lisa, documenting query here for future use.
SELECT Left([l_Log].[D_ID],2) AS lt, L_Log.D_ID, Sum(IIf([Dx_Type]="comorbid",1,0)) AS como, Sum(IIf([dx_type]="admit",1,0)) AS adm, Sum(IIf([Dx_Type]="acquired",1,0)) AS acqu, Sum(1) AS a_dx FROM L_Log INNER JOIN L_ICD10 ON L_Log.D_ID = L_ICD10.D_ID WHERE (((L_Log.RecordStatus)="vetted") AND ((L_Log.SentDtTm)>Now()-(2*365))) GROUP BY Left([l_Log].[D_ID],2), L_Log.D_ID ORDER BY Left([l_Log].[D_ID],2);