Skip to content

willimj3/claude-code-risk-factors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Risk-Factor Extractor

A minimal Flask web application that analyzes SEC filings to extract AI-related risk factors using OpenAI's API.

Features

  • Upload SEC filings in .txt format
  • Automatically extract AI-related risk factors including:
    • Artificial Intelligence (AI)
    • Machine Learning (ML)
    • Algorithms
    • Automation
    • Generative AI
    • Large Language Models
  • Get structured results with:
    • Risk factor title
    • Summary of the risk
    • Confidence score (high/medium/low)

Project Structure

.
├── app.py                  # Flask application with routes and OpenAI integration
├── templates/
│   └── index.html         # Upload form and results display
├── uploads/               # Directory for uploaded files (gitignored)
├── requirements.txt       # Python dependencies
├── .env.example          # Example environment variables
└── README.md             # This file

Setup Instructions

1. Clone or download this repository

cd claude-code-risk-factors

2. Create a virtual environment (recommended)

python -m venv venv

# On Linux/Mac:
source venv/bin/activate

# On Windows:
venv\Scripts\activate

3. Install dependencies

pip install -r requirements.txt

4. Set up your OpenAI API key

  1. Copy .env.example to .env:

    cp .env.example .env
  2. Get your OpenAI API key from: https://platform.openai.com/api-keys

  3. Edit .env and replace your_openai_api_key_here with your actual API key:

    OPENAI_API_KEY=sk-...
    

5. Run the application

python app.py

The app will start on http://localhost:5000

Usage

  1. Open your browser and navigate to http://localhost:5000
  2. Click "Choose File" and select a .txt file containing an SEC filing
  3. Click "Analyze File"
  4. Wait for the analysis to complete
  5. View the extracted AI-related risk factors with their summaries and confidence scores

Example SEC Filing Text

You can test the app with a sample SEC filing excerpt. Create a file called sample.txt with content like:

Risk Factors

We may face risks related to our use of artificial intelligence and machine learning
technologies. Our AI systems may produce unexpected results or biased outputs that could
harm our reputation or result in regulatory scrutiny. Additionally, we rely on large
language models and generative AI for customer service automation, which may fail to
meet customer expectations or violate data privacy regulations.

Our algorithms for content recommendation use complex machine learning models that
process user data. Changes in AI regulation, particularly in the European Union, could
require significant modifications to our systems and business practices.

Technical Notes

  • The app uses OpenAI's gpt-4o-mini model for cost-efficient analysis
  • Maximum file size: 16 MB
  • Only .txt files are supported
  • Files are temporarily stored in the uploads/ directory
  • The app uses standard Flask patterns (no async, minimal JavaScript)

Production Deployment

For production use:

  1. Set debug=False in app.py
  2. Use a production WSGI server like gunicorn:
    gunicorn -w 4 -b 0.0.0.0:5000 app:app
  3. Set up proper environment variable management
  4. Configure HTTPS
  5. Implement rate limiting and authentication as needed

Cost Considerations

This app calls the OpenAI API for each file upload. Costs depend on:

  • The length of the SEC filing
  • The number of requests
  • The OpenAI model used (currently gpt-4o-mini)

Monitor your usage at: https://platform.openai.com/usage

License

This is a educational project for learning Flask and OpenAI API integration.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors