How kennethsaita-sudo/afyaplus-week7-cost-optimised works
AfyaPlus Week 7 provides a basic FastAPI service, an optimized triage route with caching and duplicate-request coalescing, and a separate MCP clinic-directory service. The principal triage workflow accepts a patient message and returns routing guidance; clinic search and details are a distinct capability. The sampled main.py does not mount the optimized router, so the graph shows it as a separate route module rather than claiming it is reachable through the main app. The clinic data is read from JSON; other wiring is limited to the sampled source.
Main entry points: week7_routes.py Optimized triage · server.py MCP tools and resource · catalogue.py Catalogue operations · cost_optimisation.py Cache and batching
Components 10
HTTP API
- Basic API
main.py - Optimized triage
app/week7_routes.py - Optimization metrics
app/week7_routes.py
Triage Optimisation
- Cache and batching
app/cost_optimisation.py - Triage fallback
app/week7_routes.py
Clinic Directory
- MCP tools and resource
mcp_server/server.py - Catalogue operations
mcp_server/catalogue.py - Clinic catalogue
mcp_server/data/clinics.json
Other components
- HTTP caller
- MCP client
Connections 9
- HTTP caller → Basic API: requests basic endpoints
- HTTP caller → Optimized triage: submits triage
- HTTP caller → Optimization metrics: requests metrics
- Optimized triage → Cache and batching: checks cache and batches
- Optimized triage → Triage fallback: runs on cache miss
- Optimization metrics → Cache and batching: reads statistics
- MCP client → MCP tools and resource: calls tools or resource
- MCP tools and resource → Catalogue operations: dispatches directory calls
- Catalogue operations → Clinic catalogue: loads catalogue