Setup Instructions

Step 1: Create an Azure App Registration

  1. Go to Azure Portal → App Registrations
  2. Click New registration
  3. Name: MNT Tracker
  4. Supported account types: Accounts in any organizational directory and personal Microsoft accounts
  5. Redirect URI: Select Web and enter your callback URL:
    • For local development: http://localhost:8000/auth/callback
    • For production: https://your-domain.com/auth/callback
  6. Click Register

Step 2: Configure API Permissions

  1. In your app registration, go to API permissions
  2. Click Add a permissionMicrosoft GraphDelegated permissions
  3. Add these permissions:
    • Files.Read.All — Read all files the user can access
    • User.Read — Sign in and read user profile
    • offline_access — Maintain access to data (refresh tokens)
  4. Click Add permissions

Step 3: Copy Your Client ID

  1. Go to Overview in your app registration
  2. Copy the Application (client) ID
  3. Add it to your .env file:
    AZURE_CLIENT_ID=your-client-id-here

Step 4: Set Up Your .env File

Create a .env file in the mnt_tracker directory with these values:

ANTHROPIC_API_KEY=sk-ant-xxxxx
AZURE_CLIENT_ID=your-client-id-here
AZURE_REDIRECT_URI=http://localhost:8000/auth/callback
SECRET_KEY=generate-a-random-secret-here
ONEDRIVE_ROOT_FOLDER=path/to/client/folders

Generate a secret key by running: python -c "import secrets; print(secrets.token_hex(32))"

Step 5: OneDrive Folder Structure

The scanner expects your OneDrive to have this structure:

Root Folder (e.g., "MNT Cases")
  ├── Client Name 1/
  │   ├── complaint.pdf
  │   ├── NTA.pdf
  │   ├── removal_order.pdf
  │   └── ...
  ├── Client Name 2/
  │   ├── indictment.pdf
  │   └── ...
  └── ...

Each top-level subfolder is treated as a client. The scanner will recursively search all files within each client folder.

Document Types Recognized

The scanner looks for these 19 document types in each client folder:

  • Complaint / Indictment
  • Physical Docket
  • Electronic Docket
  • Tender of Plea Sheet
  • Police Report
  • MA CORI / FBI BOP
  • Plea Colloquy Transcript
  • Drug Certificate
  • NTA
  • Removal Order
  • BIA Decision
  • USCIS Rejection Notice
  • Criminal Attorney File
  • Letter from Criminal Attorney
  • IIU Inquiry
  • USCIS FOIA
  • EOIR FOIA
  • Todd's atty affidavit
  • Client Affidavit
  • Client Affidavit Questionnaire

Running the Application

  1. Install dependencies: pip install -r requirements.txt
  2. Start the server: uvicorn mnt_tracker.app:app --reload --port 8000
  3. Open http://localhost:8000 in your browser
  4. Sign in with your Microsoft account
  5. Browse to your root client folder
  6. Click "Scan This Folder" and wait for results
  7. Download the Excel spreadsheet with clickable OneDrive links