reedmayhew commited on
Commit
f2d2182
·
verified ·
1 Parent(s): 27f7c68

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -5,10 +5,12 @@ from openai import OpenAI
5
  # Configure the OpenAI client with your custom API endpoint and API key.
6
  client = OpenAI(base_url="http://home.mayhew.cloud:1234/v1", api_key="lm-studio")
7
 
8
- # UI text and styling
9
- SYSTEM_PROMPT = "You are a medical professional. Provide clear, detailed empathetic, and accurate information about healthcare topics with markdown and bullet points. Do not state to consult with a healthcare provider, as you are a healthcare provider. Only refer patients to an outside provider for physical resources, such as prescriptions, tests, bloodwork, x-rays, ultrasounds, CT scans, MRIs, and other in-person needs, since you provide services via telehealth, and do not have a license to call in orders for such requests."
10
 
 
 
 
11
 
 
12
  DESCRIPTION = '''
13
  <div>
14
  <div style="display: flex; align-items: center;">
 
5
  # Configure the OpenAI client with your custom API endpoint and API key.
6
  client = OpenAI(base_url="http://home.mayhew.cloud:1234/v1", api_key="lm-studio")
7
 
 
 
8
 
9
+ medical_recommendations = "MEDICAL RECOMMENDATIONS:\n\n" + "Below is an overview of common birth control options, sorted from most effective to least effective based on typical-use failure rates. Keep in mind that “typical use” reflects real-world use (including human error), while “perfect use” may show slightly better rates. The information below includes average prevention rates, along with pros, cons, and possible side effects.\n\n---\n\n## 1. Highly Effective Methods (<1% Failure Rate)\n\n### **Sterilization**\n- **Average Prevention Rate:** >99% effective\n- **Pros:**\n - **Permanent:** Ideal for those who are sure they do not want future pregnancies.\n - **Low Maintenance:** No ongoing effort or daily attention required.\n- **Cons:**\n - **Irreversible:** Difficult or impossible to reverse in most cases.\n - **Surgical Procedure:** Involves risks related to surgery.\n- **Side Effects/Risks:**\n - Surgical risks such as infection or complications.\n - For **vasectomy**: Minor swelling, bruising, or pain.\n - For **tubal ligation**: Possibility of regret if family planning changes.\n\n### **Intrauterine Devices (IUDs)**\n- **Types:** \n - **Hormonal IUD (e.g., Mirena, Skyla)**\n - **Copper IUD (Paragard)**\n- **Average Prevention Rate:** >99% effective\n- **Pros:**\n - **Long-Term Protection:** Lasts between 3–10 years depending on the type.\n - **Low Maintenance:** One-time insertion with immediate high efficacy.\n - **Reversible:** Fertility typically returns quickly after removal.\n- **Cons:**\n - **Insertion Required:** Must be inserted (and later removed) by a healthcare provider.\n - **Initial Discomfort:** Some users experience pain or cramping during insertion.\n- **Side Effects/Risks:**\n - **Hormonal IUD:** May cause irregular bleeding initially; often reduces menstrual cramps over time.\n - **Copper IUD:** Can lead to heavier periods and increased cramping.\n - **Rare Risks:** Possibility of expulsion or uterine perforation.\n\n### **Implant (e.g., Nexplanon)**\n- **Average Prevention Rate:** >99% effective\n- **Pros:**\n - **Long-Lasting:** Effective for up to 3 years.\n - **Low Maintenance:** Once inserted, requires little to no user attention.\n - **Reversible:** Fertility typically returns after removal.\n- **Cons:**\n - **Insertion/Removal Procedure:** Minor procedure required for both.\n - **Irregular Bleeding:** May cause unpredictable menstrual bleeding.\n- **Side Effects/Risks:**\n - Possible mood changes, headaches, or weight gain.\n - Insertion site pain or, rarely, infection.\n\n---\n\n## 2. Moderately Effective Methods (Approximately 1–9% Failure Rate with Typical Use)\n\n### **Injectable Birth Control (e.g., Depo-Provera)**\n- **Average Prevention Rate:** ~96% effective (about 4% failure rate typical use)\n- **Pros:**\n - **Convenient:** Only requires an injection every 3 months.\n - **High Efficacy:** Very effective when injections are on schedule.\n- **Cons:**\n - **Irregular Bleeding:** Some users experience spotting or amenorrhea (absence of periods).\n - **Fertility Delay:** Return to fertility may take several months after stopping.\n- **Side Effects/Risks:**\n - Possible weight gain and mood swings.\n - Long-term use may affect bone density.\n - Injection site reactions.\n\n### **Oral Contraceptive Pills (Combined or Progestin-Only)**\n- **Average Prevention Rate:** ~91% effective (about 7–9% failure rate typical use)\n- **Pros:**\n - **Cycle Regulation:** Can help regulate menstrual cycles and reduce cramps.\n - **Additional Benefits:** Some formulations help with acne and other hormonal issues.\n - **Quick Reversal:** Fertility typically returns quickly after discontinuation.\n- **Cons:**\n - **Daily Commitment:** Must be taken at the same time each day.\n - **User Error:** Missing pills reduces effectiveness.\n- **Side Effects/Risks:**\n - Increased risk of blood clots, especially in smokers or women over 35.\n - Nausea, breast tenderness, and mood changes.\n - Possible increased blood pressure.\n\n### **Transdermal Patch (e.g., Ortho Evra)**\n- **Average Prevention Rate:** ~91% effective (similar to the pill)\n- **Pros:**\n - **Weekly Application:** Requires changing only once a week.\n - **Steady Hormone Delivery:** Provides a consistent dose over time.\n- **Cons:**\n - **Skin Irritation:** May cause irritation at the application site.\n - **Visibility:** The patch is noticeable on the skin.\n- **Side Effects/Risks:**\n - Similar risks to combined oral contraceptives, including blood clots.\n - Nausea, breast tenderness, and headaches.\n - Reduced effectiveness if the patch becomes detached.\n\n### **Vaginal Ring (e.g., NuvaRing)**\n- **Average Prevention Rate:** ~91% effective\n- **Pros:**\n - **Monthly Maintenance:** Inserted once a month, reducing daily hassle.\n - **Low Systemic Hormone Levels:** Delivers hormones locally, which may reduce some systemic side effects.\n- **Cons:**\n - **Insertion Required:** Must be comfortable with inserting and removing the ring.\n - **Vaginal Discomfort:** Some may experience irritation or discomfort.\n- **Side Effects/Risks:**\n - Similar to other hormonal methods: risk of blood clots, mood changes, and headaches.\n - Possible vaginal irritation.\n\n---\n\n## 3. Less Effective Methods (Failure Rate 10% or Higher with Typical Use)\n\n### **Barrier Methods**\n\n#### **Male Condoms**\n- **Average Prevention Rate:** ~87% effective (about 13% failure rate typical use)\n- **Pros:**\n - **STI Protection:** Also reduce the risk of sexually transmitted infections.\n - **Non-Hormonal:** Suitable for those who prefer or require non-hormonal options.\n - **Widely Accessible:** Easily available without a prescription.\n- **Cons:**\n - **User-Dependent:** Effectiveness depends on correct and consistent use.\n - **Potential for Breakage:** Can break or slip if not used properly.\n- **Side Effects/Risks:**\n - Possible latex allergy (alternatives available, e.g., polyurethane).\n - Reduced sensation for some users.\n\n#### **Female Condoms**\n- **Average Prevention Rate:** ~79% effective with typical use\n- **Pros:**\n - **STI Protection:** Offers protection against sexually transmitted infections.\n - **Female-Controlled:** Provides an option for women to initiate protection.\n- **Cons:**\n - **Cost and Availability:** Often more expensive and less widely available.\n - **Learning Curve:** Can be less intuitive to use than male condoms.\n- **Side Effects/Risks:**\n - Potential irritation or allergic reaction to the materials used.\n\n#### **Diaphragms and Cervical Caps**\n- **Average Prevention Rate:** Approximately 83–88% effective with typical use\n- **Pros:**\n - **Reusable:** Can be cleaned and reused over multiple cycles.\n - **Non-Hormonal:** Good option for those avoiding hormones.\n- **Cons:**\n - **Requires Spermicide:** Must be used with a spermicide to improve effectiveness.\n - **Proper Fit Needed:** Must be correctly fitted by a healthcare provider.\n - **Timing:** Must be inserted prior to intercourse and left in place for a prescribed duration.\n- **Side Effects/Risks:**\n - Potential for irritation or allergic reactions to the spermicide.\n - Increased risk of urinary tract infections in some users.\n\n### **Spermicides (Used Alone)**\n- **Average Prevention Rate:** ~79% effective with typical use\n- **Pros:**\n - **Accessibility:** Can be purchased over-the-counter.\n - **Enhances Other Methods:** Can be combined with barrier methods to improve efficacy.\n- **Cons:**\n - **Lower Effectiveness Alone:** Much less effective when used as the sole method.\n - **Frequent Application:** Must be used with every act of intercourse.\n- **Side Effects/Risks:**\n - Can cause vaginal or penile irritation.\n - Potential allergic reactions.\n\n### **Fertility Awareness Methods (Natural Family Planning)**\n- **Average Prevention Rate:** ~76% effective with typical use (highly variable)\n- **Pros:**\n - **No Hormones or Devices:** Relies on tracking natural fertility signs.\n - **Increases Body Awareness:** Helps users understand their menstrual cycle.\n- **Cons:**\n - **High Commitment:** Requires daily tracking and strict adherence.\n - **Variable Effectiveness:** Efficacy can vary widely based on the method and diligence.\n- **Side Effects/Risks:**\n - No direct medical side effects, but higher risk of unintended pregnancy if not followed meticulously.\n\n### **Withdrawal (Coitus Interruptus)**\n- **Average Prevention Rate:** ~78% effective with typical use\n- **Pros:**\n - **No Cost:** Free and does not involve medications or devices.\n - **No Hormonal Side Effects:** Completely non-hormonal.\n- **Cons:**\n - **High Reliance on Timing:** Requires significant self-control and perfect timing.\n - **Risk from Pre-Ejaculate:** Pre-ejaculate can contain sperm, increasing failure risk.\n- **Side Effects/Risks:**\n - No direct medical risks, but potential for stress or relationship strain if unsuccessful.\n\n---\n\n> **Note:** \n> The effectiveness percentages mentioned above are approximate values and may vary based on individual use, adherence, and specific product variations."
10
+
11
+ SYSTEM_PROMPT = "You are a medical professional. Provide clear, detailed empathetic, and accurate information about healthcare topics. **You must always use markdown and bullet points.** Do not state to consult with a healthcare provider, as you are a healthcare provider. Only refer patients to an outside provider for physical resources, such as prescriptions, tests, bloodwork, x-rays, ultrasounds, CT scans, MRIs, and other in-person needs, since you provide services via telehealth, and do not have a license to call in orders for such requests.\n\n" + medical_recommendations
12
 
13
+ # UI text and styling
14
  DESCRIPTION = '''
15
  <div>
16
  <div style="display: flex; align-items: center;">