Skip to content

fix: improve metadata group discovery and loading - #348

Merged
luabida merged 3 commits into
AlertaDengue:mainfrom
Atingahbismark145:issue-232-metadata
Sep 28, 2026
Merged

luabida merged 3 commits into
AlertaDengue:mainfrom
Atingahbismark145:issue-232-metadata

Conversation

@Atingahbismark145

Copy link
Copy Markdown
Contributor

Summary

This pull request addresses Issue #232 by improving how PySUS discovers and loads metadata groups for online databases.

Changes

  • Updated metadata loading to recognize groups defined by YAML root keys.
  • Added support for loading SIA BI metadata from the existing YAML metadata structure.
  • Updated available_groups() to discover metadata groups from YAML keys.
  • Prevented SINAN-specific saude metadata groups from being incorrectly listed for other databases.
  • Added regression tests covering the new metadata group behavior.

Testing

The metadata test suite was run successfully:

  • 17 tests passed
  • 1 pytest configuration warning was reported (exclude is an unknown pytest config option)

Team Contributions

  • Atingah Bismark — metadata loading and SIA BI test
  • Amadi Charles — metadata group discovery from YAML keys
  • Asamani Slyvanus Tetteh — database-specific group filtering and regression test

Related to #232.

@Atingahbismark145

Copy link
Copy Markdown
Contributor Author

Hi, We have finished working on Issue #232. We made some changes to improve how the metadata groups are found and loaded, including the SIA BI metadata. We also added tests for the changes and made sure the SINAN saude groups are only used with SINAN.

We ran the metadata tests and got 17 passed with 1 warning.

Please have a look at the changes and let us know if anything needs to be changed. Thank you.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 97.56098% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@d3fd5a7). Learn more about missing BASE report.

Files with missing lines Patch % Lines
pysus/api/metadata/columns.py 96.00% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #348   +/-   ##
=======================================
  Coverage        ?   97.21%           
=======================================
  Files           ?      180           
  Lines           ?    22685           
  Branches        ?        0           
=======================================
  Hits            ?    22053           
  Misses          ?      632           
  Partials        ?        0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@luabida
luabida merged commit 0048008 into AlertaDengue:main Sep 28, 2026
15 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.11.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

devgtv added a commit to devgtv/PySUS that referenced this pull request Oct 2, 2026
- Fix trailing/extra blank lines and comment indentation in
  `pysus/api/metadata/columns.py` (pre-existing whitespace from AlertaDengue#348)
- Wrap long endpoint strings in `pysus/api/saude/databases.py` to satisfy
  flake8 E501 while keeping values identical and ISC004 clean. Also
  validates with black 24.2.
luabida pushed a commit that referenced this pull request Oct 5, 2026
* chore(python): support CPython 3.14

The cap on the interpreter was the only thing keeping 3.14 out. No
application code changes are needed: the suite passes unchanged on
3.14.7 with the locked dependency versions (1780 passed, 6 skipped),
and the tree uses nothing that has been removed since 3.11 -- no
distutils, pkg_resources, imp, utcnow(), or bare get_event_loop().

Two dev tools did need fixing, both for the same reason: they touch
ast.Str, which no longer exists on 3.12+. black 22.12 (what the
`^22.6.0` dev pin resolved to) aborts with "cannot format: module 'ast'
has no attribute 'Str'" on five files, and flake8-implicit-str-concat
0.4.0 takes down the whole flake8 run from its multiprocessing pool.
The latter is the pre-commit hook CI actually runs, so a 3.14 matrix
entry would have gone red at the Linting step before reaching the tests.

flake8-implicit-str-concat is capped at >=0.6.0, the first release that
works on 3.14. 0.7.0 would also run, but it adds an ISC004 check that
flags eight existing implicit concatenations in saude/databases.py, which
is out of scope here.

The lock moves only black, flake8, pycodestyle and pyflakes. Every
runtime dependency keeps its resolved version; numpy already carried a
python_version == "3.11" split and needs no new marker.

* fix(lint): pin flake8-implicit-str-concat exactly at 0.6.0

The previous commit used `>=0.6.0`, which resolves to 0.7.0. That
version works on 3.14 too, but it adds an ISC004 check that flags eight
existing implicit concatenations in api/saude/databases.py. Confirmed by
running the lint under 3.11, 3.12, 3.13 and 3.14.

Pin it exactly, matching the style of every other plugin in this file, so
the lint result cannot shift underneath us the next time pre-commit
autoupdate runs. 0.6.0 is the oldest release that does not crash on 3.14,
and it reports no findings the newer ones would flag.

* style: clean lint on metadata columns and saude databases

- Fix trailing/extra blank lines and comment indentation in
  `pysus/api/metadata/columns.py` (pre-existing whitespace from #348)
- Wrap long endpoint strings in `pysus/api/saude/databases.py` to satisfy
  flake8 E501 while keeping values identical and ISC004 clean. Also
  validates with black 24.2.

* chore(lint): bump flake8-implicit-str-concat to 0.7.0

ISC004 findings were resolved (endpoint strings wrapped to avoid implicit
concatenation in collections or made single-line as needed), so we can
adopt 0.7.0 without new warnings.

* fix(lint): resolve ISC004 in ECONOMIASAUDE endpoint strings

* style: fix ISC001 in test_dadosgov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants