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

Skip to content

nobugawakof/cgp

Repository files navigation

Child Growth Prediction (CGP)

A modern desktop application for tracking and predicting child growth using WHO standards and advanced algorithms. Built with Vue 3, TypeScript, Vite, and Electron.

Vue 3 TypeScript Electron Vite

✨ Features

Core Features

  • πŸ“Š Growth Tracking - Track height, weight, and other measurements over time
  • πŸ“ˆ Growth Predictions - Predict adult height using WHO standards and mid-parental height calculations
  • πŸ“‰ Percentile Calculations - See where your child ranks compared to WHO growth standards
  • πŸ“± Interactive Charts - Visualize growth trends with ECharts
  • πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦ Multiple Children - Manage multiple child profiles
  • πŸ’Ύ Data Persistence - Local storage with electron-store for desktop, localStorage for web
  • πŸ“€ Export/Import - Backup and restore your data as JSON
  • πŸ–¨οΈ Print Reports - Generate printable growth reports

Technical Features

  • ⚑ Fast Development - Vite for instant HMR
  • πŸ”’ Type Safe - Full TypeScript support
  • πŸ§ͺ Tested - Vitest for unit and component testing
  • 🎨 Beautiful UI - Vant mobile components
  • πŸŒ™ Dark Mode - Theme support
  • πŸ”§ Code Quality - ESLint + Prettier configured

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • npm 9+

Installation

# Clone the repository
git clone https://github.com/nobugawakof/cgp.git
cd cgp

# Install dependencies
npm install

# Start development server (web)
npm run dev

# Start Electron app
npm run electron:dev

Build

# Build for web
npm run build

# Build Electron app
npm run electron:build

πŸ“ Project Structure

cgp/
β”œβ”€β”€ electron/              # Electron main process
β”‚   β”œβ”€β”€ main.ts           # Main entry point
β”‚   └── preload.ts        # Preload scripts
β”œβ”€β”€ public/               # Static assets
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/       # Vue components
β”‚   β”‚   β”œβ”€β”€ ErrorBoundary.vue
β”‚   β”‚   └── GrowthChart.vue
β”‚   β”œβ”€β”€ pages/            # Page components
β”‚   β”‚   β”œβ”€β”€ Dashboard.vue
β”‚   β”‚   β”œβ”€β”€ AddChild.vue
β”‚   β”‚   β”œβ”€β”€ Reports.vue
β”‚   β”‚   └── Settings.vue
β”‚   β”œβ”€β”€ router/           # Vue Router config
β”‚   β”œβ”€β”€ stores/           # Pinia stores
β”‚   β”‚   β”œβ”€β”€ app.ts        # App settings
β”‚   β”‚   β”œβ”€β”€ child.ts      # Child data management
β”‚   β”‚   └── user.ts       # User data
β”‚   β”œβ”€β”€ types/            # TypeScript types
β”‚   β”‚   └── child.ts      # Child-related interfaces
β”‚   β”œβ”€β”€ utils/            # Utility functions
β”‚   β”‚   └── growthPrediction.ts  # Growth algorithms
β”‚   β”œβ”€β”€ App.vue           # Root component
β”‚   └── main.ts           # Vue entry point
β”œβ”€β”€ eslint.config.js      # ESLint configuration
β”œβ”€β”€ .prettierrc           # Prettier configuration
β”œβ”€β”€ vite.config.ts        # Vite configuration
└── package.json

πŸ“– Usage

Adding a Child

  1. Click "Add Child" in the sidebar or the FAB button
  2. Enter child's name, birth date, and gender
  3. Add current height and weight measurements
  4. Optionally add parent heights for better predictions

Tracking Growth

  1. Select a child from the Dashboard
  2. Click "Add New Measurement"
  3. Enter current height and weight
  4. View updated charts and percentiles

Viewing Reports

  1. Go to Reports page
  2. View detailed growth charts
  3. See percentile rankings
  4. Print or share reports

Data Management

  1. Go to Settings
  2. Export data for backup
  3. Import data from backup
  4. Clear all data if needed

πŸ§ͺ Testing

# Run tests
npm run test

# Run tests with UI
npm run test:ui

# Run tests once
npm run test:run

# Coverage report
npm run test:coverage

πŸ› οΈ Development

Available Scripts

Script Description
npm run dev Start Vite dev server
npm run build Build for production
npm run electron:dev Start Electron in dev mode
npm run electron:build Build Electron app
npm run test Run Vitest in watch mode
npm run lint Lint and fix code
npm run format Format code with Prettier
npm run type-check TypeScript type checking

Tech Stack

  • Framework: Vue 3 (Composition API)
  • Language: TypeScript
  • Build Tool: Vite 7
  • Desktop: Electron 39
  • State Management: Pinia
  • Routing: Vue Router (Hash mode for Electron)
  • UI Components: Vant 4
  • Charts: ECharts + vue-echarts
  • Storage: electron-store + localStorage
  • Testing: Vitest + Vue Test Utils
  • Linting: ESLint + Prettier

πŸ“Š Growth Algorithms

Height Percentile Calculation

Based on WHO Child Growth Standards (2006), comparing measurements against reference data for each age and gender.

Adult Height Prediction

Uses two methods:

  1. Mid-Parental Height (MPH): If parent heights are provided

    • Boys: (Father + Mother + 13) / 2
    • Girls: (Father + Mother - 13) / 2
  2. Growth Trajectory: Based on current percentile and expected adult height percentage

BMI Calculation

Standard formula: Weight (kg) / HeightΒ² (mΒ²)

πŸ”’ Security

  • Context isolation enabled
  • Node integration disabled
  • Content Security Policy configured
  • No remote code execution
  • Local data only (no external APIs)

πŸ“ License

MIT License - see LICENSE for details

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

⚠️ Disclaimer

This application is for informational purposes only. Growth predictions are estimates based on statistical models and should not replace professional medical advice. Always consult a healthcare provider for concerns about your child's growth and development.


Made with ❀️ using Vue 3 + Electron

About

Electron + Vue3 + Vant

Resources

Stars

Watchers

Forks

Packages

No packages published