Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check to prevent key errors for lacking metadata in neon_soil_example #35

Merged
merged 1 commit into from
May 9, 2024

Conversation

kheal
Copy link
Collaborator

@kheal kheal commented May 8, 2024

Closes #28.

Issue arose from bio samples that must have been ingested after our initial creation of the notebooks. Some of the new bio samples do not have slots for geo_loc_name and are throwing a key error. I've added a check that subsets samples only for those with a collection_date, geo_loc_name and lat_lon before adding those data to downstream analyses.

@kheal kheal requested a review from brynnz22 May 8, 2024 19:47
@kheal kheal self-assigned this May 8, 2024
@kheal
Copy link
Collaborator Author

kheal commented May 8, 2024

@brynnz22
Copy link
Contributor

brynnz22 commented May 9, 2024

@kheal are the changes in cell 4?:

# Check if samp has keys that correspond to primary metadata
    if set(['lat_lon', 'geo_loc_name', 'collection_date']).issubset(samp):

@kheal
Copy link
Collaborator Author

kheal commented May 9, 2024

Yep! And then a few spots down below that used to reference all_results now reference all_full_results.

Copy link
Contributor

@brynnz22 brynnz22 left a comment

Choose a reason for hiding this comment

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

Thanks for diff link!

@brynnz22 brynnz22 merged commit e4d755b into main May 9, 2024
@kheal
Copy link
Collaborator Author

kheal commented May 9, 2024

@kheal kheal deleted the neon_metadata_keyerror branch May 29, 2024 22:05
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.

Defensive programming/decrease assumptions: Try/catch for KeyError: 'geo_loc_name'
2 participants