How shreyyar/business-story-intelligence-backend works
This is a mock-first FastAPI backend for analyzing Azure DevOps Product Backlog Items (PBIs), finding related or redundant items, and generating or creating grounded stories. The principal workflow accepts an analysis or search request, retrieves candidates, evaluates similarity and creation eligibility, records search results, and can generate and save a draft. Separate capabilities include Azure DevOps sync, dashboard metrics, and indexing. Source-index references and README statements support some links; unsampled implementation details are left unconnected rather than inferred.
Main entry points: rag.py RAG routes · main.py FastAPI app · pbis.py PBI routes · pbi_generation_service.py PBI generation
Components 30
API workflows
- FastAPI app
bsi_api/app/main.py - PBI routes
bsi_api/app/api/routes/pbis.py - RAG routes
bsi_api/app/api/routes/rag.py - ADO sync route
bsi_api/app/api/routes/ado_pbis.py - Dashboard route
bsi_api/app/api/routes/dashboard.py
Domain services
- Similarity scoring
bsi_api/app/services/similarity_service.py - PBI generation
bsi_api/app/services/pbi_generation_service.py - RAG logging
bsi_api/app/services/rag_service.py - ADO integration
bsi_api/app/services/azure_devops_service.py - Readiness scoring
bsi_api/app/services/readiness_score_service.py - Configuration
bsi_api/app/core/config.py
Persistence
- Database engine
bsi_api/app/database/db.py - DB sessions
bsi_api/app/database/session.py - ADO PBI repository
bsi_api/app/repositories/ado_pbi_repository.py - Generated PBI repository
bsi_api/app/repositories/generated_pbi_repository.py - Analysis repository
bsi_api/app/repositories/pbi_analysis_repository.py - Stored ADO PBIs
bsi_api/app/models/ado_pbi_entity.py - Generated PBIs
bsi_api/app/models/generated_pbi.py - PBI analyses
bsi_api/app/models/pbi_analysis.py - RAG search logs
bsi_api/app/models/rag_search_log.py - Similarity results
bsi_api/app/models/similarity_result.py
Search indexing
- Azure search
bsi_api/app/services/azure_search_service.py - Embedding service
bsi_api/app/services/embedding_service.py - PBI indexing
bsi_api/app/services/pbi_indexing_service.py - Chunking
bsi_api/app/utils/chunking.py - Text cleaning
bsi_api/app/utils/text_cleaner.py
Other components
- API caller
- Azure AI Search
- Azure DevOps
- Azure OpenAI
Connections 39
- API caller → FastAPI app: sends requests
README.md - FastAPI app → PBI routes: registers routes
bsi_api/app/main.py - FastAPI app → RAG routes: registers routes
bsi_api/app/main.py - FastAPI app → ADO sync route: registers routes
bsi_api/app/main.py - FastAPI app → Dashboard route: registers routes
bsi_api/app/main.py - FastAPI app → Database engine: initializes schema
bsi_api/app/main.py - PBI routes → Similarity scoring: scores PBIs
bsi_api/app/api/routes/pbis.py - PBI routes → PBI generation: requests generation
bsi_api/app/api/routes/pbis.py - PBI routes → ADO PBI repository: reads PBIs
bsi_api/app/api/routes/pbis.py - PBI routes → Generated PBI repository: stores generated PBIs
bsi_api/app/api/routes/pbis.py - PBI routes → Analysis repository: stores analysis
bsi_api/app/api/routes/pbis.py - RAG routes → Azure search: searches chunks
bsi_api/app/api/routes/rag.py - RAG routes → ADO PBI repository: fetches candidates
bsi_api/app/api/routes/rag.py - RAG routes → Similarity scoring: scores candidates
bsi_api/app/api/routes/rag.py - RAG routes → RAG logging: saves results
bsi_api/app/api/routes/rag.py - RAG routes → PBI generation: generates story
bsi_api/app/api/routes/rag.py - RAG routes → Generated PBI repository: saves draft
bsi_api/app/api/routes/rag.py - ADO sync route → ADO integration: syncs PBIs
bsi_api/app/api/routes/ado_pbis.py - ADO sync route → ADO PBI repository: persists PBIs
bsi_api/app/api/routes/ado_pbis.py - ADO sync route → PBI indexing: indexes PBIs
bsi_api/app/api/routes/ado_pbis.py - PBI indexing → ADO PBI repository: reads PBIs
bsi_api/app/services/pbi_indexing_service.py - PBI indexing → Azure search: uploads chunks
bsi_api/app/services/pbi_indexing_service.py - PBI indexing → Chunking: creates chunks
bsi_api/app/services/pbi_indexing_service.py - Azure search → Embedding service: creates vectors
bsi_api/app/services/azure_search_service.py - Chunking → Text cleaning: cleans text
bsi_api/app/utils/chunking.py - Azure search → Azure AI Search: queries index
bsi_api/app/services/azure_search_service.py - PBI generation → Azure OpenAI: requests completion
bsi_api/app/services/pbi_generation_service.py - PBI generation → Readiness scoring: calculates readiness
bsi_api/app/services/pbi_generation_service.py - PBI generation → Generated PBI repository: saves draft
bsi_api/app/services/pbi_generation_service.py - PBI generation → ADO PBI repository: retrieves context
bsi_api/app/services/pbi_generation_service.py - RAG logging → RAG search logs: writes log
bsi_api/app/services/rag_service.py - RAG logging → Similarity results: writes scores
bsi_api/app/services/rag_service.py - ADO PBI repository → Stored ADO PBIs: queries and updates
bsi_api/app/repositories/ado_pbi_repository.py - Generated PBI repository → Generated PBIs: queries and saves
bsi_api/app/repositories/generated_pbi_repository.py - Analysis repository → PBI analyses: persists analyses
bsi_api/app/repositories/pbi_analysis_repository.py - DB sessions → Database engine: binds sessions
bsi_api/app/database/session.py - ADO integration → Azure DevOps: accesses work items
README.md - Embedding service → Configuration: loads settings
bsi_api/app/services/embedding_service.py - Azure search → Configuration: loads settings
bsi_api/app/services/azure_search_service.py