HMIS / LSASampleCode

Longitudinal System Analysis (LSA) Sample Code and Documentation
22 stars 10 forks source link

Section 3.3.1: Effective Exit Date #1318

Closed nataliesus closed 6 days ago

nataliesus commented 1 month ago

Hi @MollyMcEvilley ,

image

  1. How important to follow the priority? If we should keep it, then there is one issue related to the priority order. Spec has a rule with priority 1, but it is the 2nd condition in CASE in the Sample Code. Either Sample Code or Spec should be updated.

  2. The spec has "LSAProjectType = 1 and ExitDate is not null" condition. The Sample Code uses "LSAProjectType = 1 and ExitDate <= ReportEnd" condition. I am thinking about ExitDate > ReportEnd case. Could you please fix either Spec or Sample code?

  3. Priority rule 4: 3.1. According to the Spec, Effective Exit Date must be [MoveInDate + 1 day]. The Sample Code uses dateadd(dd, 1, ExitDate). I understand that we have MoveInDate = ExitDate, but can it be updated for consistency? 3.2. Sample Code uses ExitDate < ReportEnd condition which is missing in the Spec.

  4. Priority rule 5: 4.1. Sample Code uses ExitDate <= OperatingEnd, but Spec uses ExitDate < OperatingEndDate. Looks like Sample Code should be updated. 4.2. Sample Code uses ExitDate <= HMISEnd, but Spec uses ExitDate < HMISEnd. Looks like Sample Code should be updated. 4.3. Sample Code uses ExitDate <= ReportEnd condition which is missing in the Spec.

  5. Priority rule 6: Spec uses "ExitDate is null; and OperatingEndDate is null or > ReportEnd; and HMISEnd is NULL". In the Sample Code there are 2 WHENs:

    • "ExitDate is NULL and (HMISEnd is null) and (OperatingEnd is null)"
    • "ExitDate > ReportEnd and HMISEnd is null and OperatingEnd is null"

I am not sure the Spec describes what is in the Sample Code because in the Spec "> ReportEnd" is related to the OperatingEndDate , not to the raw ExitDate. Which one if correct?

  1. The text is different from the priority rule 2:
    • text states "ExitDate is more than one day after the last bed LastBedNight"
    • priority rule 2 states "LSAProjectType = 1 and ExitDate is not null"

image

Thank you! Natalie

MollyMcEvilley commented 3 weeks ago

Agh. This is the ripple effect from including exit dates that are greater than ReportEnd in the join to hmis_Exit. They shouldn't be relevant at all, but truncating enrollments based on HMIS participation and operating dates makes a mess.

Where the conditions are mutually exclusive (e,g., 1 requires ExitDate to be null or > ReportEnd and 2 requires ExitDate to be <= ReportEnd), it doesn't matter which one comes first in the code.

I've made a few changes in 3.3.1 -- the most useful is selecting the latest of HMISStart and OperatingStart as pStart (p for project) and the earliest non-null HMISEnd / OperatingEnd as pEnd in the core subquery. It makes applying the rules a lot less messy, and I think it is consistent with the rules defined by the specs, but it is a little further away from perfect symmetry with the way they rules are expressed in the specs.

I have to leave for the airport in about 4 hours, I haven't slept or packed yet., and I want to make sure to get the 3.3.1 issues in the sample code addressed before I go. (I'll be back on Tuesday.)