| # Enhanced Streamlit Application Features | |
| ## π New Features Added | |
| ### 1. Authentication System | |
| - **Secure Login**: Multi-user authentication with role-based access control | |
| - **Session Management**: Automatic session state tracking | |
| - **Demo Credentials**: | |
| - Nurse: `nurse` / `nurse2025` | |
| - Clinician: `clinician` / `clinician2025` | |
| - Admin: `admin` / `admin2025` | |
| ### 2. Chat History Persistence | |
| - **Automatic Saving**: Chat conversations are automatically saved per user | |
| - **History Retrieval**: Chat history loads when user logs back in | |
| - **Clear History**: Option to clear chat history anytime | |
| - **Local Storage**: Uses JSON file-based storage (`.chat_history.json`) | |
| ### 3. Role-Based Access Control (RBAC) | |
| Different permission levels for different user roles: | |
| | Feature | Nurse | Clinician | Admin | | |
| |---------|-------|-----------|-------| | |
| | Validate Notes | β | β | β | | |
| | View History | β | β | β | | |
| | Export Chat | β | β | β | | |
| | Manage Users | β | β | β | | |
| ### 4. User Interface Improvements | |
| - **Sidebar Navigation**: User info, logout button, knowledge base status | |
| - **Chat Interface**: Interactive chat with message history | |
| - **Quick Actions**: | |
| - Clear chat history | |
| - Export conversations as JSON | |
| - View chat statistics | |
| - **Admin Panel**: User management interface (for admins only) | |
| ### 5. Data Export | |
| - **JSON Export**: Download chat conversations in JSON format | |
| - **Timestamped Files**: Automatically named with username and timestamp | |
| ## π Running the Enhanced App | |
| ### Prerequisites | |
| ```bash | |
| pip install -r requirements.txt | |
| ``` | |
| ### Initialize Knowledge Base | |
| ```bash | |
| # Download FoNS articles | |
| python harvest_fons.py | |
| # Build vector database | |
| python ingest_fast.py | |
| ``` | |
| ### Start the Application | |
| ```bash | |
| streamlit run app.py | |
| ``` | |
| The app will be available at `http://localhost:8501` | |
| ## π Security Considerations | |
| ### Current Implementation (Demo) | |
| The demo version uses hardcoded credentials for testing purposes. | |
| ### Production Deployment | |
| For production use, integrate with: | |
| - **Azure AD** for enterprise authentication | |
| - **OAuth 2.0** providers (Google, GitHub) | |
| - **Auth0** for managed authentication | |
| - **Database** for encrypted credential storage | |
| ### Recommended Changes for Production | |
| 1. Remove hardcoded passwords | |
| 2. Implement JWT token-based authentication | |
| 3. Use environment variables for sensitive data | |
| 4. Add rate limiting for login attempts | |
| 5. Implement password hashing (bcrypt) | |
| 6. Add audit logging for all actions | |
| 7. Use HTTPS only | |
| 8. Implement session timeout | |
| ## π Chat History Storage | |
| ### Format | |
| Chat history is stored in `.chat_history.json`: | |
| ```json | |
| { | |
| "nurse": [ | |
| {"role": "user", "content": "What is person-centered care?"}, | |
| {"role": "assistant", "content": "...response..."} | |
| ], | |
| "clinician": [ | |
| {"role": "user", "content": "...question..."}, | |
| {"role": "assistant", "content": "...response..."} | |
| ] | |
| } | |
| ``` | |
| ### Backup Recommendations | |
| - Regularly backup `.chat_history.json` | |
| - Consider implementing database storage for large-scale deployments | |
| - Add encryption for stored conversations | |
| ## π― Future Enhancements | |
| ### Planned Features | |
| 1. **Database Integration**: Replace JSON storage with PostgreSQL/MongoDB | |
| 2. **Advanced Analytics**: Dashboard with usage statistics | |
| 3. **Audit Logging**: Track all user actions for compliance | |
| 4. **Multi-tenancy**: Support multiple organizations | |
| 5. **API Layer**: REST API for programmatic access | |
| 6. **Mobile App**: React Native mobile application | |
| 7. **Real-time Collaboration**: Multiple users viewing same chat | |
| 8. **AI-powered Suggestions**: Contextual recommendations | |
| 9. **Document Upload**: Process patient documents directly | |
| 10. **FHIR Integration**: Direct integration with FHIR resources | |
| ## π User Roles Explained | |
| ### Nurse Role | |
| - Access to clinical validation | |
| - Can view and export chat history | |
| - Intended for frontline nursing staff | |
| ### Clinician Role | |
| - Access to clinical validation | |
| - Can view chat history (no export) | |
| - Intended for physicians and specialist staff | |
| ### Admin Role | |
| - All permissions | |
| - User management capabilities | |
| - System configuration access | |
| - Intended for system administrators | |
| ## π Troubleshooting | |
| ### Issue: Chat history not loading | |
| - Check if `.chat_history.json` exists | |
| - Verify file permissions | |
| - Ensure JSON is valid | |
| ### Issue: Knowledge base offline | |
| - Run `python ingest_fast.py` to rebuild database | |
| - Check if `chroma_db_fons` directory exists | |
| - Verify Azure OpenAI credentials | |
| ### Issue: Login fails | |
| - Verify credentials match those in `DEFAULT_USERS` | |
| - Check for typos in username/password | |
| - Try refreshing the page | |
| ## π Support | |
| For issues, questions, or feature requests, please open an issue on GitHub: | |
| https://github.com/ClinyQAi/open-nursing-core-ig/issues | |