Files
zpark-ems/README.md

172 lines
4.0 KiB
Markdown
Raw Normal View History

# Z-Park Medical Device Hub EMS (zpark-ems)
> Z-Park Medical Device Hub Smart Energy Management System
**Current Version: 1.2.0** | Core: 1.1.0 | See `VERSIONS.json`
Customer project for Z-Park Medical Device Hub (中关村医疗器械园), built on [ems-core](http://100.69.143.96:3300/tianpu/ems-core).
---
## Park Characteristics
- PV-focused: 4,561 solar panels across 22+ buildings
- Sungrow string inverters: AP101-AP208, 10 units
- DC combiner boxes: 49 units
- Data collection: Sungrow iSolarCloud API
---
## Directory Structure
```
zpark-ems/
+-- core/ # EMS core (git subtree, DO NOT modify directly)
+-- frontend/ # Customer frontend (React/TypeScript)
| +-- src/ # React source code
| +-- Dockerfile # Frontend container
| +-- package.json
| +-- vite.config.ts
+-- customers/zpark/ # Customer configuration
| +-- config.yaml # Branding and feature flags
| +-- devices.json # Sungrow inverter & combiner box inventory
| +-- pricing.json # Beijing C&I time-of-use pricing
| +-- hooks/ # Customer hooks plugin (zpark_hooks.py)
+-- scripts/ # Data seeding scripts
| +-- seed_zpark.py # Z-Park seed data
+-- docker-compose.override.yml # Customer Docker overrides
+-- docker-compose.ports.yml # Port configuration
+-- VERSIONS.json # Version tracking
+-- .env.example # Environment variables template (incl. Sungrow API)
```
---
## Quick Start (Docker)
```bash
# Configure environment
cp .env.example .env
# Edit .env — fill in Sungrow iSolarCloud API credentials
# Start all services
docker compose -f core/docker-compose.yml -f docker-compose.override.yml up -d
# Seed data
docker compose -f core/docker-compose.yml -f docker-compose.override.yml exec backend python scripts/seed_zpark.py
```
### Access
| Service | URL |
|---------|-----|
| Frontend | http://localhost:3000 |
| Backend API | http://localhost:8000 |
| API Docs | http://localhost:8000/docs |
### Default Login
| Role | Username | Password |
|------|----------|----------|
| Admin | admin | admin123 |
---
## Local Development
### Backend
```bash
cd core/backend
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
python -m alembic upgrade head
uvicorn app.main:app --port 8000 --reload
```
### Frontend
```bash
cd frontend
npm install
npm run dev
# Opens at http://localhost:3000, proxies /api to localhost:8000
```
---
## Sungrow API Configuration
Fill in Sungrow iSolarCloud API credentials in `.env`, then set `USE_SIMULATOR=false` to connect to real data.
---
## Updating Core
When ems-core releases a new version:
```bash
git subtree pull --prefix=core ems-core main --squash
```
Make sure the `ems-core` remote is configured:
```bash
git remote add ems-core http://100.69.143.96:3300/tianpu/ems-core.git
```
After pulling, update `core_version` in `VERSIONS.json`.
---
## Version Management
### Releasing a New Version
```bash
# 1. Update VERSIONS.json (project_version, last_updated, notes)
# 2. Commit
git add VERSIONS.json
git commit -m "chore: bump version to vX.Y.Z"
# 3. Tag (MUST be after VERSIONS.json update)
git tag -a vX.Y.Z -m "vX.Y.Z: release description"
# 4. Push commit + tag
git push origin main
git push origin vX.Y.Z
# 5. Update Gitea description (Settings page or API)
```
Version must match in all three places: `VERSIONS.json`, git tag, and Gitea description.
### Download / Switch to an Older Version
```bash
# List all versions
git tag -l
# Switch to a specific version
git checkout v1.1.0
# Compare versions
git diff v1.1.0 v1.2.0
# Download as zip (no clone needed)
curl -o zpark-ems-v1.1.0.zip \
"http://100.69.143.96:3300/tianpu/zpark-ems/archive/v1.1.0.zip"
# Go back to latest
git checkout main
```
See [ems-core README](http://100.69.143.96:3300/tianpu/ems-core) for the full version management guide.
---
## License
Copyright 2026. All rights reserved.