hmis-analyst / shiny-apps-oracle

Shiny apps for the Data Analyst project
4 stars 1 forks source link

Discrepancies between APR and Data Analyst App – unaccompanied children #9

Open jtoder opened 10 years ago

jtoder commented 10 years ago

When I run for agency = MUST Ministries, program = "ES YR SF+FC Elizabeth Inn Shelter," dates 1/1/13 - 12/31/13: app says there are no unaccompanied children but the APR says there are 2.

jrodri30 commented 10 years ago

Figured this out. The problem was that I was relying on an "Unaccompanied Youth" field in the Client_Information table. This field's calculation must not match the calculation that's in the Pathways APR... So I tried to mimic the APR programming specifications.

My new calculation: Unaccompanied youth = "yes" IF there is only 1 client in the household AND the client is under 18 years old as of program entry.

Under this calculation, the MUST program shows 2 unaccompanied youth on the DQ app, which now matches the APR report.

I'll leave this issue up for now, in case another discrepancy arises. But I think this issue is fixed.

DaveTotten commented 10 years ago

Hey Jason & Joan,

Unaccompanied Youth was a field that Tony felt needed to be calculated in the ODBCDB overnight copy. Maybe Tony could fix this to update that field in the ODBCDB table. Jason, could you publish your calculation in this issue for others to see (Tony, Jeremy and Brian). I will email them to make sure they have signed up for GitHub.

jtoder commented 10 years ago

There are a few issues to be considered here.

1) As a matter of terminology - the APR is looking at unaccompanied "children" rather than "youth." In the PIT and the new data standards "youth" is defined as anyone under 25. So I don't know what Tony was/is intending with his field but, as Jason has done, this should definitely only be unaccompanied children. 2) On the PED and Alerts we identify children in households without adults, which could include two children together in a HH. Neither would be unaccompanied children because HH size > 1. So PED info may not agree with APR or this app because it's considering something different. Example is children having an entry date earlier than parent. 2) Jason - I agree with your calculation for unaccompanied children. You said that the DQ app now shows 2. However, I see that the DQ app now shows 1 and the APR still has two. I'm wondering if you're looking at the household key at program enrollment (which it should be) or current household key.

The two unaccompanied children correctly counted in the APR are 1426137 (who has a different HH Key at Progarm Enrollment than parent but has same current HH Key) and 1103929 (who has both HH keys different than parent).

jrodri30 commented 10 years ago

Dave, the exact SQL code for my calculation is:

SELECT count( unique case when HH_Members=1 and (Program_Entry_Date - Date_of_Birth)/365.25 < 18 then Program_Enrollment_Key end ) UnaChild

FROM Program_Enrollment PE

LEFT JOIN ( SELECT Household_Key, count(Household_Key) HH_Members FROM Household_Client_Info HCI GROUP BY Household_Key ) HCI on PE.Household_Key = HCI.Household_Key

jrodri30 commented 10 years ago

Joan, my calculation categorizes a child as "unaccompanied" if and only if the household size = 1. I didn't think about (multiple) children in a household with no adult. Do we want to modify the app so that it counts these children?

Also, I'm not sure where I saw the "2" unaccompanied youth on my app -- you're right, only 1 is showing. I think your theory about the different household keys is correct. I only have access to a general client household key, not a specific "household key at program enrollment." Dave, is this a field we can add to ODBCDB?

jtoder commented 10 years ago

I don't think we need to modify the app so it counts multiple children in households with no adults - it should agree with the APR just like you have it. I was bringing that up because I thought you might encounter the question at some point, about why it didn't match the PED.

I think "household key at program enrollment" is very important to have in ODBCDB. It's what's used to associate clients in households in all reports having to do with programs. Current household key is not used for this purpose.