Skip to content

Wire GWAS Catalog REST API: studies, single study, count#1

Merged
tamnd merged 1 commit into
mainfrom
impl/gwas-catalog
Jun 15, 2026
Merged

Wire GWAS Catalog REST API: studies, single study, count#1
tamnd merged 1 commit into
mainfrom
impl/gwas-catalog

Conversation

@tamnd

@tamnd tamnd commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace scaffold boilerplate in gwas/ with a working implementation against the GWAS Catalog REST API (https://www.ebi.ac.uk/gwas/rest/api)
  • Three commands: gwas recent (paginated studies), gwas study <accession> (single fetch), gwas count (total studies)
  • Wire types decode the Spring HATEOAS HAL envelope; Study and Count exported types carry kit struct tags for CLI/MCP/API output

Test plan

  • go test ./... passes — 10 tests, no live network calls (all httptest)
  • go build ./... passes — clean build
  • TestSearchStudies — mock HAL response with 2 studies, verify IDs and traits, total count
  • TestGetStudy — mock single-study response, verify accession and PubMedID
  • TestGetCount — verify page.totalElements read correctly (1142122)
  • TestRetryOn503 — 2x503 then success, timing >500ms
  • TestBackoff — backoff(1)=500ms, backoff(10)=5s
  • TestDomainInfo — scheme="gwas"
  • TestClassify / TestClassifyEmpty — accession round-trip and empty-input error
  • TestLocate / TestLocateUnknown — correct URL and unknown-type error

Replace scaffold boilerplate in gwas/ with a real implementation against
https://www.ebi.ac.uk/gwas/rest/api. Three operations: recent (paginated
study list), study (single fetch by accession), count (total studies).
Wire types decode the Spring HATEOAS HAL envelope; exported Study and Count
carry kit struct tags for CLI/MCP output. Five gwas_test.go cases cover
search, single get, count, 503 retry timing, and backoff formula; five
domain_test.go cases cover scheme, classify, empty-input error, locate, and
unknown-type error.
@tamnd tamnd merged commit 3fb0781 into main Jun 15, 2026
4 of 7 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.

1 participant