Skip to content

CloudBridgeTechnologies/WeldIT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

70 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

WeldIT GenAI PoC - Welding Document Processing API

A serverless AWS application that uses AI to extract structured data from Welding Procedure Qualification Records (WPQR) and Welding Procedure Specifications (WPS) documents.

πŸš€ Features

  • AI-Powered Document Processing: Uses Meta Llama 3.3 70B model for intelligent document extraction
  • Cross-Region Inference: Lambda functions in eu-west-2 calling Bedrock in us-east-1
  • Dual Document Support: Processes both WPQR and WPS documents
  • RESTful API: Simple HTTP endpoints for document upload and retrieval
  • Real-time Status Tracking: Monitor processing status via DynamoDB
  • Secure Access: API key authentication for all endpoints

πŸ“‹ API Endpoints

Base URL

https://ophsbkbt99.execute-api.eu-west-2.amazonaws.com/Prod

API Key

VhT1DLBGwS329LLrX0OGE1xxPpbNNQqW7GJ5g0WI

πŸ”§ API Usage

1. Get Upload URL

Endpoint: GET /get-upload-url

Parameters:

  • file: Filename for the document
  • type: Document type (wpqr or wps)

Example:

curl -H "x-api-key: VhT1DLBGwS329LLrX0OGE1xxPpbNNQqW7GJ5g0WI" \
  "https://ophsbkbt99.execute-api.eu-west-2.amazonaws.com/Prod/get-upload-url?file=my_wpqr.pdf&type=wpqr"

Response:

{
  "uuid": "12345678-1234-1234-1234-123456789012",
  "upload_url": "https://weldit-genai-poc-bucket-123.s3.eu-west-2.amazonaws.com/input/wpqr/...",
  "required_key": "input/wpqr/12345678-1234-1234-1234-123456789012_my_wpqr.pdf"
}

2. Upload Document

Method: PUT to the pre-signed URL

Example:

curl -X PUT -T "document.pdf" -H "Content-Type: application/pdf" \
  "https://weldit-genai-poc-bucket-123.s3.eu-west-2.amazonaws.com/input/wpqr/..."

3. Check Processing Status

Endpoint: GET /status

Parameters:

  • uuid: Document UUID from step 1

Example:

curl -H "x-api-key: VhT1DLBGwS329LLrX0OGE1xxPpbNNQqW7GJ5g0WI" \
  "https://ophsbkbt99.execute-api.eu-west-2.amazonaws.com/Prod/status?uuid=12345678-1234-1234-1234-123456789012"

Response:

{
  "status": "complete",
  "output_key": "processed/wpqr/12345678-1234-1234-1234-123456789012_my_wpqr.json",
  "updated_at": "2025-10-22T22:33:06.158075"
}

4. Get Extracted JSON

Endpoint: GET /json

Parameters:

  • uuid: Document UUID from step 1

Example:

curl -H "x-api-key: VhT1DLBGwS329LLrX0OGE1xxPpbNNQqW7GJ5g0WI" \
  "https://ophsbkbt99.execute-api.eu-west-2.amazonaws.com/Prod/json?uuid=12345678-1234-1234-1234-123456789012"

πŸ“„ Document Types

WPQR (Welding Procedure Qualification Record)

Extracts information including:

  • Document details (WPQR_No, Revision, Date)
  • Welding parameters (current, voltage, heat input)
  • Base materials and filler metals
  • Welding positions and processes
  • Quality control information

WPS (Welding Procedure Specification)

Extracts information including:

  • WPS number and revision
  • Welding methods and positions
  • Base material specifications
  • Filler material details
  • Welding parameters
  • Heat treatment requirements

πŸ› οΈ Complete Workflow Example

WPQR Processing

# 1. Get upload URL
RESPONSE=$(curl -s -H "x-api-key: VhT1DLBGwS329LLrX0OGE1xxPpbNNQqW7GJ5g0WI" \
  "https://ophsbkbt99.execute-api.eu-west-2.amazonaws.com/Prod/get-upload-url?file=wpqr_document.pdf&type=wpqr")

# 2. Extract UUID and upload URL
UUID=$(echo $RESPONSE | jq -r '.uuid')
UPLOAD_URL=$(echo $RESPONSE | jq -r '.upload_url')

# 3. Upload document
curl -X PUT -T "wpqr_document.pdf" -H "Content-Type: application/pdf" "$UPLOAD_URL"

# 4. Wait for processing (check status)
sleep 30
curl -H "x-api-key: VhT1DLBGwS329LLrX0OGE1xxPpbNNQqW7GJ5g0WI" \
  "https://ophsbkbt99.execute-api.eu-west-2.amazonaws.com/Prod/status?uuid=$UUID"

