modify: 删除隐私文件

This commit is contained in:
2025-10-10 08:13:22 +08:00
parent af4285e147
commit 00e766eaa7
14 changed files with 0 additions and 1857 deletions

BIN
.DS_Store vendored

Binary file not shown.

5
.gitignore vendored
View File

@@ -1,5 +0,0 @@
sample/
strategy_evaluation_results.csv
run_metadata.json
*.log
simulation.html

View File

@@ -1,47 +0,0 @@
# Changelog
## [1.1.0] - 2025-08-28
### Added
- Integrated GPT-based analysis for comprehensive traffic safety insights
- Added automated report generation with AI-powered recommendations
- Implemented natural language query processing for data exploration
- Added export functionality for analysis reports (PDF/CSV formats)
- Included sentiment analysis for accident description texts
### Enhanced
- Improved data visualization with interactive charts and heatmaps
- Optimized prediction algorithms with enhanced machine learning models
- Expanded dataset with additional traffic parameters and weather conditions
- Upgraded user interface with responsive design and dark mode support
### Fixed
- Resolved session state KeyError in multi-tab navigation
- Fixed data persistence issues between application refreshes
- Corrected timestamp parsing errors in accident data import
- Addressed memory leaks in large dataset processing
### Documentation
- Updated README with new GPT analysis features and usage examples
- Added API documentation for extended functionality
- Included sample datasets and tutorial guides
## [1.0.0] - 2025-08-19
### Added
- Initial release of TrafficSafeAnalyzer
- Streamlit app with tabs for data analysis, prediction, and strategy evaluation
### Fixed
- Resolved session state KeyError
## [1.0.0] - 2025-08-19
### Added
- Initial release of TrafficSafeAnalyzer.
- Streamlit app with tabs for data analysis, prediction, and strategy evaluation.
### Fixed
- Resolved session state KeyError.

19
LICENSE
View File

@@ -1,19 +0,0 @@
Copyright (c) 2025 TongNian
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

1576
app.py

File diff suppressed because it is too large Load Diff

View File

View File

File diff suppressed because one or more lines are too long

148
readme.md
View File

