Spaces:
Sleeping
Sleeping
Fix Company Profile path: look at sec_edgar.company
Browse files- Path: metrics.fundamentals.sec_edgar.company (from FinancialsBasket)
- Fallback: multi_source.fundamentals_all.sec_edgar.company
- Extract business_address, sector, sic_description from correct location
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
frontend/src/components/MCPDataPanel.tsx
CHANGED
|
@@ -511,20 +511,23 @@ export function MCPDataPanel({ metrics, rawData, companyName, ticker, exchange,
|
|
| 511 |
const companyProfile = React.useMemo(() => {
|
| 512 |
if (!rawData) return null
|
| 513 |
|
| 514 |
-
// Path 1: metrics.fundamentals
|
| 515 |
const fundamentals = rawData.metrics?.fundamentals as Record<string, unknown> | undefined
|
|
|
|
|
|
|
| 516 |
|
| 517 |
-
// Path 2:
|
| 518 |
-
const company = fundamentals?.company as Record<string, unknown> | undefined
|
| 519 |
-
|
| 520 |
-
// Path 3: Root level sector from fundamentals
|
| 521 |
-
const rootSector = fundamentals?.sector as string | undefined
|
| 522 |
-
|
| 523 |
-
// Path 4: multi_source fallback
|
| 524 |
const multiSource = rawData.multi_source as Record<string, unknown> | undefined
|
| 525 |
const fundsAll = multiSource?.fundamentals_all as Record<string, unknown> | undefined
|
| 526 |
-
const
|
| 527 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 528 |
|
| 529 |
// Extract business_address from SEC EDGAR company info
|
| 530 |
const businessAddr = company?.business_address as Record<string, unknown> | undefined
|
|
@@ -550,7 +553,7 @@ export function MCPDataPanel({ metrics, rawData, companyName, ticker, exchange,
|
|
| 550 |
}
|
| 551 |
|
| 552 |
return {
|
| 553 |
-
sector:
|
| 554 |
industry: company?.sic_description as string || legacyProfile?.industry as string || null,
|
| 555 |
hqLocation,
|
| 556 |
employees: legacyProfile?.fullTimeEmployees as number || legacyProfile?.employees as number || null,
|
|
|
|
| 511 |
const companyProfile = React.useMemo(() => {
|
| 512 |
if (!rawData) return null
|
| 513 |
|
| 514 |
+
// Path 1: metrics.fundamentals.sec_edgar.company (from FinancialsBasket)
|
| 515 |
const fundamentals = rawData.metrics?.fundamentals as Record<string, unknown> | undefined
|
| 516 |
+
const secEdgar = fundamentals?.sec_edgar as Record<string, unknown> | undefined
|
| 517 |
+
const secCompany = secEdgar?.company as Record<string, unknown> | undefined
|
| 518 |
|
| 519 |
+
// Path 2: multi_source.fundamentals_all.sec_edgar.company (alternative path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 520 |
const multiSource = rawData.multi_source as Record<string, unknown> | undefined
|
| 521 |
const fundsAll = multiSource?.fundamentals_all as Record<string, unknown> | undefined
|
| 522 |
+
const fundsSecEdgar = fundsAll?.sec_edgar as Record<string, unknown> | undefined
|
| 523 |
+
const fundsCompany = fundsSecEdgar?.company as Record<string, unknown> | undefined
|
| 524 |
+
|
| 525 |
+
// Use whichever company object is available
|
| 526 |
+
const company = secCompany || fundsCompany
|
| 527 |
+
|
| 528 |
+
// Get sector from multiple possible locations
|
| 529 |
+
const secSector = secEdgar?.sector as string || fundsSecEdgar?.sector as string
|
| 530 |
+
const companySector = company?.sector as string
|
| 531 |
|
| 532 |
// Extract business_address from SEC EDGAR company info
|
| 533 |
const businessAddr = company?.business_address as Record<string, unknown> | undefined
|
|
|
|
| 553 |
}
|
| 554 |
|
| 555 |
return {
|
| 556 |
+
sector: secSector || companySector || legacyProfile?.sector as string || null,
|
| 557 |
industry: company?.sic_description as string || legacyProfile?.industry as string || null,
|
| 558 |
hqLocation,
|
| 559 |
employees: legacyProfile?.fullTimeEmployees as number || legacyProfile?.employees as number || null,
|