How nayakanwesha885-spec/flask-app works
TATVA is a web-based Ayurveda intellectual-property and regulatory knowledge desk. A visitor can explore formulation-classification and access-and-benefit-sharing (ABS) guidance in the site, or submit a question with a topic and language. The /ask route validates and screens the question, retrieves relevant PDF-derived material, and returns an answer with source information; the app also has translation-provider code. The sampled excerpts do not show the complete answer-generation or translation call sites, so those connections are omitted. The classification and ABS capabilities appear as informational site content, not demonstrated backend workflows.
Main entry points: app.py Flask app · index.html TATVA site · script.js Browser interactions · knowledge_base Knowledge PDFs
Components 21
Web experience
- TATVA site
templates/index.html - Browser interactions
static/script.js - Site styling
static/style.css - Formulation guide
templates/index.html - ABS guidance
templates/index.html
Question handling
- Flask app
app.py - Input validation
app.py - Safety screening
app.py - Relevance screening
app.py - Irrelevant request limit
app.py - Answer and sources
app.py
Knowledge retrieval
- Page retrieval
app.py - PDF text loading
app.py - Loaded page cache
app.py - Knowledge PDFs
knowledge_base - Vector search
app.py - OpenAI vector store
Language providers
- Translation logic
app.py
Other components
- Visitor
- OpenAI service
- Gemini service
Connections 21
- Visitor → TATVA site: opens
- TATVA site → Browser interactions: loads
- TATVA site → Formulation guide: presents
- TATVA site → ABS guidance: presents
- Browser interactions → Flask app: submits question
- Flask app → TATVA site: renders
- Flask app → Input validation: validates
- Flask app → Safety screening: screens
- Flask app → Relevance screening: checks relevance
- Flask app → Irrelevant request limit: limits irrelevant requests
- Flask app → Page retrieval: retrieves pages
- Page retrieval → Vector search: tries vector search
- Vector search → OpenAI service: searches store
- OpenAI service → OpenAI vector store: searches
- Page retrieval → Loaded page cache: scores pages
- PDF text loading → Knowledge PDFs: reads PDFs
- PDF text loading → Loaded page cache: caches page text
- Flask app → PDF text loading: loads at startup
- Flask app → Answer and sources: builds response
- Page retrieval → Answer and sources: provides source pages
- Translation logic → Gemini service: requests translation