Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve "824 crashes have $0 comprehensive cost" #1030

Merged
merged 1 commit into from
Oct 4, 2021

Conversation

frankhereford
Copy link
Member

This pull request intends to close cityofaustin/atd-data-tech/issues/6875, but it is not a currently approved solution.

@patrickm02L If you're available, can we sync on this on Monday in advance of the VZ meeting coming up?

This is a potential solution for the 800 crashes which do not have a comprehensive cost. This solution would need approval from the VZ stakeholders because it changes the ground-state, default comprehensive cost value at the same cost of "non-injury" crash.

If deployed, it would need to use a query derived from the following to set the est_comp_cost_crash_based column to the default value for crash.

with persons as (
    select person_id, crash_id
    from atd_txdot_person
    union all
    select primaryperson_id as person_id, crash_id
    from atd_txdot_primaryperson
    )
--select crashes.crash_id, count(persons.person_id) as person_count
select crashes.crash_id, persons.person_id
from atd_txdot_crashes crashes
join atd_jurisdictions j on (ST_Intersects(j.geometry, crashes.position) and j.id = 5)
left join persons on (persons.crash_id = crashes.crash_id)
where crashes.est_comp_cost_crash_based = 0
and crash_date > now() - '5 year'::interval
order by person_id asc
--group by crashes.crash_id

After investigating ~30 of the crashes which are affected, I have observed the following:

  • A small handful (<3%) of the crashes affected are those which have a person in one of the persons tables, but that person died after the 30 day window following the crash. This makes them a "non-atd" fatality, and there is not a comprehensive cost defined for that injury outcome.

  • The vast majority of the crashes affected simply do not have people listed in the persons tables, nor on the CR3. It's an issue stemming from the initial issuance of the CR3 from the investigating officer. Consequently, there are no people to have injuries in the computation, and a non-zero, default value may be preferred.

Unverified

This user has not yet uploaded their public signing key.
@frankhereford frankhereford added the WIP Work in progress label Oct 3, 2021
@frankhereford frankhereford changed the title WIP: Potential resolution for "824 crashes have $0 comprehensive cost" Potential resolution for "824 crashes have $0 comprehensive cost" Oct 4, 2021
@frankhereford frankhereford removed the WIP Work in progress label Oct 4, 2021
@frankhereford
Copy link
Member Author

In order to deploy this change, we would need to update the audit_log function on the database, and then run this query:

update atd_txdot_crashes set est_comp_cost_crash_based = 50000 where crash_id in (
with persons as (
    select person_id, crash_id
    from atd_txdot_person
    union all
    select primaryperson_id as person_id, crash_id
    from atd_txdot_primaryperson
    )
select crashes.crash_id
from atd_txdot_crashes crashes
left join persons on (persons.crash_id = crashes.crash_id)
where crashes.est_comp_cost_crash_based = 0
and person_id is null
)

This query is intentionally omitting the 16 crashes from the last 5 years in the Austin Full Purpose jurisdiction which contain only non-ATD fatalities. I have emailed the list of said crashes to Lewis, per our conversation this morning, and we can adjust this query to follow his direction on those if it's to include them at the $50 comprehensive cost level, or write up an issue for a more complicated fix that places them in their own comprehensive cost bracket.

Copy link
Member

@patrickm02L patrickm02L left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stellar notes. Ship it!

@frankhereford frankhereford changed the title Potential resolution for "824 crashes have $0 comprehensive cost" Resolve "824 crashes have $0 comprehensive cost" Oct 4, 2021
@frankhereford
Copy link
Member Author

Memorializing direction from Lewis Leff this morning: I was able to quickly recap the circumstances which occured to create this set of crashes having no comprehensive cost. Lewis approved of the plan to assign crashes with no people, and therefor no injuries, the value of a non-injury crash, which currently is set at $50,000 as per the atd_txdot__est_comp_cost_crash_based table.

Copy link
Contributor

@mateoclarke mateoclarke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢 💨

@frankhereford frankhereford merged commit c1d6a92 into master Oct 4, 2021
@frankhereford frankhereford deleted the flh_6875_adjust_default_comp_cost_value branch October 4, 2021 19:40
@frankhereford
Copy link
Member Author

@patrickm02L I put this in ready-to-deploy on the kanban board; please advise when / if / how you'd like this change to be put in the database to make it live. The changes have been made on staging.

@patrickm02L
Copy link
Member

@frankhereford go ahead and make it live, and close out the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] ~824 crashes have $0 comprehensive cost
3 participants