/** * ClinicalTrials.gov Integration * * Provides real-time access to clinical trial data from ClinicalTrials.gov * using the official API v2. Enables matching patients to eligible trials * based on their cancer type, biomarkers, and treatment history. */ import { EventEmitter } from 'events'; export interface ClinicalTrial { nctId: string; title: string; briefTitle?: string; officialTitle?: string; status: TrialStatus; phase: TrialPhase; studyType: 'interventional' | 'observational' | 'expanded-access'; conditions: string[]; interventions: TrialIntervention[]; eligibility: TrialEligibility; locations: TrialLocation[]; sponsors: TrialSponsor[]; contacts: TrialContact[]; dates: { startDate?: Date; primaryCompletionDate?: Date; completionDate?: Date; firstPostedDate?: Date; lastUpdatePostedDate?: Date; }; enrollment?: { count: number; type: 'actual' | 'anticipated'; }; arms?: TrialArm[]; outcomes?: TrialOutcome[]; biomarkerRequirements?: BiomarkerRequirement[]; references?: string[]; url: string; } export type TrialStatus = 'not-yet-recruiting' | 'recruiting' | 'enrolling-by-invitation' | 'active-not-recruiting' | 'suspended' | 'terminated' | 'completed' | 'withdrawn' | 'unknown'; export type TrialPhase = 'early-phase-1' | 'phase-1' | 'phase-1-2' | 'phase-2' | 'phase-2-3' | 'phase-3' | 'phase-4' | 'not-applicable'; export interface TrialIntervention { type: 'drug' | 'biological' | 'device' | 'procedure' | 'radiation' | 'behavioral' | 'genetic' | 'dietary' | 'combination' | 'other'; name: string; description?: string; armGroupLabels?: string[]; otherNames?: string[]; } export interface TrialEligibility { criteria: string; gender: 'all' | 'female' | 'male'; minimumAge?: string; maximumAge?: string; healthyVolunteers: boolean; inclusionCriteria?: string[]; exclusionCriteria?: string[]; } export interface TrialLocation { facility: string; city: string; state?: string; country: string; zip?: string; status?: 'recruiting' | 'not-recruiting' | 'withdrawn' | 'active' | 'completed'; contact?: { name?: string; phone?: string; email?: string; }; coordinates?: { latitude: number; longitude: number; }; distance?: number; } export interface TrialSponsor { name: string; type: 'principal-investigator' | 'sponsor' | 'sponsor-investigator'; leadOrCollaborator: 'lead' | 'collaborator'; } export interface TrialContact { name?: string; phone?: string; email?: string; role?: string; } export interface TrialArm { label: string; type: 'experimental' | 'active-comparator' | 'placebo-comparator' | 'sham-comparator' | 'no-intervention' | 'other'; description?: string; interventions?: string[]; } export interface TrialOutcome { type: 'primary' | 'secondary' | 'other'; measure: string; description?: string; timeFrame?: string; } export interface BiomarkerRequirement { biomarker: string; requirement: 'required' | 'excluded' | 'preferred'; value?: string; operator?: 'equals' | 'greater-than' | 'less-than' | 'between'; } export interface TrialSearchParams { condition?: string; conditionTerms?: string[]; intervention?: string; interventionType?: TrialIntervention['type']; drugName?: string; biomarkers?: string[]; genomicAlterations?: string[]; status?: TrialStatus[]; phase?: TrialPhase[]; country?: string; state?: string; city?: string; zipCode?: string; distance?: number; coordinates?: { lat: number; lon: number; }; age?: number; gender?: 'male' | 'female'; sponsorType?: 'industry' | 'academic' | 'government' | 'other'; funderType?: 'nih' | 'industry' | 'other'; studyType?: 'interventional' | 'observational' | 'expanded-access'; hasResults?: boolean; pageSize?: number; pageToken?: string; } export interface TrialSearchResult { trials: ClinicalTrial[]; totalCount: number; nextPageToken?: string; } export interface PatientProfile { cancerType: string; stage?: string; age?: number; gender?: 'male' | 'female'; ecogStatus?: number; biomarkers?: { name: string; value: string | number; status?: 'positive' | 'negative'; }[]; genomicAlterations?: { gene: string; alteration: string; type: 'mutation' | 'fusion' | 'amplification' | 'deletion'; }[]; msiStatus?: 'MSI-H' | 'MSI-L' | 'MSS'; tmbLevel?: 'high' | 'low'; pdl1Score?: number; hrdStatus?: 'positive' | 'negative'; priorTherapies?: string[]; comorbidities?: string[]; location?: { zipCode?: string; city?: string; state?: string; country?: string; coordinates?: { lat: number; lon: number; }; }; maxTravelDistance?: number; } export interface TrialMatch { trial: ClinicalTrial; matchScore: number; matchReasons: string[]; eligibilityAssessment: { status: 'likely-eligible' | 'possibly-eligible' | 'likely-ineligible' | 'unknown'; matchingCriteria: string[]; potentialExclusions: string[]; missingInformation: string[]; }; nearestLocation?: TrialLocation; biomarkerMatches?: { biomarker: string; trialRequirement: string; patientValue: string; match: boolean; }[]; } export declare class ClinicalTrialsGovClient extends EventEmitter { private baseUrl; private timeout; private cache; private cacheDuration; constructor(options?: { timeout?: number; cacheDuration?: number; }); /** * Search for clinical trials */ searchTrials(params: TrialSearchParams): Promise; /** * Get a specific trial by NCT ID */ getTrial(nctId: string): Promise; /** * Get multiple trials by NCT IDs */ getTrials(nctIds: string[]): Promise; /** * Search for trials matching a patient profile */ findMatchingTrials(patient: PatientProfile): Promise; /** * Search for trials by biomarker */ searchByBiomarker(biomarker: string, options?: { cancerType?: string; status?: TrialStatus[]; phase?: TrialPhase[]; }): Promise; /** * Search for trials by drug/intervention */ searchByDrug(drugName: string, options?: { cancerType?: string; status?: TrialStatus[]; phase?: TrialPhase[]; }): Promise; /** * Get trials for a specific cancer type */ getTrialsForCancerType(cancerType: string, options?: { phase?: TrialPhase[]; location?: { country?: string; state?: string; }; biomarkers?: string[]; }): Promise; private buildSearchQuery; private mapStudyToTrial; private mapTrialStatus; private mapTrialPhase; private mapStudyType; private mapInterventionType; private mapLocationStatus; private mapArmType; private mapGender; private parseEligibilityCriteria; private extractBiomarkerRequirements; private assessTrialMatch; private calculateDistance; private toRadians; private httpRequest; private getFromCache; private setCache; /** * Clear the cache */ clearCache(): void; } export default ClinicalTrialsGovClient; //# sourceMappingURL=clinicalTrialsGov.d.ts.map