Skip to content

feat: Add body part selector to scope AI analysis by medical specialty#30

Open
ArnavPundir22 wants to merge 6 commits into
fizaayesha:mainfrom
ArnavPundir22:feature/EntryPoint
Open

feat: Add body part selector to scope AI analysis by medical specialty#30
ArnavPundir22 wants to merge 6 commits into
fizaayesha:mainfrom
ArnavPundir22:feature/EntryPoint

Conversation

@ArnavPundir22
Copy link
Copy Markdown
Contributor

@ArnavPundir22 ArnavPundir22 commented Apr 26, 2026

NSoC'26

Closes Issue #27


Add Body Part Selector to Scope AI Analysis by Medical Specialty

Summary

Adds a body part selector dropdown to the Disease Identifier UI. When a user picks a body part, the Gemini system prompt is automatically enriched with the relevant medical specialty context — making AI diagnoses more targeted and clinically accurate.


What's Changed

app.py

  • Added BODY_PART_SPECIALTY mapping for 7 body regions:

    Body Part Medical Specialty
    Eye Ophthalmology
    Chest Cardiology / Radiology
    Skin Dermatology
    Head Neurology
    Throat ENT (Ear, Nose and Throat)
    Limbs Orthopedics
    Abdomen Gastroenterology
    General (no scoping — default)
  • Replaced static system prompt with build_system_prompt(body_part) — injects specialty context for non-General selections.

  • Added st.selectbox before the file uploader for body part selection.

  • Added st.info banner showing the resolved specialty (e.g. "🔬 Analysis will be scoped to Dermatology").

  • Persisted body_part in metadata.json so history entries retain specialty context.

  • Displayed body part + specialty labels in both live results and historical analysis cards.


🔍 Why

Without body part context, the AI applies a generic medical lens to every image. By injecting the relevant specialty into the system prompt, the model focuses on conditions, terminology, and patterns specific to that region — producing more clinically relevant results.


🧪 How to Test

  1. Run: streamlit run app.py
  2. Select a body part (e.g. Skin) → confirm banner shows "🔬 Analysis will be scoped to Dermatology"
  3. Upload a medical image → click Generate Analysis
  4. Verify result card displays body part + specialty labels
  5. Check sidebar history — confirm the correct body part is saved

Disclaimer: This tool is for educational and informational purposes only. Always consult a qualified doctor before making any medical decisions.

Copilot AI and others added 4 commits April 24, 2026 15:56
…rompt

> Adds a body part selector (dropdown) to the UI that injects a targeted medical specialty context into the Gemini system prompt, improving diagnostic specificity.

Changes in app.py:

- Added BODY_PART_SPECIALTY dict mapping 7 body parts to medical specialties (Eye → Ophthalmology, Chest → Cardiology/Radiology, Skin → Dermatology, Head → Neurology, Throat → ENT, Limbs → Orthopedics, Abdomen → Gastroenterology); General maps to None
- Replaced static system_prompt string with build_system_prompt(body_part) function that appends a specialty-scoped context block for non-General body parts
- Added st.selectbox before the file uploader with an inline st.info banner showing the resolved specialty
- Persisted body_part to metadata.json and displayed it alongside the specialty label in both live and historical analysis results
Added a flow diagram for user image upload process.
@fizaayesha
Copy link
Copy Markdown
Owner

Please resolve conflicts

@fizaayesha
Copy link
Copy Markdown
Owner

Please resolve conflicts @ArnavPundir22

@ArnavPundir22
Copy link
Copy Markdown
Contributor Author

Hey @fizaayesha, Please check, I am done with resolving conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants