Skip to content

Commit fd1f828

Browse files
committed
docs: finalize FinSight documentation and report package
1 parent 5ed3149 commit fd1f828

43 files changed

Lines changed: 12931 additions & 2718 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ============================================================================
2-
# ARIN Query Intelligence 环境变量配置示例
2+
# FinSight 环境变量配置示例
33
# ============================================================================
44
# 使用方法:
55
# 1. 复制本文件为 .env: cp .env.example .env

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.pdf binary
2+
*.png binary
3+
*.jpg binary
4+
*.jpeg binary
5+
*.zip binary

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Project Mission & Boundaries
44

5-
ARIN Query Intelligence turns a user’s financial question into evidence artifacts that downstream systems can analyze and answer from. The owned core is NLU plus Retrieval: `nlu_result` captures normalized query, product type, intents, topics, entities, missing slots, risk flags, and source plan; `retrieval_result` captures executed sources, documents, structured data, coverage, warnings, ranking debug traces, and `analysis_summary`.
5+
FinSight turns a user’s financial question into evidence artifacts that downstream systems can analyze and answer from. The owned core is Query Intelligence: `nlu_result` captures normalized query, product type, intents, topics, entities, missing slots, risk flags, and source plan; `retrieval_result` captures executed sources, documents, structured data, coverage, warnings, ranking debug traces, and `analysis_summary`.
66

77
Query Intelligence does not write final natural-language investment answers, does not produce deterministic buy/sell decisions, and does not own frontend, account, or scheduling systems. Downstream consumers such as `sentiment/` and `scripts/llm_response.py` must consume upstream artifacts instead of re-inferring intent, target entities, or source plan.
88

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Group 4.2
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 147 additions & 1238 deletions
Large diffs are not rendered by default.

README_CN.md

Lines changed: 148 additions & 1475 deletions
Large diffs are not rendered by default.

docs/index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22

33
Languages: English | [中文](zh/index.md)
44

5-
These pages document FinSight, the ARIN7012 Group 4.2 evidence-first financial analysis chatbot project. The technical backend remains ARIN Query Intelligence.
5+
These pages document FinSight, the ARIN7012 Group 4.2 evidence-first financial analysis chatbot project. The technical backend module is Query Intelligence.
66

77
The root README is intentionally short; use these pages when you need contracts, configuration details, training steps, or downstream handoff notes.
88

99
## Contents
1010

1111
| Document | Purpose |
1212
|---|---|
13+
| [Modules](modules.md) | Five-module map: frontend, NLU/Retrieval, numerical analysis, text analysis, and LLM summary/prediction. |
1314
| [Query Intelligence](query-intelligence.md) | Scope, architecture, API, NLU and retrieval output contracts, live providers, environment variables, troubleshooting. |
1415
| [Local Frontend Chatbot](frontend-chatbot.md) | Browser UI, `/chat` contract, DeepSeek v4 settings, real local screenshots, and troubleshooting. |
16+
| [Numerical Analysis](numerical-analysis.md) | `analysis_summary`, technical indicators, fundamentals, macro signals, and data readiness. |
1517
| [Presentation Materials](presentation/README.md) | Clean slide outline and links to current demo screenshots. |
1618
| [Training](training.md) | Public dataset sync, manifest-based training, runtime asset materialization, evaluation, and release checks. |
1719
| [LLM Response](llm-response.md) | Legacy local-transformers answer-generation JSON handoff, output contract, configuration, and safeguards. |

docs/modules.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# FinSight Modules
2+
3+
Languages: English | [中文](zh/modules.md)
4+
5+
FinSight is organized into five modules. Each module has a clear responsibility and exchanges structured artifacts with the next stage.
6+
7+
## Module Overview
8+
9+
| Module | Responsibility | Main outputs | Detailed docs |
10+
|---|---|---|---|
11+
| Frontend | Browser interaction, `/chat` request flow, rendered answer cards, evidence display, and bilingual user experience. | Chat UI state, user request, rendered answer, source cards. | [Local Frontend Chatbot](frontend-chatbot.md) |
12+
| NLU and Retrieval | Normalize the query, resolve entities, classify intent/topic/style, plan sources, retrieve documents and structured rows, rank evidence, and package traceable outputs. | `nlu_result`, `retrieval_result`, coverage, warnings, debug trace. | [Query Intelligence](query-intelligence.md) |
13+
| Numerical Analysis | Convert structured market, fundamental, valuation, macro, and price-history rows into compact analytical signals. | `analysis_summary.market_signal`, `fundamental_signal`, `macro_signal`, `data_readiness`. | [Numerical Analysis](numerical-analysis.md) |
14+
| Text Analysis | Clean retrieved documents, detect language, filter entity-relevant sentences, and classify financial sentiment. | `SentimentResult`, document-level `SentimentItem`, entity aggregates. | [Document Sentiment Analysis](sentiment.md) |
15+
| LLM Summary and Prediction | Generate frontend-ready answer JSON and follow-up question suggestions from compact evidence. | `answer_generation`, `next_question_prediction`, citations, disclaimer. | [LLM Response Handoff](llm-response.md) |
16+
17+
## Data Flow
18+
19+
```mermaid
20+
flowchart TD
21+
A["User query"] --> B["Frontend"]
22+
B --> C["NLU"]
23+
C --> D["Retrieval"]
24+
D --> E["Numerical Analysis"]
25+
D --> F["Text Analysis"]
26+
D --> G["LLM Summary and Prediction"]
27+
E --> G
28+
F --> G
29+
G --> H["Frontend answer"]
30+
```
31+
32+
## Boundaries
33+
34+
- The frontend should not infer financial intent or source plans. It sends user input and renders returned evidence.
35+
- NLU and Retrieval should stay explainable and evidence-producing. They do not write final investment answers.
36+
- Numerical analysis summarizes structured evidence. It does not claim causal forecasts.
37+
- Text analysis classifies retrieved documents. It does not retrieve new sources independently.
38+
- LLM summary uses only compact evidence and cited evidence IDs. It must not invent missing facts.
39+
40+
## Where to Change Things
41+
42+
| Task | Start here |
43+
|---|---|
44+
| Add a new endpoint or contract field | `query_intelligence/contracts.py`, then update [Query Intelligence](query-intelligence.md). |
45+
| Add a new source provider | `query_intelligence/integrations/`, retrieval source planning, and provider config. |
46+
| Add a new numerical indicator | `query_intelligence/retrieval/market_analyzer.py`, then update [Numerical Analysis](numerical-analysis.md). |
47+
| Change frontend display | `query_intelligence/chatbot.py`, then update [Local Frontend Chatbot](frontend-chatbot.md). |
48+
| Change sentiment preprocessing or labels | `sentiment/`, then update [Document Sentiment Analysis](sentiment.md). |
49+
| Change LLM JSON output | `scripts/llm_response.py` and `/chat` response mapping, then update [LLM Response Handoff](llm-response.md). |

