Fix num features extracted - #525
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes how COMPASS reports the number of extracted ordinance features by ensuring the count is a native Python int and by including that value in the jurisdiction summary output produced by the threaded services layer.
Changes:
- Cast
num_ordinances_dataframe(...).sum()to a Pythonintto avoid leaking NumPy scalar types. - Add
num_features_extractedto the jurisdiction JSON output (and assert it in the threaded service unit test). - Extend parsing utility unit tests to cover missing values and “exclude all features” behavior while ensuring the return type is
int.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
compass/utilities/parsing.py |
Ensures ordinance row counts return a JSON-safe native int. |
compass/services/threaded.py |
Adds num_features_extracted to jurisdiction-level output and removes it from per-document output. |
tests/python/unit/utilities/test_utilities_parsing.py |
Adds coverage for return type and edge cases involving missing values/exclusions. |
tests/python/unit/services/test_services_threaded.py |
Verifies num_features_extracted is emitted in the jurisdiction summary. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #525 +/- ##
==========================================
+ Coverage 63.78% 63.85% +0.07%
==========================================
Files 78 78
Lines 7445 7446 +1
Branches 755 755
==========================================
+ Hits 4749 4755 +6
+ Misses 2536 2531 -5
Partials 160 160
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Minor fix to actually report number