Files
All-in-one-Financial-Analysis/atlas-terminal/server/routers/edinet.py
T
shawnkim1997andClaude Opus 4.6 51cbaf7f8d feat: major codebase audit — 21 routers, 37 services, 12 pages fully documented
- Add missing numpy, scipy, dbnomics to requirements.txt (fixes ImportError on fresh install)
- Sync claude.md with actual codebase: §3 file structure (37 services, 21 routers),
  §5 API endpoints (92 routes), §6 frontend pages (12), §13 TODO status
- Update README.md with current architecture (92 API routes, 21 routers, 37 services),
  multi-asset overview, research grid, macro dashboard, screener+backtest,
  multi-jurisdiction filings, and 2026-03-26 changelog entry
- Add new routers: dart, edinet, fmp, macro, research
- Add new services: cache, dart_fetcher, dart_filing_service, economic_calendar,
  ecos_fetcher, edinet_filing_service, fmp_client, global_macro_quadrant,
  kpi_history_service, macro_cycle, macro_fetcher, oecd_cycle,
  peer_comparison_service, research_dashboard, smart_money_service, yield_fx_service
- Add new frontend: macro page, screener+backtest, research grid components,
  overview (Equity/ETF/Commodity), filings (SEC/DART/EDINET), error boundaries
- Remove 6 unused services: copilot_context, crypto_fetcher, fx_fetcher,
  gemini_analysis, market_data, technical_analysis
- Remove obsolete docs: .agent/, AGENT.md, ATLAS_EVALUATION.md, docs/

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-26 21:39:07 +00:00

61 lines
1.9 KiB
Python

"""EDINET Japan — optional annual report (有価証券報告書) + link fallbacks."""
from fastapi import APIRouter, HTTPException, Query
from server.models.schemas import EdgarSectionsResponse
from server.services.edinet_filing_service import (
edinet_is_configured,
get_edinet_links,
get_edinet_sections,
)
router = APIRouter()
@router.get("/links/{ticker}", summary="EDINET portal links (no API key required)")
async def edinet_links(ticker: str):
return get_edinet_links(ticker)
@router.get(
"/sections/{ticker}",
response_model=EdgarSectionsResponse,
summary="Japanese 有価証券報告書 sections (EDINET API v2)",
)
async def edinet_sections(
ticker: str,
include_html: bool = Query(
False,
description="Include HTML fragment for in-app viewer",
),
):
try:
sections, status, html_frag, meta = get_edinet_sections(ticker)
except ValueError as exc:
raise HTTPException(status_code=422, detail=str(exc)) from exc
except FileNotFoundError as exc:
raise HTTPException(status_code=404, detail=str(exc)) from exc
except Exception as exc:
raise HTTPException(status_code=500, detail=f"EDINET failed: {exc}") from exc
links = meta.get("links") if isinstance(meta.get("links"), dict) else None
configured = bool(meta.get("configured", edinet_is_configured()))
message = None
if not configured:
message = "Set EDINET_SUBSCRIPTION_KEY for in-app download; links are provided below."
html_payload = html_frag if include_html else ""
return EdgarSectionsResponse(
source="edinet",
configured=configured,
message=message,
links=links,
status=status,
item1a=sections.get("item1a", ""),
item3=sections.get("item3", ""),
item7=sections.get("item7", ""),
item8=sections.get("item8", ""),
item9a=sections.get("item9a", ""),
html=html_payload,
)