Skip to content

#288: Fix incorrect grade for buildings missing reporting years#292

Open
jacobdiaz wants to merge 3 commits into
vkoves:mainfrom
jacobdiaz:fix/288-incorrect-grade-missing-years
Open

#288: Fix incorrect grade for buildings missing reporting years#292
jacobdiaz wants to merge 3 commits into
vkoves:mainfrom
jacobdiaz:fix/288-incorrect-grade-missing-years

Conversation

@jacobdiaz

@jacobdiaz jacobdiaz commented May 13, 2026

Copy link
Copy Markdown

Problem

Buildings that stopped reporting were still getting a perfect submission rate (and thus an inflated overall grade). The issue was in calculate_building_submission_rate it used len(group) as total_years, which only counts rows actually present in the dataframe. If a building simply had no row for a year (the city just doesn't include them rather than marking them "Not Submitted"), that gap was invisible.

For example, Digital Lakeside (ID 101185) has data for 2019-2022 but nothing for 2023. Since all 4 rows had a submitted status, it got 4/4 = 100% submission rate and an A for reporting.

Fix

Changed total_years to be calculated as the span from the building's first appearance through the latest year in the dataset (max_year - first_year + 1). Years where the building has no row at all now count as missing alongside explicit "Not Submitted" rows.

Digital Lakeside now correctly gets 4/5 = 80% instead of 4/4 = 100%.

Testing

  • All 115 existing tests pass
  • Verified against real data:
    • Digital Lakeside: 100% → 80% (was the bug, now fixed)
    • Building with all 10 years: still 100%
    • Building with all "Not Submitted": still 0%
    • New building (only 2023): still 100%
    • Building only in 2014, missing 9 years since: 100% → 10%

Fixes #288

Buildings that stopped reporting had no row at all for missing years
(as opposed to a "Not Submitted" row), so they weren't counted as
missing. Now we calculate expected years from the building's first
appearance through the latest year in the dataset.

Fixes vkoves#288
@netlify

netlify Bot commented May 13, 2026

Copy link
Copy Markdown

Deploy Preview for radiant-cucurucho-d09bae ready!

Name Link
🔨 Latest commit a93165f
🔍 Latest deploy log https://app.netlify.com/projects/radiant-cucurucho-d09bae/deploys/6a1f8dae5785b10008efd05f
😎 Deploy Preview https://deploy-preview-292--radiant-cucurucho-d09bae.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@jacobdiaz jacobdiaz changed the title Fix buildings getting incorrect A for reporting when years are missing #288: Fix incorrect grade for buildings missing reporting years May 13, 2026
@vkoves vkoves self-assigned this May 15, 2026
@vkoves vkoves added bug Something isn't working data Data updates & tweaks labels May 15, 2026
@vkoves

vkoves commented May 15, 2026

Copy link
Copy Markdown
Owner

@jacobdiaz - two things. First, take a look at the run all file - if you make a data pipeline change, you have to run that to re-generate the output files (see https://github.com/vkoves/electrify-chicago#run-data-processing)

Second, can you add a test that would catch this issue and validate your fix?

Thanks for the great work!

@vkoves

vkoves commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Hm, something is still of:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working data Data updates & tweaks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug - Some Buildings Get Incorrect A For Reporting

2 participants