Skip to content

fix: warn when sample_metadata() returns empty result due to case-sensitivity #1084

Open
sallykinyua wants to merge 3 commits intomalariagen:masterfrom
sallykinyua:fix/sample-metadata-case-sensitivity-warning
Open

fix: warn when sample_metadata() returns empty result due to case-sensitivity #1084
sallykinyua wants to merge 3 commits intomalariagen:masterfrom
sallykinyua:fix/sample-metadata-case-sensitivity-warning

Conversation

@sallykinyua
Copy link

@sallykinyua sallykinyua commented Mar 9, 2026

Closes #1083

Problem
sample_metadata() silently returns an empty DataFrame when a query
uses incorrect string casing, with no error or suggestion to the user.
For example, country == 'uganda' returns 0 results while
country == 'Uganda' returns 290.

Fix
Added a UserWarning after the query executes when zero results are
returned, informing the user that string matching is case-sensitive
and providing an example of the correct format.

Files Changed
malariagen_data/anoph/sample_metadata.py — line 785, added warning
when df_samples is empty after applying prepared_sample_query.

@sallykinyua sallykinyua changed the title fix: warn when sample_metadata() returns empty result due to case-sensitivity #1083 fix: warn when sample_metadata() returns empty result due to case-sensitivity Closes #1083 Mar 9, 2026
@sallykinyua sallykinyua changed the title fix: warn when sample_metadata() returns empty result due to case-sensitivity Closes #1083 fix: warn when sample_metadata() returns empty result due to case-sensitivity Mar 9, 2026
@sallykinyua
Copy link
Author

Hi @jonbrenas Can you please review this I know you earlier pointed out that documentations issues do not deserve alot of scrutiny but I found this essential to work but I would like to know if it aligns with the priority of the contribution period?

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.

sample_metadata() silently returns empty DataFrame for case-mismatched string queries on country/location with no warning or suggestion

1 participant