Thanks to visit codestin.com
Credit goes to github.com

Skip to content

KrystalRay/KFit

Repository files navigation

KFit - 个人健康分析系统 | Personal Health Analysis System(Health Analysis for Garmin Users with LLMs)

注意:此项目仍在积极开发中,部分功能可能尚未完全实现或可能发生变更。

Note: This project is still under active development. Some features may not be fully implemented or may change.

这个项目旨在创建一个综合性的健康分析系统,通过整合多个数据源(Notion日记中的饮食信息和Garmin的健身数据)并利用大模型API进行智能分析,为用户提供每日健康状况的深入洞察。

This project aims to create a comprehensive health analysis system that integrates multiple data sources (dietary information from Notion diaries and fitness data from Garmin) and uses LLMs for intelligent analysis.

项目结构 | Project Structure

Fit/
── config/                  # 配置文件目录
│   ├── config.py           # 配置加载模块
│   └── config.yaml         # 配置文件
├── modules/                # 核心功能模块
│   ├── notion/             # Notion API交互模块
│   │   ├── __init__.py
│   │   └── notion_client.py
│   ├── garmin/             # Garmin数据获取模块
│   │   ├── __init__.py
│   │   └── garmin_client.py
│   ├── diary/              # 日记文件处理模块
│   │   ├── __init__.py
│   │   ├── diary_parser.py
│   │   └── diary_weekly_analyzer.py
│   ├── analysis/           # 数据分析模块
│   │   ├── __init__.py
│   │   └── analyzer.py
│   └── prompt/             # Prompt模块
│       ├── __init__.py
│       └── prompt_builder.py
├── models/                 # 大模型接口层
│   ├── __init__.py
│   ├── base_model.py
│   ├── openai_model.py
│   ├── claude_model.py
│   └── local_model.py
├── utils/                  # 工具函数
│   ├── __init__.py
│   └── helpers.py
├── cache/                  # 缓存目录
├── output/                 # 输出报告目录
├── main.py                 # 主程序入口
├── UnitTest.py             # 单元测试
├── test_garmin_openai_integration.py # 集成测试
├── requirements.txt        # 项目依赖
└── README.md               

功能模块 | Functional Modules

  1. Notion模块 | Notion Module:负责从Notion API获取用户的日记内容,并提取其中的饮食信息。 Responsible for retrieving diary content from the Notion API and extracting dietary information.

  2. Garmin模块 | Garmin Module:使用python-garminconnect库获取用户的健身数据,包括活动、步数、心率等信息。 Uses the python-garminconnect library to obtain user fitness data, including activities, steps, heart rate, and more.

  3. 日记文件模块 | Diary File Module:直接读取和解析本地日记文件,提取特定日期的饮食信息。 Directly reads and parses local diary files to extract dietary information for specific dates.

  4. 分析模块 | Analysis Module:整合来自Notion、Garmin或日记文件的数据,并调用大模型API进行综合分析。 Integrates data from Notion, Garmin, or diary files and calls large language model APIs for comprehensive analysis.

  5. 大模型接口层 | LLM Interface Layer:提供统一的接口来支持多种大模型(如OpenAI、Claude、本地模型等)。 Provides a unified interface to support various large language models (such as OpenAI, Claude, local models, etc.).

当前开发状态 | Current Development Status

  • ✅ 基础项目结构搭建 | Basic project structure setup
  • ✅ Garmin Connect数据获取 | Garmin Connect data retrieval
  • ✅ 本地日记文件解析 | Local diary file parsing
  • ✅ OpenAI模型接口 | OpenAI model interface
  • ✅ Claude模型接口 | Claude model interface
  • ⚠️ 本地模型接口(部分实现) | Local model interface (partially implemented)
  • ⚠️ 健康数据分析器(开发中) | Health data analyzer (in development)
  • ⚠️ 周报告生成(开发中) | Weekly report generation (in development)
  • ⚠️ Notion API客户端实现 (开发中)| Notion API client implementation
  • ❌ 用户界面(计划中) | User interface (planned)

使用方法 | Usage Instructions

  1. 安装依赖 | Install dependencies:pip install -r requirements.txt
  2. 配置config/config.yaml文件,填入必要的API密钥和配置信息 | Configure the config/config.yaml file with necessary API keys and settings
  3. 运行主程序 | Run the main program:(开发中)
    • 使用Notion和Garmin数据分析 | Using Notion and Garmin data analysis:python main.py
    • 使用日记文件分析 | Using diary file analysis:python main.py --diary
    • 指定分析日期 | Specify analysis date:python main.py --date 2023-01-01
    • 生成周报告 | Generate weekly report:python main.py --weekly

配置说明 | Configuration Guide

config/config.yaml中,你需要配置以下信息 | In config/config.yaml, you need to configure the following information:

  • Notion API密钥和数据库ID | Notion API key and database ID
  • Garmin账号信息 | Garmin account information
  • 选择使用的大模型及其API密钥 | Choose which large language model to use and its API key
  • 其他自定义配置 | Other custom configurations

依赖项 | Dependencies

  • Python 3.8+
  • notion-client
  • python-garminconnect
  • 各大模型的Python SDK(如openai、anthropic等) | Python SDKs for various models (such as openai, anthropic, etc.)
  • PyYAML
  • 其他依赖见requirements.txt | See requirements.txt for other dependencies

测试 | Testing

项目包含单元测试和集成测试,可以通过以下命令运行 | The project includes unit tests and integration tests that can be run with the following commands:

# 运行单元测试 | Run unit tests
python UnitTest.py

# 运行Garmin和OpenAI集成测试 | Run Garmin and OpenAI integration test
python test_garmin_openai_integration.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages