generated from oracle-devrel/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from shanghoosh1/healthcare_demo_readme_update
update readme file for heatwave healthcare demo
- Loading branch information
Showing
8 changed files
with
682 additions
and
11 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,87 @@ | ||
# 1. Preferably use python 3.8 | ||
# 2. Install the requirmements in your venv | ||
# 3. upload the healthcare documents into the vector store in heatwave. Sample documents can be found in the folder healthcare_docs | ||
# 4. install the hw_healthcare.sql file in the DB system. | ||
### 4.1. Please make sure you are using the correct vector store DB and table names in the procedure hw_healthcare | ||
# 5. Add the DB system user and pass in the mysql_helper file. | ||
# 6. Run the code: `streamlit run heatwave_heathcare.py` | ||
# Answering Health-Related Questions Using HeatWave with Vector Store | ||
|
||
[![License: UPL](https://img.shields.io/badge/license-UPL-green)](https://img.shields.io/badge/license-UPL-green) [![Quality gate](https://sonarcloud.io/api/project_badges/quality_gate?project=oracle-devrel_tech-content-heatwave)](https://sonarcloud.io/dashboard?id=oracle-devrel_tech-content-heatwave) | ||
|
||
## This repository demonstrates how to use HeatWave GenAI to build a Healthcare question-and-answer tool quickly and efficiently. With just a few steps, you can leverage HeatWave GenAI to create a tool for answering health-related questions based on custom documents. | ||
|
||
## Introduction | ||
HeatWave GenAI allows you to perform natural language queries on unstructured data using a familiar SQL interface. This capability streamlines tasks such as content generation, summarization, and retrieval-augmented generation (RAG). It supports seamless one-step searches using in-database or external LLMs, with all components optimized for integration with proprietary data. | ||
In this repository, we focus on using HeatWave GenAI to create a healthcare tool that answers questions based on documents ingested into the HeatWave vector store. For more information about HeatWave GenAI, visit the [official documentation](https://dev.mysql.com/doc/heatwave/en/mys-hw-genai-overview.html). | ||
|
||
## Getting Started | ||
|
||
### Prerequisites | ||
|
||
**HeatWave-Enabled Database System**: Ensure you have a database system with HeatWave enabled. Refer to the [Getting Started with MySQL HeatWave on OCI]( https://www.oracle.com/developer/getting-started-with-mysql-heatwave-on-oci/) guide for setup instructions. | ||
|
||
### Steps | ||
1. **Clone the Repository**: | ||
```bash | ||
git clone https://github.com/oracle-devrel/tech-content-heatwave.git | ||
cd tech-content-heatwave/healthcare | ||
``` | ||
2. **Install Dependencies**: | ||
- Create and activate a virtual environment: | ||
```bash | ||
python -m venv venv | ||
source venv/bin/activate | ||
``` | ||
- Install the required packages: | ||
```bash | ||
pip install -r requirements.txt | ||
``` | ||
|
||
3. **Upload Healthcare Documents**: | ||
- Upload your healthcare documents to the HeatWave vector store. Follow the instructions in the [Managing Objects](https://docs.oracle.com/en-us/iaas/Content/Object/Tasks/managingobjects_topic-To_upload_objects_to_a_bucket.htm) guide. You will perhaps need to [create PAR links](https://docs.oracle.com/en-us/iaas/Content/Object/Tasks/usingpreauthenticatedrequests_topic-To_create_a_preauthenticated_request_for_all_objects_in_a_bucket.htm) for you objects in the object store. | ||
- Sample documents are provided in the `healthcare_docs` folder. These documents are open-access papers from [PubMed](https://pubmed.ncbi.nlm.nih.gov/), but you can upload your own custom documents. | ||
|
||
4. **Create a Vector Store**: | ||
- Create a vector store containing embeddings of your document data. Refer to the [HeatWave GenAI Vector Store](https://dev.mysql.com/doc/heatwave/en/mys-hw-genai-vector-store-load.html) guide for detailed instructions. | ||
|
||
5. **Set Up the Database**: | ||
- Connect to the DB system: | ||
|
||
``` bash | ||
mysql -h your_host_name -u yourusername -p | ||
``` | ||
|
||
- Implement the required stored procedures in your database system by installing the `hw_healthcare.sql` file. | ||
**IMPORTANT**: Ensure that the correct vector store database and table names are used in the `hw_healthcare` procedure so that your vector store is utilized. Once updated the vector table names, source the `hw_healthcare.sql` file to install the stored procedures: | ||
|
||
```source hw_healthcare.sql;``` | ||
|
||
6. **Configure Database Access**: | ||
- Update the `mysql_helper.py` file with your DB system's user credentials and password. This file is used to connect to the database and execute queries. | ||
7. **Run the Application**: | ||
```bash | ||
streamlit run heatwave_healthcare.py | ||
``` | ||
Look at the demo here: | ||
[Healthcare Demo]( https://www-sites.oracle.com/artificial-intelligence/answer-health-questions-with-heatwave-ai/) | ||
The UI with an example question: | ||
<p align="center"> | ||
<img src="ui.png" alt="The User Interface of Healthcare app" style="width:300px; border:2px solid black;" /> | ||
</p> | ||
## Contributing | ||
This project is open source. Please submit your contributions by forking this repository and submitting a pull request! Oracle appreciates any contributions that are made by the open source community. | ||
## License | ||
Copyright (c) 2024 Oracle and/or its affiliates. | ||
Licensed under the Universal Permissive License (UPL), Version 1.0. | ||
See [LICENSE](LICENSE) for more details. | ||
For third party lincenses, see [THIRD_PARTY_LICENSES](THIRD_PARTY_LICENSES.txt). | ||
Credit: this repo includes the following two open access papers, licensed under [Creative Commons Attribution (CC BY) License](CC_BY.txt). | ||
1. Gupta RS, Warren CM, Smith BM, Jiang J, Blumenstock JA, Davis MM, Schleimer RP, Nadeau KC. Prevalence and Severity of Food Allergies Among US Adults. JAMA Netw Open. 2019 Jan | ||
2. Notarbartolo V, Carta M, Accomando S, Giuffrè M. The First 1000 Days of Life: How Changes in the Microbiota Can Influence Food Allergy Onset in Children. Nutrients. 2023 Sep | ||
ORACLE AND ITS AFFILIATES DO NOT PROVIDE ANY WARRANTY WHATSOEVER, EXPRESS OR IMPLIED, FOR ANY SOFTWARE, MATERIAL OR CONTENT OF ANY KIND CONTAINED OR PRODUCED WITHIN THIS REPOSITORY, AND IN PARTICULAR SPECIFICALLY DISCLAIM ANY AND ALL IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. FURTHERMORE, ORACLE AND ITS AFFILIATES DO NOT REPRESENT THAT ANY CUSTOMARY SECURITY REVIEW HAS BEEN PERFORMED WITH RESPECT TO ANY SOFTWARE, MATERIAL OR CONTENT CONTAINED OR PRODUCED WITHIN THIS REPOSITORY. IN ADDITION, AND WITHOUT LIMITING THE FOREGOING, THIRD PARTIES MAY HAVE POSTED SOFTWARE, MATERIAL OR CONTENT TO THIS REPOSITORY WITHOUT ANY REVIEW. USE AT YOUR OWN RISK. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
LICENSES FOR THIRD-PARTY COMPONENTS | ||
============================================================================== | ||
|
||
The following sections contain licensing information for libraries that we have | ||
included with the sample source and components used to. We are thankful to all | ||
individuals that have created these. | ||
|
||
=============================================================================== | ||
heatwave-healthcare-demo | ||
|
||
License: Apache License v2.0 | ||
|
||
Version 2.0, January 2004 | ||
http://www.apache.org/licenses/ | ||
|
||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | ||
|
||
1. Definitions. | ||
|
||
"License" shall mean the terms and conditions for use, reproduction, | ||
and distribution as defined by Sections 1 through 9 of this document. | ||
|
||
"Licensor" shall mean the copyright owner or entity authorized by | ||
the copyright owner that is granting the License. | ||
|
||
"Legal Entity" shall mean the union of the acting entity and all | ||
other entities that control, are controlled by, or are under common | ||
control with that entity. For the purposes of this definition, | ||
"control" means (i) the power, direct or indirect, to cause the | ||
direction or management of such entity, whether by contract or | ||
otherwise, or (ii) ownership of fifty percent (50%) or more of the | ||
outstanding shares, or (iii) beneficial ownership of such entity. | ||
|
||
"You" (or "Your") shall mean an individual or Legal Entity | ||
exercising permissions granted by this License. | ||
|
||
"Source" form shall mean the preferred form for making modifications, | ||
including but not limited to software source code, documentation | ||
source, and configuration files. | ||
|
||
"Object" form shall mean any form resulting from mechanical | ||
transformation or translation of a Source form, including but | ||
not limited to compiled object code, generated documentation, | ||
and conversions to other media types. | ||
|
||
"Work" shall mean the work of authorship, whether in Source or | ||
Object form, made available under the License, as indicated by a | ||
copyright notice that is included in or attached to the work | ||
(an example is provided in the Appendix below). | ||
|
||
"Derivative Works" shall mean any work, whether in Source or Object | ||
form, that is based on (or derived from) the Work and for which the | ||
editorial revisions, annotations, elaborations, or other modifications | ||
represent, as a whole, an original work of authorship. For the purposes | ||
of this License, Derivative Works shall not include works that remain | ||
separable from, or merely link (or bind by name) to the interfaces of, | ||
the Work and Derivative Works thereof. | ||
|
||
"Contribution" shall mean any work of authorship, including | ||
the original version of the Work and any modifications or additions | ||
to that Work or Derivative Works thereof, that is intentionally | ||
submitted to Licensor for inclusion in the Work by the copyright owner | ||
or by an individual or Legal Entity authorized to submit on behalf of | ||
the copyright owner. For the purposes of this definition, "submitted" | ||
means any form of electronic, verbal, or written communication sent | ||
to the Licensor or its representatives, including but not limited to | ||
communication on electronic mailing lists, source code control systems, | ||
and issue tracking systems that are managed by, or on behalf of, the | ||
Licensor for the purpose of discussing and improving the Work, but | ||
excluding communication that is conspicuously marked or otherwise | ||
designated in writing by the copyright owner as "Not a Contribution." | ||
|
||
"Contributor" shall mean Licensor and any individual or Legal Entity | ||
on behalf of whom a Contribution has been received by Licensor and | ||
subsequently incorporated within the Work. | ||
|
||
2. Grant of Copyright License. Subject to the terms and conditions of | ||
this License, each Contributor hereby grants to You a perpetual, | ||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||
copyright license to reproduce, prepare Derivative Works of, | ||
publicly display, publicly perform, sublicense, and distribute the | ||
Work and such Derivative Works in Source or Object form. | ||
|
||
3. Grant of Patent License. Subject to the terms and conditions of | ||
this License, each Contributor hereby grants to You a perpetual, | ||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||
(except as stated in this section) patent license to make, have made, | ||
use, offer to sell, sell, import, and otherwise transfer the Work, | ||
where such license applies only to those patent claims licensable | ||
by such Contributor that are necessarily infringed by their | ||
Contribution(s) alone or by combination of their Contribution(s) | ||
with the Work to which such Contribution(s) was submitted. If You | ||
institute patent litigation against any entity (including a | ||
cross-claim or counterclaim in a lawsuit) alleging that the Work | ||
or a Contribution incorporated within the Work constitutes direct | ||
or contributory patent infringement, then any patent licenses | ||
granted to You under this License for that Work shall terminate | ||
as of the date such litigation is filed. | ||
|
||
4. Redistribution. You may reproduce and distribute copies of the | ||
Work or Derivative Works thereof in any medium, with or without | ||
modifications, and in Source or Object form, provided that You | ||
meet the following conditions: | ||
|
||
(a) You must give any other recipients of the Work or | ||
Derivative Works a copy of this License; and | ||
|
||
(b) You must cause any modified files to carry prominent notices | ||
stating that You changed the files; and | ||
|
||
(c) You must retain, in the Source form of any Derivative Works | ||
that You distribute, all copyright, patent, trademark, and | ||
attribution notices from the Source form of the Work, | ||
excluding those notices that do not pertain to any part of | ||
the Derivative Works; and | ||
|
||
(d) If the Work includes a "NOTICE" text file as part of its | ||
distribution, then any Derivative Works that You distribute must | ||
include a readable copy of the attribution notices contained | ||
within such NOTICE file, excluding those notices that do not | ||
pertain to any part of the Derivative Works, in at least one | ||
of the following places: within a NOTICE text file distributed | ||
as part of the Derivative Works; within the Source form or | ||
documentation, if provided along with the Derivative Works; or, | ||
within a display generated by the Derivative Works, if and | ||
wherever such third-party notices normally appear. The contents | ||
of the NOTICE file are for informational purposes only and | ||
do not modify the License. You may add Your own attribution | ||
notices within Derivative Works that You distribute, alongside | ||
or as an addendum to the NOTICE text from the Work, provided | ||
that such additional attribution notices cannot be construed | ||
as modifying the License. | ||
|
||
You may add Your own copyright statement to Your modifications and | ||
may provide additional or different license terms and conditions | ||
for use, reproduction, or distribution of Your modifications, or | ||
for any such Derivative Works as a whole, provided Your use, | ||
reproduction, and distribution of the Work otherwise complies with | ||
the conditions stated in this License. | ||
|
||
5. Submission of Contributions. Unless You explicitly state otherwise, | ||
any Contribution intentionally submitted for inclusion in the Work | ||
by You to the Licensor shall be under the terms and conditions of | ||
this License, without any additional terms or conditions. | ||
Notwithstanding the above, nothing herein shall supersede or modify | ||
the terms of any separate license agreement you may have executed | ||
with Licensor regarding such Contributions. | ||
|
||
6. Trademarks. This License does not grant permission to use the trade | ||
names, trademarks, service marks, or product names of the Licensor, | ||
except as required for reasonable and customary use in describing the | ||
origin of the Work and reproducing the content of the NOTICE file. | ||
|
||
7. Disclaimer of Warranty. Unless required by applicable law or | ||
agreed to in writing, Licensor provides the Work (and each | ||
Contributor provides its Contributions) on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
implied, including, without limitation, any warranties or conditions | ||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A | ||
PARTICULAR PURPOSE. You are solely responsible for determining the | ||
appropriateness of using or redistributing the Work and assume any | ||
risks associated with Your exercise of permissions under this License. | ||
|
||
8. Limitation of Liability. In no event and under no legal theory, | ||
whether in tort (including negligence), contract, or otherwise, | ||
unless required by applicable law (such as deliberate and grossly | ||
negligent acts) or agreed to in writing, shall any Contributor be | ||
liable to You for damages, including any direct, indirect, special, | ||
incidental, or consequential damages of any character arising as a | ||
result of this License or out of the use or inability to use the | ||
Work (including but not limited to damages for loss of goodwill, | ||
work stoppage, computer failure or malfunction, or any and all | ||
other commercial damages or losses), even if such Contributor | ||
has been advised of the possibility of such damages. | ||
|
||
9. Accepting Warranty or Additional Liability. While redistributing | ||
the Work or Derivative Works thereof, You may choose to offer, | ||
and charge a fee for, acceptance of support, warranty, indemnity, | ||
or other liability obligations and/or rights consistent with this | ||
License. However, in accepting such obligations, You may act only | ||
on Your own behalf and on Your sole responsibility, not on behalf | ||
of any other Contributor, and only if You agree to indemnify, | ||
defend, and hold each Contributor harmless for any liability | ||
incurred by, or claims asserted against, such Contributor by reason | ||
of your accepting any such warranty or additional liability. | ||
|
||
END OF TERMS AND CONDITIONS |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.