Skip to content
saadah7Public

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

AURA - Accurate, Ubiquitous and Rapid Assaying

A complete full-stack prototype system for gold purity analysis with certificate generation, designed to run on Raspberry Pi 4 with mobile app connectivity.

System Overview

This system provides:

  • ML-powered gold purity analysis using spectroscopic parameters (f0, A0, Q)
  • Professional PDF certificate generation with QR codes and digital signatures
  • Mobile app interface for field testing and analysis
  • Web-based certificate verification with tamper detection
  • SQLite database for secure result storage

Architecture

Backend (Python/FastAPI)

  • FastAPI web framework with automatic API documentation
  • SQLite database for storing analysis results and certificates
  • scikit-learn machine learning model for purity prediction
  • ReportLab PDF generation with professional formatting
  • QR code generation for certificate verification links
  • SHA256 hashing for certificate integrity verification

Mobile App (React Native/Expo)

  • Expo React Native app for cross-platform mobile support
  • Axios HTTP client for backend API communication
  • Professional UI with input validation and error handling
  • Certificate download and sharing functionality
  • Real-time analysis with loading states and feedback

Verification System

  • Web-based verification accessible via QR codes
  • Certificate integrity checking using SHA256 hashes
  • Responsive design for mobile and desktop access
  • API endpoints for programmatic verification

Quick Start

1. Backend Setup (Raspberry Pi 4)

```bash

Clone or copy the backend folder to your Raspberry Pi

cd backend

Create virtual environment

python3 -m venv venv source venv/bin/activate

Install dependencies

pip install -r requirements.txt

Start the server

python main.py ```

The server will start on http://0.0.0.0:8000 and display your local IP address.

2. Mobile App Setup

```bash

Install Expo CLI globally

npm install -g @expo/cli

Navigate to frontend directory

cd frontend

Install dependencies

npm install

Update backend URL in App.js

Change BACKEND_URL to your Raspberry Pi's IP address

Start development server

npm start

Scan QR code with Expo Go app on your phone

```

3. Usage Workflow

  1. Input Parameters: Enter f0, A0, Q values in mobile app
  2. Analysis: Tap "Analyze Sample" to get ML prediction
  3. Certificate: Download PDF certificate with QR code
  4. Verification: Scan QR code or visit verification URL
  5. Integrity Check: System validates certificate hasn't been tampered with

API Endpoints

Method Endpoint Description
GET / API status and version
POST /api/scan Analyze gold sample parameters
GET /api/certificate/{id} Download PDF certificate
GET /verify/{id} Web verification page
GET /api/verify/{id} JSON verification data

Machine Learning Model

The system uses a Random Forest classifier trained on spectroscopic features:

  • Input Features: f0 (frequency), A0 (amplitude), Q (quality factor)
  • Output Classes: 18K Gold, 22K Gold, 24K Gold, Gold Plated
  • Model File: rf_model.joblib (auto-generates dummy model if not provided)

Security Features

  • Certificate Hashing: SHA256 hashes prevent tampering
  • Unique IDs: UUID-based certificate identification
  • Integrity Verification: Real-time hash checking
  • Secure Storage: SQLite database with proper schema

Network Configuration

Finding Your Raspberry Pi IP

```bash hostname -I ```

Mobile App Configuration

Update the BACKEND_URL in frontend/App.js: ```javascript const BACKEND_URL = "http://YOUR_PI_IP:8000" ```

Firewall (if needed)

```bash sudo ufw allow 8000 ```

File Structure

``` gold-purity-system/ ├── backend/ │ ├── main.py # FastAPI application │ ├── database.py # SQLite database operations │ ├── ml_model.py # Machine learning model │ ├── certificate_generator.py # PDF generation │ ├── utils.py # Utility functions │ ├── requirements.txt # Python dependencies │ └── README.md # Backend documentation ├── frontend/ │ ├── App.js # React Native main component │ ├── package.json # Node.js dependencies │ ├── app.json # Expo configuration │ └── README.md # Frontend documentation └── README.md # This file ```

Troubleshooting

Backend Issues

  • Port already in use: Change port in main.py or kill existing process
  • Module not found: Ensure virtual environment is activated and dependencies installed
  • Database errors: Delete gold_purity.db to reset database

Mobile App Issues

  • Connection refused: Verify backend URL and network connectivity
  • Expo errors: Update Expo CLI and clear cache with expo r -c
  • Certificate download fails: Check backend is running and accessible

Network Issues

  • Can't connect from phone: Ensure devices are on same WiFi network
  • Firewall blocking: Configure firewall to allow port 8000
  • IP address changes: Update mobile app configuration when Pi IP changes

Production Deployment

For production use, consider:

  • HTTPS/SSL certificates for secure communication
  • Authentication system for user management
  • Database backup and recovery procedures
  • Load balancing for multiple concurrent users
  • Model retraining pipeline for improved accuracy

License

This is a prototype system for educational and testing purposes. Ensure compliance with local regulations for commercial gold assay operations.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages