Add aug 21 release - #94
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands the /publications lookup/benchmarking surface by adding a new combined-search strategy (single ES query that can match both PMIDs and alternate identifiers) and by improving benchmark integrity reporting, while also simplifying Elasticsearch connection presets/configuration.
Changes:
- Add
combined-searchas a supported/publicationslookup strategy, plus_meta.lookup_fallbackto indicate when a speculative ES path was rejected and the request fell back. - Generalize the publications benchmark harness to support explicitly ordered strategy pairs (
--compare-strategies), enforcelookup_fallback == falsefor paired integrity, and improve changed-path/order accounting. - Clean up Elasticsearch connection presets (drop legacy aliases, standardize on
in_cluster,ci_forward,test_forward) and update docs/tests accordingly.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_pubmed.py | Updates default integration ES connection preset name. |
| tests/test_publications_load.py | Extends CLI/paired-benchmark tests for explicit strategy pairs and fallback attribution. |
| tests/test_elasticsearch.py | Adds coverage for search_ids_or_terms and updates expected connection preset set. |
| tests/test_document_metadata.py | Adds extensive coverage for combined-search behavior and lookup-fallback metadata in /publications. |
| tests/test_backend_parity.py | Updates parity tests to use in_cluster connection preset. |
| README.md | Documents new strategy options, fallback attribution semantics, and updated ES preset names. |
| biothings_annotator/application/views/document_metadata.py | Adds combined-search service instance and exposes _meta.lookup_fallback in responses. |
| biothings_annotator/annotator/settings.py | Simplifies ES preset config and introduces DEFAULT_ELASTICSEARCH_CONNECTION. |
| biothings_annotator/annotator/elasticsearch.py | Introduces search_ids_or_terms query helper with named-clause attribution passthrough. |
| biothings_annotator/annotator/document_metadata.py | Implements combined-search fetch + reverse-mapping and returns per-request fallback metadata. |
| biothings_annotator/annotator/annotator.py | Uses DEFAULT_ELASTICSEARCH_CONNECTION for env defaulting. |
| benchmarks/publications/workload.py | Adds strategy defaults and default comparison pair constants. |
| benchmarks/publications/runner.py | Generalizes paired comparison to arbitrary strategy pairs; tracks fallback attribution; changed-path stratification. |
| benchmarks/publications/report.py | Renders dynamic “experiment minus control” deltas and includes fallback integrity counters. |
| benchmarks/publications/metrics.py | Tracks lookup_fallback counts in stage/arm summaries. |
| benchmarks/publications/main.py | Adds --compare-strategies, fixes lookup-strategy defaulting, and threads strategies into comparison runs. |
| benchmarks/publications/init.py | Exports new defaults for external callers. |
Suppressed comments (4)
tests/test_document_metadata.py:1653
- This test uses
elasticsearch_connection="ci", but the preset was removed fromELASTICSEARCH_CONNECTIONSin this PR. Prefer a valid preset name (e.g.in_cluster) to keep the test aligned with supported configuration values.
results, not_found, lookup_fallback = await DocumentMetadataService(
elasticsearch_connection="ci",
lookup_strategy=lookup_strategy,
).get_publications_with_metadata(publication_ids)
tests/test_document_metadata.py:1685
- This test uses
elasticsearch_connection="ci", but the preset was removed fromELASTICSEARCH_CONNECTIONSin this PR. Using a supported preset here avoids confusing future readers about which connection names are valid.
_, not_found, lookup_fallback = await DocumentMetadataService(
elasticsearch_connection="ci",
lookup_strategy=lookup_strategy,
).get_publications_with_metadata(publication_ids)
tests/test_document_metadata.py:1711
- This test uses
elasticsearch_connection="ci", but the preset was removed fromELASTICSEARCH_CONNECTIONSin this PR. Prefer a supported preset name so the test input reflects real configuration.
results, not_found, lookup_fallback = await DocumentMetadataService(
elasticsearch_connection="ci",
lookup_strategy=lookup_strategy,
).get_publications_with_metadata([PMID, DOI])
tests/test_document_metadata.py:1744
- This test uses
elasticsearch_connection="ci", but the preset was removed fromELASTICSEARCH_CONNECTIONSin this PR. Switching to a supported preset keeps the test consistent with the cleaned-up connection config.
service = DocumentMetadataService(
elasticsearch_connection="ci",
lookup_strategy=BULK_SEARCH_LOOKUP_STRATEGY,
)
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
/publicationssearching strategies