Skip to content

feat(melodi): tests, docstrings, fix measures parsing - #308

Open
GrasClement wants to merge 13 commits into
InseeFrLab:feat/melodifrom
GrasClement:feature/melodi-tests-docs
Open

GrasClement wants to merge 13 commits into
InseeFrLab:feat/melodifrom
GrasClement:feature/melodi-tests-docs

Conversation

@GrasClement

Copy link
Copy Markdown

Draft contribution aux JDOS : cible la branche #306

  • Fix _parse_dataset_observations (voir package R Melodi)
  • Docstrings manquantes
  • Tests des 4 fonctions publiques

Signed-off-by: GrasClement <gras.clement@orange.fr>
Signed-off-by: GrasClement <gras.clement@orange.fr>
Signed-off-by: GrasClement <gras.clement@orange.fr>
Signed-off-by: GrasClement <gras.clement@orange.fr>
Signed-off-by: GrasClement <gras.clement@orange.fr>
@GrasClement
GrasClement marked this pull request as ready for review June 17, 2026 15:33
@GrasClement

Copy link
Copy Markdown
Author

Hi,

The JDOS are done, here is a quick closure summary for this PR,

Bug Fixes

  • Fixed hardcoded measure key in _parse_dataset_observations
  • Added guard for observations without "measures" field (prevents crashes)
  • Corrected language filter logic in get_idbank
  • Improved handling of non-MELODI idbanks → returns empty DataFrame

New Content

  • Docstrings for 4 public MELODI functions + 2 internal helpers
  • Tests: 14 tests covering parsing, edge cases, and all public functions
  • Example notebook: example_internet_usage_melodi.ipynb
  • Updated MELODI docs integration and DDL deprecation warning

Code Maintenance

  • Added update and silent parameters to all 4 public functions
  • Updated imports and version (0.2.6)
  • Updated .gitignore for development files

Cheers

@tfardet

tfardet commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Thanks @GrasClement !
@tgrandje may I let you have a look at this since it targets your previous PR?
I'm not sure I'll have the time to look at this any time soon...

@tgrandje

tgrandje commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Hi @GrasClement , sorry I took so long to review this, I was overloaded at work.

So I finally took the time to do it, with the exception of testing the documentation (I'm in a train on a personnal windows machine...) though it looks ok to me. I've made some comments: depending of your available time, feel free to let me know if you haven't the time to check all of this.

In any case, thank you for both your great work and the effort to uniformize the API with the silent/update kwargs ❤️ !

@GrasClement

Copy link
Copy Markdown
Author

Hi @tgrandje, no worries about the timing, and thanks for taking the time to review the PR!

I don't seem to see any review comments or additional commits attached to the PR yet. Whenever you have a chance, could you check whether the comments were actually submitted? Or maybe the issue is on my side and I'm looking in the wrong place.

I'd be happy to go through your feedback and update the PR once this is sorted out 😎

@tgrandje tgrandje left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sorry @GrasClement I forgot to submit the review 😳 !

Comment thread pynsee/melodi/data.py Outdated
Comment thread pynsee/melodi/data.py Outdated
Comment thread pynsee/melodi/data.py Outdated
Comment thread tests/melodi/test_pynsee_melodi.py Outdated
Comment on lines +16 to +18
# Exception here: the bugs fixed in melodi/data/py live inside parsing helpers
# called inside get_dataset. Testing them through the real API would
# require downloading DS_IPC_PRINC on every test run.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the explanations! As pynsee was never (yet) released with MELODI api, what do you think of removing the comments detailing the tests' purposes as fixes to my original branch? In case you're ok, I'll flag the involved comments I've seen.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Reworded that one, and two more with the same "fix" framing I noticed, figured I'd just fix those I found rather than wait for you to flag them separately.

Comment thread tests/melodi/test_pynsee_melodi.py Outdated
Comment thread tests/melodi/test_pynsee_melodi.py Outdated
Comment thread tests/melodi/test_pynsee_melodi.py
Comment thread tests/melodi/test_pynsee_melodi.py Outdated
Comment thread tests/melodi/test_pynsee_melodi.py Outdated
Comment thread docs/modules.rst
Signed-off-by: GrasClement <gras.clement@orange.fr>
Signed-off-by: GrasClement <gras.clement@orange.fr>
Signed-off-by: GrasClement <gras.clement@orange.fr>
@GrasClement

Copy link
Copy Markdown
Author

Hi @tgrandje

Replied to all your comments, thanks again for the thorough review, and sorry it took me a while to get back to it.

Also found and fixed one unrelated thing while I was in there: the get_range docstring example was out of date. It might be because of an API change INSEE pushed in July, nothing to do with your comments.

Let me know if anything needs another pass. I tried to finish cleanly to let new contributors jump in (see new comments in #307).

Cheers :)

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.

3 participants