@@ -1,148 +0,0 @@
# TrafficSafeAnalyzer
一个基于 Streamlit 的交通安全分析系统,支持事故数据分析、预测模型、异常检测和策略评估。
## 功能
- 加载和清洗事故与策略数据Excel 格式)
- 使用 ARIMA、KNN、GLM、SVR 等模型预测事故趋势
- 检测异常事故点
- 评估交通策略效果并提供推荐
## 安装步骤
### 前提条件
- Python 3.8+
- Git
- 可选Docker用于容器化部署
### 安装
1. 克隆仓库:
```bash
git clone https://github.com/tongnian0613/TrafficSafeAnalyzer.git
cd TrafficSafeAnalyzer
```
2. 创建虚拟环境(推荐):
```bash
conda create -n trafficsa python=3.12 -y
conda activate trafficsa
pip install -r requirements.txt
streamlit run app.py
```
3. 安装依赖:
(1) 基本安装(必需依赖)
```bash
pip install streamlit pandas numpy matplotlib plotly scikit-learn statsmodels scipy
```
(2) 完整安装(包含所有可选依赖)
```bash
pip install -r requirements.txt
```
(3) 或者手动安装可选依赖
```bash
pip install streamlit-autorefresh openpyxl xlrd cryptography
```
(4) 运行应用:
```bash
streamlit run app.py
```
## 依赖项
列于 `requirements.txt`
```txt
streamlit>=1.20.0
pandas>=1.3.0
numpy>=1.21.0
matplotlib>=3.4.0
plotly>=5.0.0
scikit-learn>=1.0.0
statsmodels>=0.13.0
scipy>=1.7.0
streamlit-autorefresh>=0.1.5
python-dateutil>=2.8.2
pytz>=2021.3
openpyxl>=3.0.9
xlrd>=2.0.1
cryptography>=3.4.7
openai>=2.0.0
```
## 配置参数
- **数据文件**:上传事故数据(`accident_file`)和策略数据(`strategy_file`),格式为 Excel
- **环境变量**(可选):
- `LOG_LEVEL=DEBUG`:启用详细日志
- 示例:`export LOG_LEVEL=DEBUG`Linux/macOS或 `set LOG_LEVEL=DEBUG`Windows
## 输入输出格式
### 输入
- **事故数据 Excel**:需包含 `事故时间`、`所在街道`、`事故类型` 列
- **策略数据 Excel**:需包含 `发布时间`、`交通策略类型` 列
### 输出
- **预测结果**CSV 文件(例如 `arima_forecast.csv`
- **图表**HTML 文件(例如 `overview_series.html`
- **策略推荐**:文本文件(`recommendation.txt`
## 调用示例
运行 Streamlit 应用:
```bash
streamlit run app.py
```
访问 http://localhost:8501上传数据文件并交互分析。
## 常见问题排查
**问题**`ModuleNotFoundError: No module named 'streamlit'`
**解决**:运行 `pip install -r requirements.txt` 或检查 Python 环境
**问题**:数据加载失败
**解决**:确保 Excel 文件格式正确,检查列名是否匹配
**问题**`NameError: name 'strategy_metrics' is not defined`
**解决**:确保 `strategy_metrics` 函数定义在 `app.py` 中,且位于 `run_streamlit_app` 函数内
## 日志分析
- **日志文件**`logs/app.log`(需在代码中配置 logging 模块)
- **查看日志**`tail -f logs/app.log`
- **常见错误**
- `ValueError`:检查输入数据格式
- `ConnectionError`:验证网络连接或文件路径
## 升级说明
- **当前版本**v1.0.0
- **升级步骤**
1. 备份数据和配置文件
2. 拉取最新代码:`git pull origin main`
3. 更新依赖:`pip install -r requirements.txt --upgrade`
4. 重启应用:`streamlit run app.py`
参考 `CHANGELOG.md` 查看版本变更详情。
## 许可证
MIT License - 详见 LICENSE 文件。
[![GitHub license](https://img.shields.io/github/license/tongnian0613/repo)](https://github.com/tongnian0613/TrafficSafeAnalyzer/LICENSE)
[![Build Status](https://img.shields.io/travis/username/repo)](https://travis-ci.org/tongnian0613/repo)

View File

@@ -1 +0,0 @@
建议在全市区域长期实施策略类型 交通管制措施

View File

@@ -1,31 +0,0 @@
# Core dependencies
streamlit>=1.20.0
pandas>=1.3.0
numpy>=1.21.0
matplotlib>=3.4.0
plotly>=5.0.0
scikit-learn>=1.0.0
statsmodels>=0.13.0
# Scientific computing (optional but recommended)
scipy>=1.7.0
# Streamlit extensions (optional)
streamlit-autorefresh>=0.1.5
# Additional utilities
python-dateutil>=2.8.2
pytz>=2021.3
# For data processing
openpyxl>=3.0.9 # For Excel file support
xlrd>=2.0.1 # For older Excel files
# Security/authentication
cryptography>=3.4.7
# OpenAI
openai
# Note: hashlib and json are part of Python standard library
# Note: os and datetime are part of Python standard library

View File

@@ -1,11 +0,0 @@
{
"region": "全市",
"date_range": [
"2022-01-01",
"2022-12-31"
],
"strategy_filter": [],
"rows": 365,
"min_date": "2022-01-01",
"max_date": "2022-12-31"
}

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +0,0 @@
,effect_strength,adaptability,count_effective,severity_effective,safety_state,F1,F2,intervention_date
交通信息预警,-8.965321179202334,-0.7855379968058066,True,False,三级,0.2463091369521552,-1.0318471337579618,2022-01-13
交通整治活动,-2.65100612878524,-1.667254385637472,True,False,三级,0.08411173458110731,-1.7513661202185793,2022-01-11
交通管制措施,-10.70286313762653,0.19010392243197832,True,False,三级,0.2989387495766646,-0.1088348271446863,2022-01-20
政策制度实施,-2.6771799687750018,-5.1316650216481605,True,False,三级,0.07856225107911223,-5.2102272727272725,2022-01-06
1 effect_strength adaptability count_effective severity_effective safety_state F1 F2 intervention_date
2 交通信息预警 -8.965321179202334 -0.7855379968058066 True False 三级 0.2463091369521552 -1.0318471337579618 2022-01-13
3 交通整治活动 -2.65100612878524 -1.667254385637472 True False 三级 0.08411173458110731 -1.7513661202185793 2022-01-11
4 交通管制措施 -10.70286313762653 0.19010392243197832 True False 三级 0.2989387495766646 -0.1088348271446863 2022-01-20
5 政策制度实施 -2.6771799687750018 -5.1316650216481605 True False 三级 0.07856225107911223 -5.2102272727272725 2022-01-06