mgbam commited on
Commit
e3dcfb7
Β·
verified Β·
1 Parent(s): fa88b6c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +232 -13
README.md CHANGED
@@ -1,13 +1,232 @@
1
- ---
2
- title: Healthapp
3
- emoji: 🌍
4
- colorFrom: indigo
5
- colorTo: indigo
6
- sdk: streamlit
7
- sdk_version: 1.41.1
8
- app_file: app.py
9
- pinned: false
10
- short_description: The AI-Powered Clinical Intelligence Hub
11
- ---
12
-
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ πŸ₯ AI Clinical Intelligence Hub
2
+ Welcome to the AI Clinical Intelligence Hub, an advanced, AI-powered platform designed to revolutionize clinical data analysis and decision-making. Leveraging OpenAI's GPT-4, this hub provides comprehensive tools for data ingestion, exploratory data analysis, statistical testing, machine learning model training, clinical rules execution, KPI monitoring, diagnosis support, treatment recommendations, and access to a robust Medical Knowledge Base.
3
+
4
+
5
+ πŸš€ Features
6
+ Data Ingestion: Seamlessly upload and connect to CSV files or SQL databases.
7
+ Exploratory Data Analysis (EDA): Gain insights into your datasets with comprehensive EDA reports.
8
+ Temporal Pattern Analysis: Analyze time-series data to identify trends and seasonality.
9
+ Comparative Statistics: Perform hypothesis testing and comparative statistical analyses.
10
+ Distribution Analysis: Visualize data distributions using customizable plots.
11
+ Machine Learning: Train and evaluate Logistic Regression models on your data.
12
+ Clinical Rules Engine: Define and execute clinical rules to automate decision-making.
13
+ KPI Monitoring: Define, calculate, and monitor Key Performance Indicators (KPIs).
14
+ Diagnosis Support: Utilize machine learning models to assist in clinical diagnoses.
15
+ Treatment Recommendations: Generate treatment suggestions based on patient data.
16
+ Medical Knowledge Base: Access comprehensive medical information powered by OpenAI's GPT-4 and retrieve relevant PubMed abstracts.
17
+ πŸ“Έ Screenshots
18
+ Dashboard Overview
19
+
20
+ Medical Knowledge Search Interface
21
+
22
+ πŸ› οΈ Installation & Setup
23
+ Deploying the AI Clinical Intelligence Hub on Hugging Face Spaces is straightforward. Follow the steps below to get your application up and running.
24
+
25
+ 1. Prerequisites
26
+ Hugging Face Account: Ensure you have an account on Hugging Face.
27
+ OpenAI API Key: Obtain your API key from OpenAI.
28
+ PubMed Email: A valid email address for accessing PubMed abstracts via Biopython.
29
+ 2. Clone the Repository
30
+ If you haven't already, clone the repository to your local machine:
31
+
32
+ bash
33
+ Copy
34
+ git clone https://github.com/your-username/ai-clinical-intelligence-hub.git
35
+ cd ai-clinical-intelligence-hub
36
+ 3. Configure Environment Variables
37
+ Securely manage sensitive information using Hugging Face's Secrets feature.
38
+
39
+ Navigate to Your Space:
40
+
41
+ Go to Hugging Face Spaces and create a new Space or select an existing one.
42
+ Add Secrets:
43
+
44
+ Click on the "Settings" tab of your Space.
45
+ Scroll down to the "Secrets" section.
46
+ Add the following secrets:
47
+ OPENAI_API_KEY: Your OpenAI GPT-4 API key.
48
+ PUB_EMAIL: Your email address for PubMed access.
49
+ Adding Secrets in Hugging Face Spaces
50
+
51
+ 4. Install Dependencies
52
+ Ensure all required Python packages are installed. The requirements.txt file includes all necessary dependencies.
53
+
54
+ bash
55
+ Copy
56
+ pip install -r requirements.txt
57
+ python -m spacy download en_core_web_sm
58
+ 5. Deploy to Hugging Face Spaces
59
+ Push to Repository:
60
+
61
+ Commit and push your code to your GitHub repository linked to your Hugging Face Space.
62
+ bash
63
+ Copy
64
+ git add .
65
+ git commit -m "Initial commit with OpenAI GPT-4 integration"
66
+ git push origin main
67
+ Automatic Deployment:
68
+
69
+ Hugging Face Spaces automatically detects changes and redeploys your application. Monitor the deployment logs for any issues.
70
+ πŸ§‘β€πŸ’» Usage
71
+ Once deployed, navigate to your Hugging Face Space URL to interact with the AI Clinical Intelligence Hub.
72
+
73
+ 1. Data Management
74
+ Upload Data: Use the sidebar to upload CSV files or connect to SQL databases.
75
+ Ingest Data: After uploading or connecting, ingest the data to make it available for analysis.
76
+ 2. Dataset Metadata
77
+ View Metadata: Select a dataset to view its metadata, including variables, time ranges, and size.
78
+ 3. Data Analysis
79
+ Select Analysis Mode: Choose from EDA, Temporal Analysis, Comparative Statistics, Distribution Analysis, or Machine Learning.
80
+ Perform Analysis: Depending on the selected mode, provide necessary inputs and generate insightful reports and visualizations.
81
+ 4. Clinical Logic
82
+ Define Clinical Rules: Input conditions, actions, and severity levels to automate clinical decision-making.
83
+ Define KPIs: Create and monitor Key Performance Indicators relevant to your clinical data.
84
+ Execute Rules & Calculate KPIs: Apply defined rules and KPIs to your datasets to obtain actionable insights.
85
+ 5. Insights
86
+ Generate Automated Insights: Select analyses to generate comprehensive insights based on your data.
87
+ Diagnosis Support: Utilize machine learning models to assist in clinical diagnoses.
88
+ Treatment Recommendations: Generate treatment suggestions based on patient data and conditions.
89
+ 6. Reports
90
+ Create Report Definitions: Define the structure and content of automated reports.
91
+ Generate Reports: Produce reports based on predefined definitions and your data.
92
+ 7. Medical Knowledge
93
+ Search Medical Information: Input medical queries to retrieve comprehensive information powered by OpenAI's GPT-4.
94
+ PubMed Abstracts: Access relevant PubMed abstracts to supplement medical information.
95
+ πŸ“„ API Reference
96
+ MedicalKnowledgeBase
97
+ search_medical_info(query: str, pub_email: str = "") -> str
98
+ Description: Fetches medical information based on user queries using OpenAI's GPT-4 and retrieves relevant PubMed abstracts.
99
+ Parameters:
100
+ query (str): The medical question or query.
101
+ pub_email (str, optional): Email address for PubMed access.
102
+ Returns: A formatted string containing the GPT-4 response and PubMed abstract.
103
+ ClinicalRulesEngine
104
+ add_rule(rule: ClinicalRule)
105
+ Description: Adds a new clinical rule to the engine.
106
+ execute_rules(data: pd.DataFrame) -> Dict[str, Any]
107
+ Description: Executes all defined clinical rules against the provided data.
108
+ Parameters:
109
+ data (pd.DataFrame): The dataset to apply rules on.
110
+ Returns: A dictionary with rule execution results.
111
+ ClinicalKPIMonitoring
112
+ add_kpi(kpi: ClinicalKPI)
113
+ Description: Adds a new KPI to the monitoring system.
114
+ calculate_kpis(data: pd.DataFrame) -> Dict[str, Any]
115
+ Description: Calculates all defined KPIs based on the provided data.
116
+ Parameters:
117
+ data (pd.DataFrame): The dataset to calculate KPIs on.
118
+ Returns: A dictionary with KPI calculation results.
119
+ DiagnosisSupport
120
+ diagnose(data: pd.DataFrame, target_col: str, columns: List[str], diagnosis_key: str = "diagnosis", **kwargs) -> pd.DataFrame
121
+ Description: Generates diagnosis support based on the data using trained models.
122
+ Parameters:
123
+ data (pd.DataFrame): The dataset for diagnosis.
124
+ target_col (str): The target variable for diagnosis.
125
+ columns (List[str]): Feature columns used in the model.
126
+ diagnosis_key (str, optional): Key name for the diagnosis result.
127
+ Returns: A DataFrame with diagnosis results.
128
+ TreatmentRecommendation
129
+ recommend(data: pd.DataFrame, condition_col: str, treatment_col: str, recommendation_key: str = "recommendation", **kwargs) -> pd.DataFrame
130
+ Description: Provides treatment recommendations based on patient conditions.
131
+ Parameters:
132
+ data (pd.DataFrame): The dataset containing patient information.
133
+ condition_col (str): The column indicating patient conditions.
134
+ treatment_col (str): The column indicating available treatments.
135
+ recommendation_key (str, optional): Key name for the recommendation result.
136
+ Returns: A DataFrame with treatment recommendations.
137
+ πŸ“¦ Dependencies
138
+ The application relies on the following Python packages:
139
+
140
+ streamlit
141
+ pandas
142
+ numpy
143
+ matplotlib
144
+ seaborn
145
+ scikit-learn
146
+ statsmodels
147
+ pydantic
148
+ biopython
149
+ python-dotenv
150
+ requests
151
+ spacy
152
+ openai
153
+ Ensure all dependencies are installed using:
154
+
155
+ bash
156
+ Copy
157
+ pip install -r requirements.txt
158
+ python -m spacy download en_core_web_sm
159
+ πŸ“œ License
160
+ This project is licensed under the MIT License.
161
+
162
+ πŸ™ Acknowledgments
163
+ OpenAI for providing the GPT-4 API.
164
+ Biopython for enabling PubMed abstract retrieval.
165
+ Streamlit for the intuitive UI framework.
166
+ Hugging Face for hosting and deploying the application.
167
+ πŸ“¬ Contact
168
+ For questions, feedback, or support, please reach out to [email protected].
169
+
170
+ πŸ“š Getting Started
171
+ Clone the Repository:
172
+
173
+ bash
174
+ Copy
175
+ git clone https://github.com/oluwafemidiakhoa/ai-clinical-intelligence-hub.git
176
+ cd ai-clinical-intelligence-hub
177
+ Set Up Environment Variables:
178
+
179
+ Hugging Face Spaces: Add OPENAI_API_KEY and PUB_EMAIL in the Secrets section.
180
+ Local Development: Create a .env file with the following content:
181
+ env
182
+ Copy
183
+ OPENAI_API_KEY=your_openai_api_key_here
184
185
+ Install Dependencies:
186
+
187
+ bash
188
+ Copy
189
+ pip install -r requirements.txt
190
+ python -m spacy download en_core_web_sm
191
+ Run the Application Locally (Optional):
192
+
193
+ bash
194
+ Copy
195
+ streamlit run app.py
196
+ Deploy to Hugging Face Spaces:
197
+
198
+ Push your code to GitHub.
199
+ Link your GitHub repository to a new Hugging Face Space.
200
+ Ensure Secrets are configured as described above.
201
+ The application will automatically deploy and be accessible via your Space URL.
202
+ πŸ›‘οΈ Security Considerations
203
+ API Keys: Ensure that your OPENAI_API_KEY and PUB_EMAIL are stored securely and never exposed in the codebase.
204
+ Data Privacy: Comply with relevant data protection regulations (e.g., HIPAA, GDPR) when handling sensitive medical data.
205
+ Access Controls: Implement authentication mechanisms if deploying in environments requiring restricted access.
206
+ 🧩 Extending the Application
207
+ The AI Clinical Intelligence Hub is designed to be modular and extensible. You can add new data sources, analysis modules, or integrate additional APIs as needed. Contributions and enhancements are welcome!
208
+
209
+ 🀝 Contributing
210
+ Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Feel free to fork the repository and submit pull requests. Please ensure your contributions adhere to the project's coding standards and include relevant tests.
211
+
212
+ Fork the Project
213
+ Create Your Feature Branch (git checkout -b feature/AmazingFeature)
214
+ Commit Your Changes (git commit -m 'Add some AmazingFeature')
215
+ Push to the Branch (git push origin feature/AmazingFeature)
216
+ Open a Pull Request
217
+ ❓ FAQs
218
+ Q1: How do I obtain an OpenAI API key?
219
+
220
+ A1: Visit OpenAI's API page to sign up and generate your API key.
221
+ Q2: Can I use other machine learning models besides Logistic Regression?
222
+
223
+ A2: Yes! The framework is designed to be extensible. You can integrate additional models by creating new analyzer classes following the existing structure.
224
+ Q3: How does the Medical Knowledge Base handle sensitive queries?
225
+
226
+ A3: All queries are processed securely using OpenAI's GPT-4 API. Ensure compliance with data protection regulations when handling sensitive information.
227
+ πŸ“ˆ Future Enhancements
228
+ User Authentication: Implement robust user authentication and authorization mechanisms.
229
+ Advanced Machine Learning Models: Integrate more sophisticated models for diagnosis and prediction.
230
+ Real-Time Data Streaming: Support real-time data ingestion and analysis for dynamic clinical environments.
231
+ Enhanced Reporting: Develop customizable and exportable report formats (e.g., PDF, DOCX).
232
+ Natural Language Processing (NLP): Enhance the Medical Knowledge Base with advanced NLP capabilities for better query understanding.