Skip to content

NicolaFerracin/sinus-shield-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sinus Shield

Automated allergic rhinitis management. Checks pollen, air quality, and weather twice daily, evaluates your risk tier, and sends medication protocols via Telegram.

100% deterministic — no AI in the decision engine. Rule-based with adaptive sensitivity learning.

What it does

  • Fetches pollen (grass/tree/weed), PM10/PM2.5 dust levels, wind, and temperature data
  • Evaluates a 3-tier risk level (GREEN / YELLOW / RED)
  • Sends morning medication reminders and evening forecasts via Telegram
  • Learns from your feedback — "bad" days increase sensitivity, sustained good days decay it
  • Detects vasomotor triggers (temperature swings) and dust events (Saharan dust, etc.)
  • Prevents premature de-escalation with hysteresis and lock-in

Quick Start

git clone https://github.com/YOUR_USERNAME/sinus-shield-cli.git
cd sinus-shield-cli
npm install
node src/setup.js   # Interactive setup wizard
node src/cli.js check

What you need

  1. Google Cloud API key with Pollen API + Air Quality API enabled
  2. OpenWeatherMap API key with One Call 3.0 subscription (free tier: 1000 calls/day)
  3. Telegram bot (optional) — create via @BotFather
  4. Your coordinates — find at latlong.net

Customize your protocol

Copy the example and edit with your medications:

cp protocol.example.json protocol.json
{
  "tier1": ["Saline nasal mist as needed."],
  "tier2": [
    "Take Bilastina 20mg NOW (empty stomach).",
    "No food or coffee for 60 minutes."
  ],
  "tier3": [
    "Take Bilastina 20mg NOW (empty stomach).",
    "No food or coffee for 60 minutes.",
    "Evening: RhinoDouche + Budesonida nasal spray.",
    "Wash hair before bed."
  ]
}

Tip: Ask your LLM to help you fill this in:

"I have allergic rhinitis. My doctor prescribed [your medications]. Help me fill in a protocol.json for Sinus Shield with 3 tiers: tier1 (low risk — minimal intervention), tier2 (moderate — antihistamine), tier3 (high — full protocol). Also fill in evening2 and evening3 for evening routines. Output valid JSON."

Deploy on a Raspberry Pi (or any always-on machine)

# Clone and set up
ssh user@your-pi
git clone https://github.com/YOUR_USERNAME/sinus-shield-cli.git ~/sinus-shield-cli
cd ~/sinus-shield-cli
npm install
node src/setup.js

# Test it
node src/cli.js check

# Set up cron jobs
crontab -e

Add these lines:

30 7 * * * cd ~/sinus-shield-cli && /usr/bin/node src/cli.js morning >> ~/sinus-shield-cli/cron.log 2>&1
0 21 * * * cd ~/sinus-shield-cli && /usr/bin/node src/cli.js evening >> ~/sinus-shield-cli/cron.log 2>&1

Telegram bot (interactive feedback)

To run the bot as a background service:

sudo tee /etc/systemd/system/sinus-shield-cli-bot.service > /dev/null << 'EOF'
[Unit]
Description=Sinus Shield Telegram Bot
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=YOUR_USER
WorkingDirectory=/home/YOUR_USER/sinus-shield-cli
ExecStart=/usr/bin/node src/bot.js
Restart=always
RestartSec=10
EnvironmentFile=/home/YOUR_USER/sinus-shield-cli/.env

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable --now sinus-shield-cli-bot

Update

cd ~/sinus-shield-cli && git pull && npm install
sudo systemctl restart sinus-shield-cli-bot  # if using the bot

How the tier engine works

See SYSTEM.md for the full algorithm documentation.

Summary:

Tier Meaning Triggered by
1 GREEN Low risk Pollen score < 2.0, clean air, no temp swings
2 YELLOW Moderate Score 2.0-3.5, or vasomotor trigger, or moderate dust
3 RED High Score >= 3.5, or severe dust, or user feedback "bad"

Key behaviors:

  • Escalates instantly — GREEN can jump to RED in one day
  • De-escalates slowly — max 1 tier drop per day (hysteresis)
  • Locks on RED for 5 days after "bad" feedback
  • Learns — bad days increase pollen sensitivity, 7+ good days decay it

CLI Commands

node src/cli.js morning          # Morning check + notification
node src/cli.js evening          # Evening forecast + notification
node src/cli.js check            # Status check (read-only, no state changes)
node src/cli.js feedback bad     # Record how you feel: great / ok / bad
node src/cli.js history          # Show last 7 days

License

MIT

About

Automated allergic rhinitis management. Checks pollen, air quality, and weather twice daily, evaluates your risk tier, and sends medication protocols via Telegram.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors