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
- Nurse:
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
pip install -r requirements.txt
Initialize Knowledge Base
# Download FoNS articles
python harvest_fons.py
# Build vector database
python ingest_fast.py
Start the Application
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
- Remove hardcoded passwords
- Implement JWT token-based authentication
- Use environment variables for sensitive data
- Add rate limiting for login attempts
- Implement password hashing (bcrypt)
- Add audit logging for all actions
- Use HTTPS only
- Implement session timeout
π Chat History Storage
Format
Chat history is stored in .chat_history.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
- Database Integration: Replace JSON storage with PostgreSQL/MongoDB
- Advanced Analytics: Dashboard with usage statistics
- Audit Logging: Track all user actions for compliance
- Multi-tenancy: Support multiple organizations
- API Layer: REST API for programmatic access
- Mobile App: React Native mobile application
- Real-time Collaboration: Multiple users viewing same chat
- AI-powered Suggestions: Contextual recommendations
- Document Upload: Process patient documents directly
- 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.jsonexists - Verify file permissions
- Ensure JSON is valid
Issue: Knowledge base offline
- Run
python ingest_fast.pyto rebuild database - Check if
chroma_db_fonsdirectory 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