Application Development Tutorial
Learn to create HHW Brick analytics applications through hands-on, step-by-step tutorials.
Tutorial Structure¶
This tutorial is divided into logical steps, each focusing on one aspect of application development.
📚 Tutorial Steps¶
| Step | Topic | Time | Difficulty |
|---|---|---|---|
| Step 1 | Create Application Structure | 10 min | ⭐ Easy |
| Step 2 | Write load_config Function | 15 min | ⭐ Easy |
| Step 3 | SPARQL Query & qualify Function | 30 min | ⭐⭐ Medium |
| Step 4 | analyze Function - Data Loading | 20 min | ⭐⭐ Medium |
| Step 5 | analyze Function - Analysis Logic | 25 min | ⭐⭐ Medium |
| Step 6 | Matplotlib Visualization | 20 min | ⭐⭐ Medium |
| Step 7 | Plotly HTML Visualization | 30 min | ⭐⭐⭐ Advanced |
| Step 8 | Testing Your Application | 20 min | ⭐⭐ Medium |
| Step 9 | Deployment & Integration | 15 min | ⭐ Easy |
Total Time: ~3 hours
What You'll Build¶
By the end of this tutorial, you'll have built a complete analytics application that:
✅ Qualifies buildings based on required sensors
✅ Analyzes time-series data from Brick models
✅ Generates statistical reports
✅ Creates visualizations (PNG and interactive HTML)
✅ Integrates with the HHW Brick framework
Prerequisites¶
Required Knowledge¶
- Python Basics: Variables, functions, file I/O
- Command Line: Navigate directories, run Python scripts
- YAML: Basic configuration file syntax
Note: No prior experience with Brick Schema or SPARQL needed - we'll teach you!
Software Requirements¶
# Python 3.8 or higher
python --version
# HHW Brick package installed
pip install -e /path/to/HHW_brick
# Or install dependencies
pip install pandas numpy matplotlib seaborn plotly rdflib brickschema pyyaml
Tutorial Learning Path¶
🎯 Path 1: Quick Start (Minimum Viable App)¶
Build a working app as fast as possible:
- Step 1 - Structure
- Step 2 - Config loading
- Step 3 - Qualification
- Step 4 - Basic analysis
- Step 8 - Test it
Time: ~1.5 hours
Result: Working application with basic functionality
🎓 Path 2: Complete Tutorial (Recommended)¶
Follow all steps for full understanding:
1-9 in order
Time: ~3 hours
Result: Production-ready application with all features
🚀 Path 3: Advanced (Custom Applications)¶
After completing the tutorial:
- Modify existing applications
- Create complex SPARQL queries
- Implement custom analytics
- Add advanced visualizations
Application Example¶
Here's what you'll build - a temperature differential analysis app:
Input: - Brick model (.ttl file) with temperature sensors - Time-series data (.csv file) with sensor readings
Process: 1. Check if building has supply and return temperature sensors 2. Load and map sensor data 3. Calculate temperature differential 4. Compute statistics (mean, std, range, etc.) 5. Generate visualizations
Output: - CSV files with statistics and processed data - PNG plots (timeseries, histograms, heatmaps) - Interactive HTML dashboards
See it in action: hhw_brick/applications/secondary_loop_temp_diff/
How to Use This Tutorial¶
Each step follows this structure:
- Goal: What you'll accomplish
- Code: Copy-paste ready code snippets
- Explanation: Understanding what the code does
- Test: Verify your implementation works
- Checkpoint: Ensure you're ready for the next step
Icons Used:
- 💡 Tip: Helpful suggestions
- ⚠️ Warning: Common pitfalls
- 📚 Resource: External learning materials
- ✅ Best Practice: Recommended approaches
Getting Help¶
If code doesn't work:
- Check the Common Issues section in each step
- Compare with example applications in
hhw_brick/applications/ - Run the test scripts provided
Resources:
Example Applications¶
Study these working applications in hhw_brick/applications/ for reference:
secondary_loop_temp_diff (⭐⭐ Medium):
- Simple SPARQL query
- Basic statistical analysis
- Standard visualization patterns
primary_loop_temp_diff (⭐⭐ Medium): - Filtered SPARQL queries - Anomaly detection - Multiple visualization types
Tips for Success¶
✅ Do's¶
- Read the explanations: Don't just copy code, understand it
- Run tests frequently: Catch errors early
- Start simple: Get basics working before adding features
- Study examples: Look at existing applications
- Use version control: Git commit after each step
❌ Don'ts¶
- Don't skip steps: Each builds on the previous
- Don't ignore errors: Fix them before proceeding
- Don't customize prematurely: Finish tutorial first, then customize
- Don't skip testing: Tests ensure your code works
- Don't forget documentation: Update README as you go
After Completing the Tutorial¶
Next Steps¶
- Customize: Modify your app for specific use cases
- Create new apps: Build applications for different analyses
- Contribute: Share your applications with the community
- Advanced topics: Explore complex SPARQL, custom analytics
Share Your Work¶
- Submit pull requests to add your app to HHW Brick
- Write blog posts about your application
- Help others in GitHub Issues
Ready to Start?¶
🚀 Let's build your first HHW Brick application!
👉 Begin with Step 1: Create Application Structure