# 5. Get extracted JSON
curl -H "x-api-key: VhT1DLBGwS329LLrX0OGE1xxPpbNNQqW7GJ5g0WI" \
  "https://ophsbkbt99.execute-api.eu-west-2.amazonaws.com/Prod/json?uuid=$UUID"

WPS Processing

# 1. Get upload URL for WPS
RESPONSE=$(curl -s -H "x-api-key: VhT1DLBGwS329LLrX0OGE1xxPpbNNQqW7GJ5g0WI" \
  "https://ophsbkbt99.execute-api.eu-west-2.amazonaws.com/Prod/get-upload-url?file=wps_document.pdf&type=wps")

# 2. Extract UUID and upload URL
UUID=$(echo $RESPONSE | jq -r '.uuid')
UPLOAD_URL=$(echo $RESPONSE | jq -r '.upload_url')

# 3. Upload document
curl -X PUT -T "wps_document.pdf" -H "Content-Type: application/pdf" "$UPLOAD_URL"

# 4. Wait and get results
sleep 30
curl -H "x-api-key: VhT1DLBGwS329LLrX0OGE1xxPpbNNQqW7GJ5g0WI" \
  "https://ophsbkbt99.execute-api.eu-west-2.amazonaws.com/Prod/json?uuid=$UUID"

πŸ” Status Codes

  • processing: Document is being processed
  • complete: Processing finished successfully
  • error: Processing failed
  • not_found: Document UUID not found

🚨 Error Handling

Common Errors

Missing API Key:

{
  "message": "Forbidden"
}

Invalid UUID:

{
  "status": "not_found"
}

Processing Error:

{
  "status": "error",
  "error_message": "Processing failed"
}

πŸ—οΈ Architecture

  • API Gateway: RESTful API endpoints
  • Lambda Functions: Serverless processing
  • S3: Document storage and retrieval
  • DynamoDB: Processing status tracking
  • EventBridge: Event-driven processing
  • Bedrock: AI model inference (cross-region)
  • SNS: Notifications (optional)

πŸ” Security

  • API key authentication required for all endpoints
  • Pre-signed URLs for secure document uploads
  • IAM roles for service-to-service communication
  • CORS enabled for web applications

πŸ“Š Performance

  • Processing Time: Typically 15-30 seconds per document
  • Concurrent Processing: Supports multiple documents simultaneously
  • Model: Meta Llama 3.3 70B (cross-region inference)
  • Region: Lambda in eu-west-2, Bedrock in us-east-1

πŸ§ͺ Testing

All endpoints have been tested and verified:

  • βœ… WPQR document processing
  • βœ… WPS document processing
  • βœ… Status tracking
  • βœ… JSON extraction
  • βœ… Error handling
  • βœ… Cross-region inference

Testing with Postman

Postman is an excellent tool for testing and exploring APIs. Here's how to test the WeldIT API using Postman:

1. Setup API Key Authentication

  1. Create a new Collection in Postman
  2. Go to the Collection settings -> Authorization
  3. Select "API Key" as the type
  4. Enter the following details:
    • Key: x-api-key
    • Value: VhT1DLBGwS329LLrX0OGE1xxPpbNNQqW7GJ5g0WI
    • Add to: "Header"
  5. Click "Save"

2. Get Upload URL Request

  1. Create a new GET request
  2. URL: https://ophsbkbt99.execute-api.eu-west-2.amazonaws.com/Prod/get-upload-url
  3. Add query parameters:
    • file: my_wpqr.pdf
    • type: wpqr
  4. Send the request
  5. Save the returned uuid and upload_url

3. Upload Document Request

  1. Create a new PUT request
  2. URL: Use the upload_url from the previous step
  3. Go to the "Body" tab, select "binary"
  4. Click "Select File" and choose your WPQR or WPS PDF document
  5. Send the request (Note: Unlike the Collection authorization, this request doesn't need the API key as it uses a pre-signed URL)

4. Check Status Request

  1. Create a new GET request
  2. URL: https://ophsbkbt99.execute-api.eu-west-2.amazonaws.com/Prod/status
  3. Add query parameter:
    • uuid: Use the UUID from step 2
  4. Send the request
  5. Check that the status is "complete"

5. Get JSON Request

  1. Create a new GET request
  2. URL: https://ophsbkbt99.execute-api.eu-west-2.amazonaws.com/Prod/json
  3. Add query parameter:
    • uuid: Use the UUID from step 2
  4. Send the request
  5. Review the extracted JSON data

6. Save as a Collection

Save all these requests as a collection for easy reuse. You can also create environments to test with different documents and parameters.

πŸ“ž Support

For issues or questions, please check the CloudWatch logs for the Lambda functions or contact the development team.


Last Updated: October 22, 2025
Version: 1.0.0
Status: Production Ready βœ…

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages