Skip to content

kandhah/constrution_contract_analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Construction Contract Analysis with AI

A React-based application that uses AI to analyze construction contracts, extract key terms, assess risks, and provide recommendations. Built with Autodesk LLM Proxy integration.

Features

  • Document Classification: Automatically recognizes construction contract documents
  • AI-Powered Analysis: Extracts key contract terms using Autodesk LLM Proxy
  • Multi-Format Support: Handles text files, PDFs, documents, and images
  • Attachment-Based Processing: Direct file analysis without text extraction
  • Risk Assessment: Evaluates contract risks and provides recommendations
  • Two-Pane Interface: Side-by-side view of analysis results and original document
  • Key Term Extraction: Identifies critical clauses including:
    • Indemnification clauses
    • Deliverables and scope of work
    • Liquidated damages provisions
    • Payment terms and schedules
    • Change order procedures
    • Termination clauses
    • Insurance requirements
    • Warranty provisions
    • Force majeure clauses
    • Dispute resolution mechanisms

Technology Stack

  • Frontend: React 19 with TypeScript
  • UI Framework: Material-UI (MUI)
  • File Upload: React Dropzone
  • AI Service: Autodesk LLM Proxy (Claude Sonnet 3.7)
  • Node.js: Version 22

Prerequisites

  • Node.js v22 (managed via nvm)
  • Autodesk Developer Account with API access
  • Valid Autodesk Client ID and Client Secret

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd construction_contract_analysis
  2. Use Node.js v22:

    nvm use 22
  3. Install dependencies:

    npm install
  4. Set up environment variables: Create a .env file in the root directory:

    REACT_APP_AUTODESK_CLIENT_ID=your_client_id
    REACT_APP_AUTODESK_CLIENT_SECRET=your_client_secret
    REACT_APP_AUTODESK_AI_SERVICE_URL=https://developer-stg.api.autodesk.com/aiservice/model/invoke
    

Usage

  1. Start the development server:

    npm start
  2. Open your browser and navigate to http://localhost:3000

  3. Upload a contract:

    • Drag and drop a file or click to select
    • Supports: TXT, PDF, DOC, DOCX, and Images (JPG, PNG, etc.)
    • The system will automatically classify the document
    • If it's a construction contract, analysis will begin
  4. Review results:

    • Left pane: Analysis results with extracted terms and risk assessment
    • Right pane: Original document with highlighting
    • Click on terms to highlight them in the document

Sample Contract

A sample construction contract is provided in public/sample-contract.txt for testing purposes.

API Integration

The application integrates with Autodesk's LLM Proxy service using:

  • Authentication: OAuth 2.0 client credentials flow
  • Model: Claude Sonnet 3.7 v1
  • Endpoints:
    • Authentication: https://developer-stg.api.autodesk.com/authentication/v2/token
    • AI Service: https://developer-stg.api.autodesk.com/aiservice/model/invoke

Project Structure

src/
├── components/
│   ├── FileUpload.tsx          # File upload with drag & drop
│   ├── AnalysisResults.tsx     # Contract analysis display
│   └── DocumentViewer.tsx      # Document viewer with highlighting
├── services/
│   └── AutodeskService.ts      # Autodesk API integration
├── config/
│   └── environment.ts          # Environment configuration
└── App.tsx                     # Main application component

Key Components

FileUpload Component

  • Drag and drop interface for contract files
  • Automatic document classification
  • Support for multiple file formats: TXT, PDF, DOC, DOCX, Images
  • Attachment-based processing for optimal AI analysis

AnalysisResults Component

  • Displays extracted contract terms
  • Risk assessment with color coding
  • Expandable sections by term type
  • Interactive term selection

DocumentViewer Component

  • Displays original contract text
  • Highlights selected terms
  • Document metadata display

AutodeskService

  • Handles authentication with Autodesk API
  • Contract analysis using AI models
  • Document classification functionality

Contract Terms Extracted

The AI analyzes contracts for these key terms:

  1. Indemnification Clauses: Liability and responsibility terms
  2. Deliverables: Scope of work and project requirements
  3. Liquidated Damages: Penalty clauses for delays
  4. Payment Terms: Payment schedules and amounts
  5. Change Orders: Procedures for scope modifications
  6. Termination: Contract termination conditions
  7. Insurance: Required insurance coverage
  8. Warranty: Warranty periods and coverage
  9. Force Majeure: Uncontrollable circumstances clauses
  10. Dispute Resolution: Conflict resolution mechanisms

Risk Assessment

Each extracted term is assessed for risk level:

  • High Risk: Requires immediate attention
  • Medium Risk: Should be reviewed carefully
  • Low Risk: Standard terms with minimal concern

Development

Adding New Term Types

  1. Update the ContractTerm interface in AutodeskService.ts
  2. Modify the AI prompt to include the new term type
  3. Update the UI components to handle the new term type

Extending Document Support

  1. Add new file type handlers in FileUpload.tsx
  2. Update the dropzone accept configuration
  3. Add MIME type support in the attachment processing logic
  4. For complex formats, consider attachment-based processing over text extraction

Troubleshooting

Common Issues

  1. Authentication Errors: Verify your Autodesk credentials
  2. File Upload Issues: Ensure file is a supported text format
  3. Analysis Failures: Check network connectivity and API limits

Environment Variables

Make sure all required environment variables are set:

  • REACT_APP_AUTODESK_CLIENT_ID
  • REACT_APP_AUTODESK_CLIENT_SECRET
  • REACT_APP_AUTODESK_AI_SERVICE_URL

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes and commit: git commit -am 'Add feature'
  4. Push to the branch: git push origin feature-name
  5. Submit a pull request

License

This project is licensed under the MIT License.

Support

For support or questions:

  • Review the troubleshooting section
  • Check the Autodesk Developer documentation
  • Open an issue in the repository

Built with ❤️ for the construction industry using Autodesk AI technology.

About

A React-based application that uses AI to analyze construction contracts, extract key terms, assess risks, and provide recommendations. Built with Autodesk LLM Proxy integration.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors