https://github.com/bbartling/building-power-model-api
Generic docker container for a building electrical power for use with a Niagara BAS and Java ProgramObject
https://github.com/bbartling/building-power-model-api
Last synced: 8 months ago
JSON representation
Generic docker container for a building electrical power for use with a Niagara BAS and Java ProgramObject
- Host: GitHub
- URL: https://github.com/bbartling/building-power-model-api
- Owner: bbartling
- License: mit
- Created: 2025-10-25T13:18:54.000Z (8 months ago)
- Default Branch: develop
- Last Pushed: 2025-10-25T20:12:11.000Z (8 months ago)
- Last Synced: 2025-10-25T22:13:21.670Z (8 months ago)
- Language: Jupyter Notebook
- Size: 14.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# building-power-model-api
Generic docker container for a building electrical power for use with a Niagara BAS and Java ProgramObject
## 1. Build the Image
From the directory that contains your `Dockerfile`:
```bash
# Build and tag the image
docker build -t building-power-model-api:latest .
docker run -d --name building-power-model -p 8000:8000 building-power-model-api:latest
```
## 2. Build the Image
💡 The app will now be live at
[`http://127.0.0.1:8000`](http://127.0.0.1:8000)
Check it with:
### Health Route
Linux Bash
```bash
curl http://127.0.0.1:8000/health
```
Windows Poweshell
```powershell
Invoke-WebRequest -Uri "http://127.0.0.1:8000/health" | Select-Object -ExpandProperty Content
```
### Info Route
Linux Bash
```bash
curl http://127.0.0.1:8000/info
```
Windows Poweshell
```powershell
Invoke-WebRequest -Uri "http://127.0.0.1:8000/info" | Select-Object -ExpandProperty Content
```
### Predict Route
Linux Bash
```bash
curl -X POST http://127.0.0.1:8000/predict_power \
-H "Content-Type: application/json" \
-d '{
"oat_f": 92.5,
"rh_pct": 68.0,
"solar_wft2": 75.0,
"timestamp_ms": 1730150400000
}'
```
Windows Poweshell
```powershell
$payload = @{
oat_f = 95.0
rh_pct = 60.0
hour_of_day = 15
day_of_week = 2
timestamp_ms = [int64]([datetimeoffset]::UtcNow.ToUnixTimeMilliseconds())
} | ConvertTo-Json
Invoke-RestMethod -Uri "http://127.0.0.1:8000/predict_power" `
-Method Post `
-ContentType "application/json" `
-Body $payload | ConvertTo-Json -Depth 4
```
## Rebuild and Redeploy Commands
If you changed code in `app.py` or `requirements.txt`, do this:
```bash
docker rm -f building-power-model
docker build -t building-power-model-api:latest .
docker run -d --name building-power-model -p 8000:8000 building-power-model-api:latest
```
---
## Docker maintence commands
```bash
# List running containers
docker ps
# List all containers (even stopped)
docker ps -a
# List all images
docker images
# Clean Up System-Wide
docker system prune -a --volumes -f
```
---
## 🏗️ 9. Example “dev loop” workflow
```bash
# edit app.py
docker stop building-power-model
docker rm building-power-model
docker build -t building-power-model-api:latest .
docker run -d --name building-power-model -p 8000:8000 building-power-model-api:latest
docker logs -f building-power-model
```
---