Documentation
¶
Overview ¶
Package clinicaltrials is the library behind the clinicaltrials command: the HTTP client, request shaping, and the typed data models for the ClinicalTrials.gov REST API v2.
The public API at https://clinicaltrials.gov/api/v2 is fully open — no API key, no authentication required. The client sets a real User-Agent, paces requests at 500 ms by default, and retries 429/5xx with exponential backoff.
Index ¶
Constants ¶
const DefaultUserAgent = "clinicaltrials/dev (+https://github.com/tamnd/clinicaltrials-cli)"
DefaultUserAgent identifies the client to ClinicalTrials.gov.
const Host = "clinicaltrials.gov"
Host is the ClinicalTrials.gov hostname.
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound is returned when the API returns a 404 for an NCT ID.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to the ClinicalTrials.gov REST API v2.
type Config ¶
type Config struct {
BaseURL string
UserAgent string
Rate time.Duration
Retries int
Timeout time.Duration
}
Config holds constructor parameters.
type Domain ¶ added in v0.2.0
type Domain struct{}
Domain is the ClinicalTrials.gov driver. It carries no state; the per-run client is built by the factory Register hands kit.
func (Domain) Classify ¶ added in v0.2.0
Classify turns any accepted input into the canonical (uriType, id). NCT IDs (8+ chars starting with NCT) → ("nctid", id); otherwise → ("query", input).
func (Domain) Info ¶ added in v0.2.0
func (Domain) Info() kit.DomainInfo
Info describes the scheme and the identity the single-site binary inherits.
type Study ¶ added in v0.2.0
type Study struct {
NCTID string `kit:"id" json:"nct_id"`
BriefTitle string `json:"brief_title"`
OfficialTitle string `json:"official_title"`
OverallStatus string `json:"overall_status"`
Phase string `json:"phase"`
StudyType string `json:"study_type"`
Enrollment int `json:"enrollment"`
StartDate string `json:"start_date"`
CompletionDate string `json:"completion_date"`
LeadSponsor string `json:"lead_sponsor"`
Conditions []string `json:"conditions"`
BriefSummary string `json:"brief_summary"`
}
Study is the record emitted for search and study operations.