A professional, production-ready application built with Object-Oriented Programming (OOP) in Python and a modern Streamlit frontend. This system demonstrates sustainable management of urban resources including water, energy, and waste with stunning Lottie animations and a professional UI.
- Features
- OOP Principles Demonstrated
- New UI Features
- Project Structure
- Installation
- Running the Application
- Usage Guide
- Class Architecture
- Screenshots
- Academic Submission
- ✅ Abstraction: Base
Resourceclass defines common behavior - ✅ Inheritance:
WaterResource,EnergyResource,WasteResourceextend base class - ✅ Encapsulation: Protected attributes with getter methods
- ✅ Polymorphism: Uniform method calls with custom implementations
- ✅ Error Handling: Robust validation and meaningful error messages
- ✅ Resource Tracking: Real-time usage monitoring and history
- ✅ Consumer Management: Multi-consumer resource assignment and tracking
- ✅ Sustainability Scoring: Automated sustainability metrics
- 🎨 Modern Design: Gradient backgrounds, card layouts, smooth animations
- 🎬 Lottie Animations: Professional animated icons throughout the app
- 📊 Interactive Dashboard: Real-time metrics and visualizations
- 📈 Advanced Charts: Using Plotly for interactive graphs
- 🎯 Resource Management: Add, view, and manage resources
- 👥 Consumer Management: Register and track consumers
- 📉 Consumption Tracking: Log resource usage with validation
- 📋 Comprehensive Reports: Analytics and sustainability insights
⚠️ Smart Alerts: Real-time warnings and recommendations- 🎭 Responsive Design: Professional UI suitable for demos and presentations
- ✨ Smooth Animations: Fade-in, slide, pulse, glow, and bounce effects
- 🌊 Animated Metrics: Eye-catching metric cards with hover effects
- Dashboard Animation: Sustainability Lottie animation on main dashboard
- Resource Management: Water drop animation for resources
- Consumer Management: Analysis animation for consumer tracking
- Consumption Tracking: Energy animation for usage recording
- Reports: Analytics animation for report section
- Sidebar Logo: Animated recycle icon
- Success Celebrations: Party animation on successful actions
- CSS Animations: Fade-in, slide-in, pulse, shimmer, bounce, rotate, and glow effects
class Resource(ABC):
@abstractmethod
def report_usage(self) -> Dict:
"""Each resource type implements its own reporting"""
passclass WaterResource(Resource): # Inherits from Resource
class EnergyResource(Resource): # Inherits from Resource
class WasteResource(Resource): # Inherits from Resourceclass Resource:
def __init__(self, name, total_available, renewable):
self._total_available = total_available # Protected attribute
self._available = total_available # Protected attribute
@property
def available(self): # Getter method
return self._available# Same method, different implementations
water_resource.report_usage() # Returns water-specific report
energy_resource.report_usage() # Returns energy-specific report
waste_resource.report_usage() # Returns waste-specific reportOOP Mini Project/
│
├── resource_management.py # Backend: OOP classes
├── app.py # Frontend: Streamlit UI with animations
├── requirements.txt # Dependencies
├── start.bat # Windows launcher
├── README.md # Documentation
├── UI_IMPROVEMENTS.md # UI feature documentation
├── OOP_DOCUMENTATION.md # OOP concepts documentation
└── DEMO_GUIDE.md # Presentation guide
resource_management.py (Backend)
Resource(Abstract Base Class)WaterResource(Inheritance)EnergyResource(Inheritance)WasteResource(Inheritance)Consumer(Composition)ResourceManager(Orchestration)
app.py (Frontend)
- Dashboard with live metrics and Lottie animations
- Resource management interface with animations
- Consumer management interface
- Consumption tracking with energy animations
- Reports and analytics with visual feedback
- Custom CSS with keyframe animations
- Professional gradient design
- Lottie Animations: Smooth, professional animations throughout the app
- Dashboard: Sustainability animation
- Resources: Water drop animation
- Consumers: Analysis animation
- Consumption: Energy animation
- Reports: Analytics animation
- Sidebar: Animated recycle logo
- Success: Celebration animation
- Fade In Up: Smooth entry animations for content
- Slide In Right: Header animations
- Pulse: Button hover effects
- Shimmer: Loading states
- Bounce: Interactive elements
- Rotate: Icon animations
- Glow: Card hover effects with pulsing shadows
- 3.5rem large metric displays
- Gradient backgrounds throughout
- Smooth transitions on all interactive elements
- Shadow effects with depth
- Hover states on all cards and tables
- Color-coded status indicators (🟢🟡🟠🔴)
- Professional typography with Inter font family
- Responsive layout with proper spacing
- Animated metric cards with hover effects
- Progress bars with gradient fills
- Tables with zebra striping and hover scaling
- Buttons with pulse animations
- Expandable cards with smooth transitions
- Tabs with gradient active states
- Python 3.8 or higher
- pip (Python package installer)
- Internet connection (for Lottie animations)
Download this project to your local machine.
Open terminal/command prompt in the project directory and run:
pip install -r requirements.txtThis will install:
streamlit- Web frameworkpandas- Data manipulationplotly- Interactive chartsstreamlit-lottie- Lottie animationsrequests- HTTP library for loading animations
- Open terminal/command prompt
- Navigate to project directory:
cd "path/to/OOP Mini Project"
- Run the application:
streamlit run app.py
- The app will open in your default browser at
http://localhost:8501
Double-click start.bat to launch the application automatically.
python -m streamlit run app.pyPress Ctrl + C in the terminal to stop the server.
- View system overview
- Monitor total resources and consumers
- Check sustainability score
- Review alerts and recommendations
- View Resources: See all available resources with status
- Add New Resource:
- Select type (Water/Energy/Waste)
- Enter name and capacity
- Mark as renewable or non-renewable
- Add type-specific attributes
- View Consumers: See all registered consumers and their usage
- Add New Consumer:
- Enter Consumer ID and Name
- Select consumer type
- Assign resources
- Select a consumer
- Choose a resource
- Enter usage amount
- System validates availability
- Records transaction
- Resource Analytics: Usage charts and comparisons
- Consumer Analytics: Activity tracking
- Sustainability:
- Sustainability score gauge
- Carbon footprint calculation
- Recommendations
Resource (ABC)
|
+----------------+------------------+
| | |
WaterResource EnergyResource WasteResource
Consumer (Uses resources)
ResourceManager (Orchestrates everything)
- Attributes:
name,_total_available,_available,renewable - Methods:
update_availability(amount)- Encapsulationreport_usage()- Polymorphism (abstract)get_status()- Common behavior
- Additional:
water_type,unit - Methods:
report_usage()- Water-specific implementationcheck_contamination_risk()- Water-specific
- Additional:
energy_type,unit - Methods:
report_usage()- Energy-specific implementationcalculate_carbon_footprint()- Energy-specific
- Additional:
waste_type,unit - Methods:
report_usage()- Waste-specific implementationget_recycling_rate()- Waste-specific
- Attributes:
consumer_id,name,_assigned_resources,_usage_log - Methods:
assign_resource(resource)- Compositionuse_resource(resource_name, amount)- Transactiongenerate_usage_report()- Analytics
- Orchestrates: All resources and consumers
- Methods:
add_resource(),add_consumer()generate_system_report()calculate_sustainability_score()get_sustainability_recommendations()
The application comes with pre-loaded demo data:
Resources:
- City Water Supply (100,000 liters, Renewable)
- Rainwater Harvesting (50,000 liters, Renewable)
- Solar Power (50,000 kWh, Renewable)
- Grid Electricity (100,000 kWh, Non-Renewable)
- Recyclable Waste (20,000 kg)
- Organic Waste (15,000 kg)
Consumers:
- Residential Complex A (C001)
- Commercial Building B (C002)
- Industrial Park C (C003)
Sample Transactions:
- Pre-simulated usage for demonstration
-
Introduction
- Problem statement
- Objectives
- Scope
-
OOP Concepts
- Abstraction (with code examples)
- Inheritance (class hierarchy diagram)
- Encapsulation (protected attributes)
- Polymorphism (method overriding)
-
System Design
- Class diagrams
- Architecture overview
- Database/state management
-
Implementation
- Code walkthrough
- Key features
- Error handling
-
Testing
- Test cases
- Screenshots
- Demo scenarios
-
Conclusion
- Achievements
- Learning outcomes
- Future enhancements
- Start with Dashboard: Show live metrics
- Add a Resource: Demonstrate modularity
- Add a Consumer: Show composition
- Record Usage: Show validation and error handling
- Show Reports: Highlight analytics
- Explain Code: Walk through key OOP concepts
Edit the CSS in app.py under load_custom_css():
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);- Create new class inheriting from
Resource - Override
report_usage()method - Add type-specific methods
- Update UI in
app.py
Edit load_demo_data() function in app.py
Solution: Ensure all dependencies are installed:
pip install -r requirements.txtSolution: Use a different port:
streamlit run app.py --server.port 8502Solution: This is normal - refresh resets demo data. Use the "Reset Demo Data" button.
- Push code to GitHub repository
- Go to streamlit.io/cloud
- Sign in with GitHub
- Select your repository
- Click "Deploy"
Your app will be live at: https://your-app-name.streamlit.app
This project is created for educational purposes. Feel free to use and modify for academic submissions.
Pranav Kadam
- Project: OOP Mini Project
- Technology: Python, Streamlit, OOP
- Date: February 2026
- Python Software Foundation
- Streamlit Community
- Plotly for visualization tools
For questions or issues:
- Check this README
- Review code comments
- Test with demo data
- Check Streamlit documentation
- ✅ Abstraction implemented
- ✅ Inheritance demonstrated
- ✅ Encapsulation enforced
- ✅ Polymorphism showcased
- ✅ Error handling included
- ✅ Professional UI design
- ✅ Interactive charts
- ✅ Real-time validation
- ✅ Comprehensive documentation
- ✅ Demo data included
- ✅ Production-ready code
Happy Coding! 🚀