Skip to content

rnasa-imedir/ToxScan

Repository files navigation

ToxScan-Logo

ToxScan

Programed by Cristian R. Munteanu

Affiliations:

  • RNASA-IMEDIR, CITIC, Universidade da Coruña (UDC)
  • QANAP - Applied Analytical Chemistry, UDC
  • ECOTOX - Ecotoxicology and Marine Chemical Pollution, University of Vigo (UVIGO)

What is ToxScan?

ToxScan is a mobile-friendly web application that leverages the power of Google's Gemini AI to provide an instant analysis of the ingredients listed on product labels. By simply taking a photo or uploading an image of an ingredients list, users can receive a detailed report on potential toxicity, risk levels, and the bodily systems that may be affected.

The app is designed to empower consumers with accessible information, helping them make more informed decisions about the products they use every day.

How to Use It

Using ToxScan is a simple, three-step process:

  1. Scan or Upload: On the main screen, tap "Scan ingredients" to use your device's camera or "Upload from Gallery" to select an existing photo of a product's ingredients list.
  2. Capture & Confirm: If using the camera, frame the ingredients list clearly and capture the photo. You will be shown a preview to either "Retake" or "Analyze".
  3. Review Results: Wait a few moments while the AI performs the analysis. You will then be presented with a comprehensive report including:
    • An overall Toxicity Score (0-100).
    • An Executive Summary of the product's safety profile.
    • A breakdown of Affected Systems with individual scores.
    • A detailed list of all identified Ingredients with their risk levels.

Toxicology Analysis Explained

The analysis is performed by the Gemini AI model, guided by a very specific set of instructions and a powerful search tool.

  1. OCR & Extraction: The AI first performs Optical Character Recognition (OCR) on the image to read and extract the full list of ingredients.
  2. Ingredient Analysis: For each ingredient, the AI is instructed to act as an expert toxicologist. It uses its built-in Google Search capability to query for the latest scientific consensus regarding human toxicity.
  3. Risk Classification: Ingredients are classified into risk levels (High, Medium, Low) based on a strict set of criteria, such as carcinogenic potential, organ toxicity, or irritation.
  4. Scoring: A quantitative Toxicity Score is calculated based on a fixed rubric (e.g., +25 points for each High-risk ingredient), ensuring consistency and preventing the AI from "guessing" a score.
  5. Report Generation: The final analysis is formatted into a structured JSON object that the app then displays in a user-friendly interface.

Toxicology Sources

ToxScan does not use a single, static toxicity database.

Instead, it leverages the AI's ability to perform live searches on Google. This dynamic approach ensures that the analysis is based on the most current information available from a wide range of reputable sources, including:

  • Scientific studies and peer-reviewed papers.
  • Reports from regulatory agencies (e.g., FDA, EPA).
  • Reputable health and chemical safety websites.

To ensure consistency, the AI's configuration is set to be highly deterministic (temperature: 0), forcing it to choose the most logical and fact-based answers from its search results.

Run Locally

Prerequisites: Node.js

  1. Install dependencies:
    npm install
  2. Set Environment Variable: Create a file named .env in the project root and add your API key:
    API_KEY="your_gemini_api_key_here"
    
  3. Run the app:
    npm run dev

Limitations

It is crucial to understand the limitations of this tool:

  • Not a Medical Device: ToxScan is not a substitute for professional medical, dermatological, or toxicological advice.
  • Image Quality Dependent: The accuracy of the analysis heavily depends on the quality and clarity of the image provided. Blurry or incomplete images may lead to inaccurate OCR and analysis.
  • AI-Generated Content: The results are generated by an AI and, while highly sophisticated, may not be 100% accurate or exhaustive.
  • Educational Purposes Only: The information provided is for educational and informational purposes only. Always consult with a qualified professional for health-related concerns.

Disclaimer

Results generated by AI (Gemini). Information is for educational purposes only and not medical advice. Verify with professionals.


This entire application was developed iteratively using Google AI Studio. The code, UI components, and backend logic were generated and refined through conversational prompts, demonstrating the power of AI-assisted development.