Add category and tags granularity to company sync flows
This commit is contained in:
@@ -47,6 +47,21 @@ function hasFinancialSnapshot(filing: Filing) {
|
||||
return filing.filing_type === '10-K' || filing.filing_type === '10-Q';
|
||||
}
|
||||
|
||||
function parseTagsInput(input: string) {
|
||||
const unique = new Set<string>();
|
||||
|
||||
for (const segment of input.split(',')) {
|
||||
const tag = segment.trim();
|
||||
if (!tag) {
|
||||
continue;
|
||||
}
|
||||
|
||||
unique.add(tag);
|
||||
}
|
||||
|
||||
return [...unique];
|
||||
}
|
||||
|
||||
function asScaledFinancialSnapshot(
|
||||
value: number | null | undefined,
|
||||
scale: NumberScaleUnit
|
||||
@@ -111,6 +126,8 @@ function FilingsPageContent() {
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [syncTickerInput, setSyncTickerInput] = useState('');
|
||||
const [syncCategoryInput, setSyncCategoryInput] = useState('');
|
||||
const [syncTagsInput, setSyncTagsInput] = useState('');
|
||||
const [filterTickerInput, setFilterTickerInput] = useState('');
|
||||
const [searchTicker, setSearchTicker] = useState('');
|
||||
const [financialValueScale, setFinancialValueScale] = useState<NumberScaleUnit>('millions');
|
||||
@@ -156,7 +173,12 @@ function FilingsPageContent() {
|
||||
}
|
||||
|
||||
try {
|
||||
await queueFilingSync({ ticker: syncTickerInput.trim().toUpperCase(), limit: 20 });
|
||||
await queueFilingSync({
|
||||
ticker: syncTickerInput.trim().toUpperCase(),
|
||||
limit: 20,
|
||||
category: syncCategoryInput.trim() || undefined,
|
||||
tags: parseTagsInput(syncTagsInput)
|
||||
});
|
||||
void queryClient.invalidateQueries({ queryKey: queryKeys.recentTasks(20) });
|
||||
void queryClient.invalidateQueries({ queryKey: ['filings'] });
|
||||
await loadFilings(searchTicker || undefined);
|
||||
@@ -227,6 +249,18 @@ function FilingsPageContent() {
|
||||
placeholder="Ticker (AAPL)"
|
||||
className="w-full sm:max-w-xs"
|
||||
/>
|
||||
<Input
|
||||
value={syncCategoryInput}
|
||||
onChange={(event) => setSyncCategoryInput(event.target.value)}
|
||||
placeholder="Category (optional)"
|
||||
className="w-full sm:max-w-xs"
|
||||
/>
|
||||
<Input
|
||||
value={syncTagsInput}
|
||||
onChange={(event) => setSyncTagsInput(event.target.value)}
|
||||
placeholder="Tags (comma-separated)"
|
||||
className="w-full sm:max-w-xs"
|
||||
/>
|
||||
<Button type="submit" className="w-full sm:w-auto">
|
||||
<Download className="size-4" />
|
||||
Queue sync
|
||||
|
||||
Reference in New Issue
Block a user