/** * Indicator Research Service * * Extracts numeric regulatory indicators (IPREM, SMI, tax rates, visa thresholds) * from official government sources. Designed for MoveAhead's reference indicators. * * Key capabilities: * - Extracts specific numeric values with units from government pages * - Detects effective dates and legal references * - Tracks changes between research runs * - Provides confidence scoring * * @example * ```typescript * const result = await researchIndicator({ * sourceUrl: "https://www.boe.es/buscar/act.php?id=BOE-A-2023-26478", * indicatorType: "income_threshold", * extractionHints: { * valuePattern: "IPREM", * expectedUnit: "EUR", * }, * previousValue: 600, * }); * ``` */ import { type LLMBrowserClient } from '../sdk.js'; /** * Types of regulatory indicators */ export type IndicatorType = 'income_threshold' | 'tax_rate' | 'visa_requirement' | 'retirement' | 'cost_index'; /** * Hints to help extraction */ export interface ExtractionHints { /** Pattern to look for (e.g., "IPREM", "salario minimo") */ valuePattern?: string; /** Alternative patterns */ alternativePatterns?: string[]; /** Expected currency/unit (e.g., "EUR", "%", "USD") */ expectedUnit?: string; /** Expected range for sanity checking */ expectedRange?: [number, number]; /** Whether the value should be annual vs monthly */ periodicity?: 'monthly' | 'annual' | 'daily' | 'one-time'; /** Legal document type (e.g., "Real Decreto", "Lei") */ legalDocType?: string; } /** * Request to research an indicator */ export interface IndicatorResearchRequest { /** Official source URL */ sourceUrl: string; /** Type of indicator */ indicatorType: IndicatorType; /** Hints to help extraction */ extractionHints?: ExtractionHints; /** Previous value for change detection */ previousValue?: number; /** Previous effective date */ previousEffectiveDate?: string; /** Language hint (auto-detected if not provided) */ language?: string; } /** * Extracted indicator value */ export interface ExtractedIndicator { /** The numeric value */ value: number; /** Unit (EUR, USD, %, etc.) */ unit: string; /** Effective date (when this value took effect) */ effectiveDate?: string; /** Legal reference (e.g., "Real Decreto-ley 8/2023") */ legalReference?: string; /** Confidence score (0-1) */ confidence: number; /** Original text where value was found */ extractedText: string; /** Multiple values found (if applicable) */ alternativeValues?: Array<{ value: number; context: string; }>; } /** * Change analysis between previous and current value */ export interface IndicatorChange { /** Whether the value changed */ hasChanged: boolean; /** Previous value */ previousValue?: number; /** Percentage change */ changePercent?: number; /** Change severity */ severity: 'none' | 'minor' | 'major' | 'breaking'; /** Human-readable change description */ description: string; } /** * Source information */ export interface SourceInfo { /** URL that was fetched */ url: string; /** Final URL after redirects */ finalUrl: string; /** When the source was fetched */ fetchedAt: string; /** Whether API was used instead of browser */ usedApi: boolean; /** Which render tier was used */ renderTier: string; /** Recommended hours until next check */ recommendedRefreshHours: number; /** Page title */ pageTitle?: string; } /** * Complete research result */ export interface IndicatorResearchResult { /** Whether research succeeded */ success: boolean; /** Error message if failed */ error?: string; /** Extracted indicator (if success) */ indicator?: ExtractedIndicator; /** Change analysis (if previousValue provided) */ change?: IndicatorChange; /** Source information */ source: SourceInfo; } /** * Research a regulatory indicator from an official government source */ export declare function researchIndicator(request: IndicatorResearchRequest, browser?: LLMBrowserClient): Promise; /** * Research multiple indicators in batch */ export declare function researchIndicatorsBatch(requests: IndicatorResearchRequest[]): Promise; /** * Pre-configured indicator research configs for common indicators */ export declare const INDICATOR_CONFIGS: Record>; /** * Get a pre-configured indicator request */ export declare function getIndicatorConfig(indicatorCode: string, previousValue?: number, previousEffectiveDate?: string): IndicatorResearchRequest | null; //# sourceMappingURL=indicator-research.d.ts.map