|
| 1 | +# Creating Analysis Applications with AI |
| 2 | + |
| 3 | +In this guide, you'll use AI-powered Copilot Chat to build interactive Python applications with user interfaces for exploring and analyzing ASAM ODS data. This extends the notebook-based workflows into standalone tools. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +This playground demonstrates: |
| 8 | +- Designing application architecture with AI |
| 9 | +- Generating complete Python applications with UI frameworks |
| 10 | +- Creating interactive dashboards and data exploration tools |
| 11 | +- Deploying applications for team use |
| 12 | + |
| 13 | +**Time to complete:** 30-45 minutes |
| 14 | + |
| 15 | +## Recommended Frameworks |
| 16 | + |
| 17 | +For interactive applications, consider these frameworks: |
| 18 | + |
| 19 | +- **Streamlit** — Simple, rapid UI development with Python (recommended for beginners) |
| 20 | +- **Dash** — More advanced dashboards and web applications |
| 21 | +- **PyQt / Tkinter** — Desktop applications with rich UI |
| 22 | + |
| 23 | +This guide focuses on **Streamlit** for its ease of use. |
| 24 | + |
| 25 | +## Step 1: Define Your Application |
| 26 | + |
| 27 | +Determine what your application should do. Examples: |
| 28 | + |
| 29 | +- **Data Explorer** — Browse measurements, filter by criteria, view details |
| 30 | +- **Dashboard** — Real-time monitoring of measurement values |
| 31 | +- **Analysis Tool** — Run analysis workflows with user-configurable parameters |
| 32 | +- **Report Generator** — Create PDF reports from selected data |
| 33 | + |
| 34 | +## Step 2: Ask Copilot to Design the Application |
| 35 | + |
| 36 | +In Copilot Chat, describe your application: |
| 37 | + |
| 38 | +``` |
| 39 | +I want to build a Streamlit application that lets users: |
| 40 | +1. Connect to an ASAM ODS server |
| 41 | +2. Browse measurements from a selected test |
| 42 | +3. View temperature data with a line chart |
| 43 | +4. Compare measurements side-by-side |
| 44 | +``` |
| 45 | + |
| 46 | +Copilot will: |
| 47 | +1. Ask clarifying questions about UI layout and features |
| 48 | +2. Suggest library choices (Streamlit, Dash, etc.) |
| 49 | +3. Outline application structure |
| 50 | +4. Generate complete code |
| 51 | + |
| 52 | +## Step 3: Generate and run Application Code |
| 53 | + |
| 54 | +Copilot will create a Streamlit application structure. |
| 55 | +Launch the application: |
| 56 | + |
| 57 | +```bash |
| 58 | +streamlit run app.py |
| 59 | +``` |
| 60 | + |
| 61 | +Streamlit will: |
| 62 | +- Start a local development server (usually `http://localhost:8501`) |
| 63 | +- Open your application in the default browser |
| 64 | +- Auto-reload on code changes |
| 65 | + |
| 66 | +## Step 4: Test and Refine |
| 67 | + |
| 68 | +Interact with your application: |
| 69 | +1. **Test all features** — Connect, browse data, create charts |
| 70 | +2. **Identify issues** — Note any bugs or missing functionality |
| 71 | +3. **Ask Copilot for improvements** — Request UI enhancements or new features |
| 72 | + |
| 73 | +Example refinement requests: |
| 74 | + |
| 75 | +``` |
| 76 | +Add a date range picker to filter measurements |
| 77 | +``` |
| 78 | + |
| 79 | +``` |
| 80 | +Create a comparison view to display two measurements side-by-side |
| 81 | +``` |
| 82 | + |
| 83 | +``` |
| 84 | +Add statistics (mean, max, min, std dev) below the chart |
| 85 | +``` |
| 86 | + |
| 87 | +``` |
| 88 | +Add login functionality to control data access |
| 89 | +``` |
| 90 | + |
| 91 | +## Tips & Best Practices |
| 92 | + |
| 93 | +1. **Start small** — Create a minimal working app, then add features |
| 94 | +2. **Use session state** — Streamlit sessions persist UI state |
| 95 | +3. **Cache expensive operations** — Use `@st.cache_data` to avoid recomputing |
| 96 | +4. **Validate inputs** — Check user inputs before querying ASAM ODS server |
| 97 | +5. **Handle errors gracefully** — Show user-friendly error messages |
| 98 | +6. **Document code** — Add comments and docstrings |
| 99 | +7. **Test thoroughly** — Verify all user interactions |
| 100 | + |
| 101 | +## Next Steps |
| 102 | + |
| 103 | +- **Learn more Streamlit** — Visit [Streamlit documentation](https://docs.streamlit.io/) |
| 104 | +- **Advanced ODS queries** — Review [odsbox-jaquel-mcp](https://github.com/totonga/odsbox-jaquel-mcp) documentation |
| 105 | +- **Share your app** — Deploy and share with your team |
| 106 | +- **Extend functionality** — Add databases, APIs, or other integrations |
| 107 | + |
| 108 | +--- |
| 109 | + |
| 110 | +**Congratulations!** You've completed the AI playground series. You now have skills to: |
| 111 | +- Explore ASAM ODS data interactively |
| 112 | +- Generate analysis notebooks with AI |
| 113 | +- Build standalone applications |
| 114 | + |
| 115 | +**Next steps:** Explore the [odsbox-jaquel-mcp GitHub](https://github.com/totonga/odsbox-jaquel-mcp) for advanced techniques and the [MCP Playground](https://github.com/peak-solution/asam_ods_mcp_playground) for more examples. |
0 commit comments