Tech stack (per task):
- Frontend: React + Redux (Toolkit), Google Inter
- Backend: Python FastAPI
- AI Agent: LangGraph
- LLM: Groq (
gemma2-9b-it) - DB: Postgres (Docker Compose)
- Node.js 18+
- Python 3.10+
- Docker Desktop
docker compose up -dcd backend
python -m venv .venv
.\.venv\Scripts\pip install -r requirements.txt
copy .env.example .envSet GROQ_API_KEY in backend/.env.
Run the API (dev mode with reload):
.\.venv\Scripts\uvicorn app.main:app --reload --port 8000Seed sample HCPs:
Invoke-RestMethod -Method Post -Uri http://127.0.0.1:8000/api/seedcd frontend
npm install
npm run devOpen http://localhost:5173/.
- Structured form matching
image.png(Log HCP Interaction). - Conversational chat ("AI Assistant") that calls the backend LangGraph agent.
- Chat → Form autofill:
- Example input in the AI panel:
Today I met with Dr. Sharma and discussed Product X efficacy, the sentiment was positive and I shared the brochures. - The system automatically:
- selects HCP Name (e.g.
Dr. Sharma) when a match exists in the HCP list, - sets Sentiment (
Positive/Neutral/Negative), - fills Topics Discussed with the clinical/business discussion only,
- fills Materials Shared (e.g.
"Brochure shared"), - highlights updated fields on the form so you can review and manually fix anything.
- selects HCP Name (e.g.
- Example input in the AI panel:
- Log button → DB:
- After reviewing/editing the form, press Log to create an interaction row in Postgres via
POST /api/interactions. - A small status message in the AI panel confirms success or shows validation errors.
- After reviewing/editing the form, press Log to create an interaction row in Postgres via
- LangGraph tools (minimum 5) defined in
backend/app/agent.py:tool_log_interaction(LLM summarization/entity extraction + structured patch)tool_edit_interaction(edit flow, currently routed to same logic)tool_search_hcp(placeholder)tool_fetch_product_info(placeholder)tool_suggest_followups(placeholder)
The backend agent normalizes LLM responses so /api/agent/chat always returns a structured suggested_patch with this field set:
hcp_name, interaction_type, attendees, topics_discussed, outcomes, follow_up_actions, materials_shared, samples_distributed, sentiment
— even if the raw model output uses different key names. This keeps the chat-driven autofill robust and predictable.