Skip to content

Dev - #6

Merged
sedv8808 merged 5 commits into
mainfrom
dev
Aug 4, 2026
Merged

Dev#6
sedv8808 merged 5 commits into
mainfrom
dev

Conversation

@sedv8808

@sedv8808 sedv8808 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces several new classes and utility improvements to the DataBUS package, enhances Excel/CSV parsing, and improves type validation and boolean conversion. The most significant changes are the addition of base and domain-specific entity classes for aeDNA data, improvements to the Excel reading logic to support FAIRe templates, and utility function enhancements for type validation and value conversion.

New aeDNA Entity Classes

  • Added AeDNAEntity base class for flat aeDNA tables, with field validation and database insertion logic (src/DataBUS/AeDNAEntity.py).
  • Added AeDNAAssay and AeDNALibrary classes, inheriting from AeDNAEntity, to represent assay and library records with appropriate parameters and string representations (src/DataBUS/AeDNAAssay.py, src/DataBUS/AeDNALibrary.py). [1] [2]
  • Updated __init__.py to expose new aeDNA classes for import (src/DataBUS/__init__.py). [1] [2]

Excel/CSV Parsing Improvements

  • Improved read_xlsx to detect and properly parse FAIRe 3-row headers, and refactored header handling for better flexibility (src/DataBUS/neotomaHelpers/read_csv.py). [1] [2] [3]
  • Enhanced _process_value_entry to handle missing columns more robustly, supporting direct value entries for non-standard headers (src/DataBUS/neotomaHelpers/pull_params.py).

Utility Function Enhancements

  • Added validate_str_values for string field validation and integrated it into entity initialization (src/DataBUS/neotomaHelpers/utils.py, src/DataBUS/AeDNAEntity.py). [1] [2]
  • Refactored boolean conversion: renamed and improved _convert_bool to convert_to_bool, now handling more string variants and preserving None (src/DataBUS/neotomaHelpers/utils.py, src/DataBUS/neotomaHelpers/__init__.py). [1] [2] [3]

Project/Grant/Institution Handling

  • Refactored Project class to use clearer query variable names for project, grant, and institution insertions, and added parameter lists for grants and institutions (src/DataBUS/Project.py). [1] [2] [3] [4] [5] [6] [7]

Other Improvements

  • Updated Response class to track match flags for name/location searches (src/DataBUS/Response.py). [1] [2]
  • Extended AEDNAMODEL_PARAMS and improved naming in AeDNAModel for superseding models (src/DataBUS/AeDNAModel.py). [1] [2] [3]
  • Added a Codecov configuration file for coverage reporting (.github/workflows/codecov.yml).

Copilot AI lite review requested due to automatic review settings August 4, 2026 21:45
@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.51163% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.67%. Comparing base (419487d) to head (0a6e1dc).

Files with missing lines Patch % Lines
src/DataBUS/neotomaHelpers/read_csv.py 91.66% 2 Missing ⚠️
src/DataBUS/AeDNAAssay.py 88.88% 1 Missing ⚠️
src/DataBUS/AeDNALibrary.py 88.88% 1 Missing ⚠️
src/DataBUS/neotomaHelpers/utils.py 83.33% 1 Missing ⚠️
src/DataBUS/neotomaValidator/valid_data.py 75.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main       #6       +/-   ##
===========================================
+ Coverage   50.69%   70.67%   +19.98%     
===========================================
  Files          71       77        +6     
  Lines        3470     3618      +148     
===========================================
+ Hits         1759     2557      +798     
+ Misses       1711     1061      -650     
Files with missing lines Coverage Δ
src/DataBUS/AeDNAEntity.py 100.00% <100.00%> (ø)
src/DataBUS/AeDNAModel.py 87.50% <100.00%> (+65.62%) ⬆️
src/DataBUS/Project.py 83.72% <100.00%> (+57.53%) ⬆️
src/DataBUS/Response.py 100.00% <100.00%> (ø)
src/DataBUS/__init__.py 100.00% <100.00%> (ø)
src/DataBUS/neotomaHelpers/__init__.py 100.00% <100.00%> (ø)
src/DataBUS/neotomaHelpers/pull_params.py 98.00% <100.00%> (+0.08%) ⬆️
src/DataBUS/neotomaValidator/__init__.py 100.00% <100.00%> (ø)
...ataBUS/neotomaValidator/_aedna_entity_validator.py 100.00% <100.00%> (ø)
...c/DataBUS/neotomaValidator/valid_aednalibraries.py 100.00% <100.00%> (ø)
... and 10 more

... and 12 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR expands DataBUS’s Neotoma upload/validation pipeline with new aeDNA entity abstractions, improves Excel/CSV ingestion (including FAIRe-style headers and value: constants), and adds extensive validator test coverage to prevent silent truncation and mapping errors.

Changes:

  • Added aeDNA entity base + assay/library implementations and a shared validator helper for inserting “flat” aeDNA records.
  • Enhanced XLSX parsing to detect FAIRe 3-row headers and better handle stacked taxon headers; improved parameter pulling to support value: constants.
  • Hardened several validators (sample row-count guard, chronology scalar broadcast, speleothem monitoring coercion, skipping empty data rows) and added/expanded tests.

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/test_valid_speleothem.py New tests for speleothem + external speleothem validation behaviors.
tests/test_valid_sequence.py New tests for aeDNA sequence validation and helper extractors/mapping.
tests/test_valid_sample.py Adds tests covering the new row-count mismatch guard.
tests/test_valid_sample_age.py Adds tests ensuring chronology-wide scalars don’t truncate per-sample inserts.
tests/test_valid_project.py New tests for project/grant/contact/keyword extraction + linkage.
tests/test_valid_pbmodel.py New tests for 210Pb model validator insertion/linkage behavior.
tests/test_valid_hiatus.py New tests for hiatus clustering and insert behavior.
tests/test_valid_geopolitical_units.py New tests for hierarchical geopolitical unit resolution and linking.
tests/test_valid_dataset_database.py New tests for dataset-database lookup + insertion using value: constant.
tests/test_valid_assays.py New tests for aeDNA assay/library validators using value: constants.
tests/test_insert_final.py New tests for final submission insert step.
tests/test_helpers.py Adds XLSX parsing regression tests (FAIRe headers, stacked taxon headers) and value: constant behavior tests.
src/DataBUS/Response.py Extends Response with match flags (matched, doublematched).
src/DataBUS/Project.py Refactors query variable names and adds parameter lists for grants/institutions.
src/DataBUS/neotomaValidator/valid_speleothem.py Uses shared boolean coercion for monitoring, correctly handling None.
src/DataBUS/neotomaValidator/valid_sample.py Adds guard to fail loudly on mismatched rowwise column lengths.
src/DataBUS/neotomaValidator/valid_sample_age.py Broadcasts chronology-wide scalars across per-sample rows.
src/DataBUS/neotomaValidator/valid_project.py Improves contact resolution via get_contacts + adds participant-linked message.
src/DataBUS/neotomaValidator/valid_data.py Skips placeholder None entries and avoids inserting rows with value is None.
src/DataBUS/neotomaValidator/valid_assays.py New validator for inserting AeDNAAssay (with assaytype resolution).
src/DataBUS/neotomaValidator/valid_aednalibraries.py New validator for inserting AeDNALibrary linked to dataset + assay.
src/DataBUS/neotomaValidator/_aedna_entity_validator.py New shared “flat aeDNA entity” validator helper.
src/DataBUS/neotomaValidator/init.py Exposes new aeDNA validators at package level.
src/DataBUS/neotomaHelpers/utils.py Adds convert_to_bool and validate_str_values; keeps _convert_bool alias.
src/DataBUS/neotomaHelpers/read_csv.py Adds FAIRe header detection + stacked taxon header handling helpers.
src/DataBUS/neotomaHelpers/pull_params.py Improves missing-column handling to allow value: constants.
src/DataBUS/neotomaHelpers/init.py Exports convert_to_bool from helpers package.
src/DataBUS/AeDNAModel.py Extends model params and clarifies naming for superseding models.
src/DataBUS/AeDNALibrary.py Adds new AeDNALibrary entity.
src/DataBUS/AeDNAEntity.py Adds aeDNA base entity with type validation and generic insert logic.
src/DataBUS/AeDNAAssay.py Adds new AeDNAAssay entity.
src/DataBUS/init.py Exposes new aeDNA classes and additional entities for import.
.github/workflows/codecov.yml Adds Codecov configuration content (but currently placed as a workflow file).
Suppressed comments (1)

src/DataBUS/neotomaHelpers/pull_params.py:73

  • In _process_value_entry, using if not clean_valor: treats valid falsy values (e.g., numeric 0/0.0 after conversion, or boolean False) as “missing” and drops them. This will silently erase legitimate zero measurements and false flags. Use an explicit “missing” check (None/empty string/empty list) instead of truthiness (apply this both before and after convert_value_by_type).
        clean_valor = val_entry["value"]
    if not clean_valor:
        if "taxonname" not in val_entry:
            add_unit_inputs[param_name] = None
        return

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sedv8808
sedv8808 merged commit ae8785e into main Aug 4, 2026
6 checks passed
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.

2 participants