docs/numerical-analysis.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Numerical Analysis
2+
3+
Languages: English | [中文](zh/numerical-analysis.md)
4+
5+
The numerical analysis module summarizes structured evidence retrieved by FinSight. It is implemented mainly in `query_intelligence/retrieval/market_analyzer.py` and exposed through `retrieval_result.analysis_summary`.
6+
7+
This module supports explanation and evidence readiness. It does not produce deterministic buy/sell decisions.
8+
9+
## Inputs
10+
11+
Numerical analysis consumes structured rows already selected by retrieval:
12+
13+
| Input | Typical source | Use |
14+
|---|---|---|
15+
| Price and quote history | `market_api`, Tushare, AKShare, efinance, seed data | Returns, moving averages, volatility, RSI, MACD, Bollinger bands. |
16+
| Fundamentals | `fundamental_sql`, Tushare, local structured rows | Profitability, valuation, ROE, PE/PB, data completeness. |
17+
| Industry context | `industry_sql` | Sector identity and sector-level context. |
18+
| Macro indicators | `macro_sql`, `macro_indicator`, `policy_event` | CPI, PMI, M2, treasury yields, policy-event direction. |
19+
| Fund/index rows | `fund_nav`, `fund_fee`, `index_daily`, `index_valuation` | NAV, fee, redemption, index trend and valuation evidence. |
20+
21+
The module uses the resolved entity, source plan, retrieved structured rows, and NLU intent/topic hints. It does not re-run NLU.
22+
23+
## Output
24+
25+
`analysis_summary` is a compact object designed for downstream modules:
26+
27+
```text
28+
analysis_summary
29+
├── market_signal
30+
│ ├── trend_signal
31+
│ ├── pct_change_nd
32+
│ ├── ma5 / ma20
33+
│ ├── rsi_14
34+
│ ├── macd
35+
│ ├── bollinger
36+
│ └── volatility_20d
37+
├── fundamental_signal
38+
│ ├── pe_ttm / pb / roe
39+
│ ├── valuation_assessment
40+
│ └── available_fields
41+
├── macro_signal
42+
│ ├── indicators[]
43+
│ └── overall
44+
└── data_readiness
45+
├── has_price_data
46+
├── has_fundamentals
47+
├── has_macro
48+
├── has_news
49+
├── has_technical_indicators
50+
├── relevant_intents
51+
└── relevant_topics
52+
```
53+
54+
## Indicator Meaning
55+
56+
| Signal | Meaning |
57+
|---|---|
58+
| `trend_signal` | Directional description inferred from recent price and moving-average context. |
59+
| `pct_change_nd` | Recent percentage return over available windows. |
60+
| `ma5`, `ma20` | Short and medium moving averages when enough price history exists. |
61+
| `rsi_14` | Momentum indicator. Extreme values should be treated as context, not a standalone trading rule. |
62+
| `macd` | Trend and momentum signal derived from exponential moving averages. |
63+
| `bollinger` | Price position relative to recent volatility bands. |
64+
| `volatility_20d` | Recent realized volatility. |
65+
| `valuation_assessment` | Lightweight valuation interpretation based on available PE/PB/fundamental rows. |
66+
| `data_readiness` | Flags that tell downstream modules whether enough evidence exists for a reliable explanation. |
67+
68+
## Design Rules
69+
70+
- Use only structured evidence already retrieved by FinSight.
71+
- Keep calculations explainable and inspectable.
72+
- Preserve missing-data warnings instead of filling unsupported facts.
73+
- Treat indicators as descriptive signals, not trading instructions.
74+
- Keep downstream LLM prompts compact by passing summarized fields, not raw provider dumps.
75+
76+
## Related Tests
77+
78+
```bash
79+
python -m pytest tests/test_analysis_summary.py tests/test_market_analyzer.py -q
80+
```
81+
82+
## Related Documentation
83+
84+
- [Query Intelligence](query-intelligence.md)
85+
- [LLM Response Handoff](llm-response.md)
86+
- [Training and Runtime Assets](training.md)

docs/presentation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Presentation Materials
22

3-
This folder is the cleaned presentation entry point for the FinSight / ARIN Query Intelligence project.
3+
This folder is the cleaned presentation entry point for the FinSight project.
44

55
The original `PPT_Overleaf` backup contained older browser screenshots, LaTeX build byproducts, unrelated image assets, and raw planning notes. The reusable content has been consolidated here as a clean slide outline and linked to the current documented frontend screenshots.
66

0 commit comments

Comments
 (0)