Skip to content

fix(chemi): send schema bodies from bulk classifier wrappers - #379

Open
seanthimons wants to merge 2 commits into
mainfrom
fix/classifier-bulk-bodies
Open

seanthimons wants to merge 2 commits into
mainfrom
fix/classifier-bulk-bodies

Conversation

@seanthimons

Copy link
Copy Markdown
Owner

Problem

chemi_amnb_nate_bulk("DTXSID7020182") failed with HTTP 400 ('sid' was unexpected). The classifier_body callback reproduced the legacy {chemicals: [{sid}], options} call, which the amnb_nate, arn_cats, ncc_cats, pfas_atlas and pfas_cats POST services reject (additionalProperties: false). This was ComptoxR's callback, not a Specmill gap.

Changes

  • classifier_body sends the schema's top-level fields: chemicals ({id, smiles} records), smiles (array) and model (arn_cats).
  • New pre_request hook resolve_classifier_inputs resolves DTXSID, DTXCID and CASRN values in character input to SMILES with chemi_resolver_lookup_bulk(). The identifier becomes the record id unless the element is named.
  • Duplicate inputs are dropped.
  • Data frames and lists of records are sent as given; identifiers inside them are not resolved.
  • Identifiers that do not resolve are skipped with a warning.

Verification

  • generate_specmill.R --check and dev/check_hook_config.R pass.
  • test-native_classifier_bodies, the five test-contract-chemi_*_bulk, the hook tests and test-native_service_info pass locally. The full suite was not run locally.
  • Live calls to all five services with mixed SMILES and identifiers return results.

The amnb_nate, arn_cats, ncc_cats, pfas_atlas and pfas_cats POST services
reject the legacy {chemicals: [{sid}], options} body with HTTP 400. Send
top-level chemicals ({id, smiles} records), smiles and model instead.

Resolve DTXSID, DTXCID and CASRN inputs to SMILES in a pre-request hook and
drop duplicate inputs.
@github-actions

Copy link
Copy Markdown
Contributor

📊 Test Coverage Report

Current Coverage: 92.24%

Threshold Target Status
Target 75% ✅

Note: Coverage is informational only and does not block merges. The 75% target is a guideline.

View detailed coverage report

Run covr::report(covr::package_coverage()) locally for detailed analysis.

Coverage excludes: R/data.R (documentation-only file)

@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 95.05495% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
R/chemi_amnb_nate_bulk.R 93.33% 2 Missing ⚠️
R/chemi_ncc_cats_bulk.R 93.33% 2 Missing ⚠️
R/chemi_pfas_atlas_bulk.R 93.33% 2 Missing ⚠️
R/chemi_arn_cats_bulk.R 96.66% 1 Missing ⚠️
R/chemi_pfas_cats_bulk.R 96.66% 1 Missing ⚠️
R/hooks_compound.R 96.87% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

This branch has not been deployed

No deployments
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