πŸ—οΈ CRCC Construction Intelligence Hub β€” Self-Hosted

Fully automated AI-powered email processing for construction project management.

Built for China Railway 18th Bureau Group (CRCC) β€’ DSC Hotel (G+8) β€’ Dubai Studio City

⚑ What It Does

Runs 24/7 on your machine. Automatically:

  1. Connects to your IMAP mail server (imap.cr18gdubai.cn)
  2. Fetches new unread emails every 60 seconds
  3. Extracts attachments (PDFs, images, documents)
  4. Sends everything to Google Gemini 3 Flash Preview for AI analysis
  5. Extracts: document type, reference number, status, consultant comments, action required
  6. Stores structured data in a database
  7. Shows a live dashboard with charts, filters, search, and CSV/Excel export

Zero manual intervention required.


πŸš€ Quick Start (3 Minutes)

Prerequisites

Step 1: Download

git clone https://huggingface.co/Ultronprime/crcc-construction-hub-docker
cd crcc-construction-hub-docker

Step 2: Configure

cp .env.template .env

Edit .env with your actual credentials:

IMAP_HOST=imap.cr18gdubai.cn
IMAP_PORT=993
IMAP_USER=mohammad.jamzith@cr18gdubai.cn
IMAP_PASSWORD=your_actual_password
GOOGLE_API_KEY=your_gemini_api_key

Step 3: Run

docker compose up -d

Done! Open http://localhost:8501 β€” the system is now monitoring your inbox.


πŸ“§ Email Server Compatibility

This app uses the exact same settings as your email client:

Setting Value
Protocol IMAP4
Host imap.cr18gdubai.cn
Port 993
Security TLS on special port (IMAP SSL)
Auth Login/Password

πŸ€– AI Model

Hardcoded: gemini-3-flash-preview

This model supports:

  • Multimodal input (text + PDFs + images simultaneously)
  • 1M+ token context window (handles large documents)
  • Structured JSON output with schema enforcement
  • Cost-efficient for high-volume processing

πŸ“ Project Structure

crcc-construction-hub-docker/
β”œβ”€β”€ app.py                  # Streamlit dashboard + controls
β”œβ”€β”€ modules/
β”‚   β”œβ”€β”€ database.py         # SQLite persistence layer
β”‚   β”œβ”€β”€ email_fetcher.py    # IMAP client + attachment extraction
β”‚   β”œβ”€β”€ gemini_processor.py # Gemini AI structured extraction
β”‚   └── pipeline.py         # Orchestration (fetch β†’ AI β†’ store)
β”œβ”€β”€ docker-compose.yml      # One-command deployment
β”œβ”€β”€ Dockerfile              # Container definition
β”œβ”€β”€ requirements.txt        # Python dependencies
β”œβ”€β”€ .env.template           # Configuration template
└── data/                   # Persistent storage (auto-created)
    β”œβ”€β”€ construction_hub.db # SQLite database
    └── attachments/        # Downloaded email attachments

βš™οΈ Configuration

All settings via .env file:

Variable Default Description
IMAP_HOST imap.cr18gdubai.cn Mail server
IMAP_PORT 993 IMAP SSL port
IMAP_USER β€” Your email address
IMAP_PASSWORD β€” Your email password
GOOGLE_API_KEY β€” Gemini API key
EMAIL_CHECK_INTERVAL 60 Seconds between checks
AUTO_START_POLLING true Start monitoring on app launch
MAX_ATTACHMENT_SIZE_MB 50 Skip files larger than this
LOG_LEVEL INFO Logging verbosity

πŸ–₯️ Dashboard Features

  • πŸ“Š Dashboard β€” KPI metrics, charts by type/status/discipline, activity timeline
  • πŸ“‹ Documents β€” Sortable/filterable table, detail view with AI summary
  • πŸ” Search β€” Full-text search across all fields
  • ⬇️ Export β€” CSV and Excel download for management meetings
  • βš™οΈ Settings β€” Test connections, view system status

πŸ”„ Commands

# Start (background)
docker compose up -d

# View logs
docker compose logs -f

# Stop
docker compose down

# Restart (after .env changes)
docker compose restart

# Update (pull latest)
git pull && docker compose up -d --build

πŸ›‘οΈ Data Persistence

Your data survives container restarts:

  • ./data/construction_hub.db β€” All processed emails and AI results
  • ./data/attachments/ β€” Downloaded email attachments

To backup: just copy the data/ folder.


❓ Why Self-Hosted (Not Cloud)?

Your email server imap.cr18gdubai.cn is on a private network. Cloud platforms (HF Spaces, AWS Lambda, etc.) cannot reach it because:

  • Port 993 is blocked by cloud egress firewalls
  • The server may only accept connections from known IPs

Self-hosting on your office PC/server = direct network access to your mail server = full automation works.


πŸ› Troubleshooting

Issue Fix
Can't connect to IMAP Check VPN is active, verify credentials in .env
Gemini API 429 Increase EMAIL_CHECK_INTERVAL to 120+ seconds
Container keeps restarting Run docker compose logs to see the error
No emails processed Check if emails are marked as read already
Want to reprocess old emails Mark emails as unread in your mail client

πŸ“„ License

Internal tool for CRCC. Not for distribution.

Generated by ML Intern

This model repository was generated by ML Intern, an agent for machine learning research and development on the Hugging Face Hub.

Usage

from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "Ultronprime/crcc-construction-hub-docker"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)

For non-causal architectures, replace AutoModelForCausalLM with the appropriate AutoModel class.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support