Spaces:
Runtime error
Runtime error
Upload edgar_client.py
Browse files- edgar_client.py +11 -4
edgar_client.py
CHANGED
|
@@ -423,8 +423,11 @@ class EdgarDataClient:
|
|
| 423 |
for i in range(len(form_types_list)):
|
| 424 |
form_type = form_types_list[i]
|
| 425 |
|
| 426 |
-
#
|
| 427 |
-
|
|
|
|
|
|
|
|
|
|
| 428 |
continue
|
| 429 |
|
| 430 |
filing_date = filing_dates[i] if i < len(filing_dates) else ""
|
|
@@ -551,15 +554,19 @@ class EdgarDataClient:
|
|
| 551 |
# Extract year from filing_date (format: YYYY-MM-DD)
|
| 552 |
file_year = int(filing_date[:4]) if len(filing_date) >= 4 else 0
|
| 553 |
|
|
|
|
|
|
|
|
|
|
| 554 |
# Store filing - allow filing_date year to differ from fiscal year
|
| 555 |
# (20-F/10-K for FY2024 may be filed in 2025)
|
| 556 |
# We'll match by fiscal year in the facts data instead
|
| 557 |
-
key
|
|
|
|
| 558 |
if key not in filings_map:
|
| 559 |
filings_map[key] = {
|
| 560 |
"accession_number": accession_number,
|
| 561 |
"primary_document": primary_document,
|
| 562 |
-
"form_type": form_type,
|
| 563 |
"filing_date": filing_date,
|
| 564 |
"file_year": file_year
|
| 565 |
}
|
|
|
|
| 423 |
for i in range(len(form_types_list)):
|
| 424 |
form_type = form_types_list[i]
|
| 425 |
|
| 426 |
+
# Normalize form type (e.g., "10-K/A" -> "10-K", "20-F/A" -> "20-F")
|
| 427 |
+
normalized_form_type = form_type.split('/')[0]
|
| 428 |
+
|
| 429 |
+
# Filter by form type if specified (using normalized type)
|
| 430 |
+
if form_types and normalized_form_type not in form_types:
|
| 431 |
continue
|
| 432 |
|
| 433 |
filing_date = filing_dates[i] if i < len(filing_dates) else ""
|
|
|
|
| 554 |
# Extract year from filing_date (format: YYYY-MM-DD)
|
| 555 |
file_year = int(filing_date[:4]) if len(filing_date) >= 4 else 0
|
| 556 |
|
| 557 |
+
# Normalize form type (e.g., "10-K/A" -> "10-K") for consistent key matching
|
| 558 |
+
normalized_form_type = form_type.split('/')[0]
|
| 559 |
+
|
| 560 |
# Store filing - allow filing_date year to differ from fiscal year
|
| 561 |
# (20-F/10-K for FY2024 may be filed in 2025)
|
| 562 |
# We'll match by fiscal year in the facts data instead
|
| 563 |
+
# Use normalized form type in key to ensure amended forms (10-K/A) match
|
| 564 |
+
key = f"{normalized_form_type}_{file_year}"
|
| 565 |
if key not in filings_map:
|
| 566 |
filings_map[key] = {
|
| 567 |
"accession_number": accession_number,
|
| 568 |
"primary_document": primary_document,
|
| 569 |
+
"form_type": form_type, # Keep original form_type for reference
|
| 570 |
"filing_date": filing_date,
|
| 571 |
"file_year": file_year
|
| 572 |
}
|