A full-stack property data management system with a multi-user upload portal and a real-time admin dashboard β powered by Flask, MongoDB Atlas, and Chart.js.
- Overview
- Features
- Tech Stack
- Project Structure
- Getting Started
- Environment Variables
- API Reference
- Deployment (Render)
- Screenshots
Sinhas GmbH is a web-based data management platform built for managing Swiss property (apartment) records. It provides two distinct interfaces:
-
User Portal (
/) β A clean, professional SaaS-style interface for data entry teams to upload Excel/CSV files in bulk, run structured ETL jobs, or manually enter individual property records directly into MongoDB. -
Admin Dashboard (
/admin) β A real-time analytics and data management panel for administrators to view charts, browse all MongoDB collections, search/filter records, and perform inline edits.
| Feature | Description |
|---|---|
| Bulk Upload | Upload any .xlsx or .csv file; each sheet becomes a MongoDB collection |
| Occupancy ETL | Upload the master OCCUPANCY Excel file; auto-parses into structured cities, buildings, and apartments collections |
| Manual Entry | Form-based single record insertion with all key property fields matching MongoDB schema |
| Drag & Drop | Drag and drop files directly onto the upload zones |
| Feature | Description |
|---|---|
| KPI Cards | Real-time counts β Total Properties, Occupied, Available, Buildings |
| 4 Live Charts | Occupancy donut, Properties by City bar, System Overview bar, Apartments pie β all via Chart.js |
| Dynamic Sidebar | Auto-fetches all MongoDB collections; click any to browse its data |
| Data Table | Paginated, searchable table for any collection with configurable row limit |
| Load All Data | One-click button to fetch all records from the active collection |
| Inline Edit | Click "Edit" on any row to open a field-level modal and save changes to MongoDB |
| Layer | Technology |
|---|---|
| Backend | Python 3.11, Flask 3.0 |
| Database | MongoDB Atlas (PyMongo 4.6) |
| Data Processing | Pandas 2.2, OpenPyXL 3.1 |
| Frontend | Vanilla HTML, CSS, JavaScript |
| Charts | Chart.js (CDN) |
| Server (Prod) | Gunicorn 21.2 |
| Deployment | Render (via render.yaml) |
| Fonts | Google Fonts β Inter |
sinhasgmbh/
β
βββ app.py # Flask application & all API routes
βββ index.html # User Portal β upload & manual entry UI
βββ admin.html # Admin Dashboard β charts, tables, edit modal
β
βββ requirements.txt # Python dependencies
βββ render.yaml # Render deployment configuration
βββ .env # Local environment variables (git-ignored)
βββ .gitignore
β
βββ migrate_keys.py # DB migration script (sanitizes field names)
βββ import_from_excel.py # Standalone ETL script (CLI)
βββ upload_apartments.py # CLI uploader for apartment records
βββ upload_flat.py # CLI uploader for flat records
βββ analyze_excel.py # Analysis/inspection utility for sheets
βββ test_mongo.py # MongoDB connection test script
βββ test_server.py # Flask server endpoint test script
- Python 3.10+ installed
- A MongoDB Atlas account with a cluster
- Git
git clone https://github.com/deba2k5/sinhasrealty.git
cd sinhasrealty# Windows
python -m venv .venv
.venv\Scripts\activate
# macOS / Linux
python -m venv .venv
source .venv/bin/activatepip install -r requirements.txtCreate a .env file in the project root:
MONGO_URI=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/?appName=<app>See Environment Variables for details.
python app.pyOpen your browser at:
- User Portal:
http://localhost:5000/ - Admin Dashboard:
http://localhost:5000/admin
| Variable | Required | Description |
|---|---|---|
MONGO_URI |
β Yes | Full MongoDB Atlas connection string with credentials |
The app falls back to a default URI if MONGO_URI is not set, but it is strongly recommended to set it via .env for local development and via the hosting provider's environment settings for production.
All API endpoints return JSON.
| Method | Endpoint | Description |
|---|---|---|
POST |
/upload |
Bulk upload any Excel or CSV file to MongoDB |
POST |
/upload_occupancy |
ETL upload β parses Occupancy Excel into Cities/Buildings/Apartments |
POST |
/add_city |
Insert a single city record into the cities collection |
POST |
/add_property |
Insert a single record into the database |
| Method | Endpoint | Description |
|---|---|---|
GET |
/admin |
Serve the Admin Dashboard HTML page |
GET |
/api/collections |
List all MongoDB collection names |
GET |
/api/data/<collection> |
Paginated, searchable data from a collection |
POST |
/api/update/<collection>/<doc_id> |
Update a single document by _id |
GET |
/api/stats |
Aggregated stats for KPI cards and charts |
GET |
/download_csv?collection=<name> |
Export any collection as a downloadable CSV |
| Param | Type | Default | Description |
|---|---|---|---|
page |
int | 1 |
Page number |
limit |
int | 50 |
Records per page (9999 = load all) |
search |
string | "" |
Case-insensitive search across all string fields |
The project is pre-configured for Render via render.yaml.
-
Push to GitHub
-
Create a Render Account at render.com
-
New Web Service β Connect your GitHub repo
deba2k5/sinhasrealty -
Render will auto-detect
render.yaml. Confirm these settings:- Environment: Python
- Build Command:
pip install -r requirements.txt - Start Command:
gunicorn app:app
-
Add Environment Variable in the Render dashboard:
- Key:
MONGO_URI - Value: (your MongoDB Atlas connection string)
- Key:
-
Click "Deploy" β your app will be live at:
https://sinhasgmbh.onrender.com
| Field | Type | Description |
|---|---|---|
Apartment Address |
String | Street name of the apartment |
City |
String | City name |
Floor |
Number | Floor number |
POSITION |
String | Unit position (Left / Right / Center) |
Apartment SQMT |
Number | Apartment size in square meters |
NO OF ROOMS |
Number | Number of rooms (e.g. 3.5) |
AWN NO |
Number | Internal AWN reference number |
INDIV / SHR |
String | Occupancy type (Family / Sharing / Individual) |
Status |
String | Occupancy status (OCCUPIED / AVAILABLE) |
Debangshu β github.com/deba2k5
This project is proprietary software developed for Sinhas GmbH. All rights reserved.