cleanflowai / QUICK_TEST_GUIDE.md
KiranParthiban's picture
docs: add comprehensive testing guide for API endpoints
3d8755c
|
Raw History Blame Contribute Delete
3.96 kB
# Quick Testing Guide - CleanFlow AI
## βœ… **WORKING SOLUTION**
## 🎯 **Correct Way to Test in Browser**
### **Step 1: Go to API Docs**
Visit: `http://localhost:8000/docs`
### **Step 2: Test POST /transform/file**
1. Click on `POST /transform/file`
2. Click "Try it out"
3. **IMPORTANT**: Set parameters correctly:
- `file`: Upload `test_simple_netsuite.csv`
- `auto_select_erp`: `true` βœ…
- `auto_select_entity`: `true` βœ…
- `entity`: **LEAVE EMPTY** (don't put "string") ❌
- `erp`: **LEAVE EMPTY** (don't put "string") ❌
- `output_format`: `json`
### **Step 3: Expected Success Response**
```json
{
"success": true,
"data": [
{
"order_id": "SO1001",
"order_date": "2025-08-04",
"customer_id": "CUST01",
"status": "Pending Fulfillment",
"currency": "USD",
"total_amount": 1249.0,
"notes": "Rush order for Q4",
"item_id": null,
"description": null,
"quantity": null,
"unit_price": null,
"line_total": null,
"tax_code": null
}
],
"detected_erp": "NetSuite",
"detected_entity": "sales_orders",
"transformation_mode": "template",
"confidence_score": 0.85,
"message": "Successfully transformed using template mapping",
"column_mappings": {
"tranid": "order_id",
"trandate": "order_date",
"entity": "customer_id",
"status": "status",
"currency": "currency",
"total": "total_amount",
"memo": "notes"
},
"row_count": 3,
"processing_time_ms": 45.2
}
```
## πŸ”§ **Alternative: Use cURL Command**
Copy and paste this exact command in your terminal:
```bash
curl -X 'POST' \
'http://localhost:8000/transform/file' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F 'file=@test_simple_netsuite.csv;type=text/csv' \
-F 'auto_select_erp=true' \
-F 'auto_select_entity=true' \
-F 'output_format=json'
```
**Note**: No `entity` or `erp` parameters - let auto-detection work!
## πŸ§ͺ **Test Different Files**
### **Test 1: NetSuite Sales Orders**
- File: `test_simple_netsuite.csv`
- Expected ERP: `NetSuite`
- Expected Entity: `sales_orders`
### **Test 2: SAP Customers**
- File: `test_sap_customers.csv`
- Expected ERP: `SAP ERP`
- Expected Entity: `customers`
### **Test 3: Oracle Invoices**
- File: `test_oracle_invoices.json`
- Expected ERP: `Oracle Fusion`
- Expected Entity: `invoices`
## πŸ“Š **What to Look For in Results**
### **Success Indicators:**
- βœ… `"success": true`
- βœ… `"detected_erp"` shows correct ERP system
- βœ… `"detected_entity"` shows correct entity type
- βœ… `"confidence_score"` > 0.6
- βœ… `"data"` contains transformed records
- βœ… `"column_mappings"` shows field mappings
### **Data Transformation:**
- **Input**: ERP-specific column names (e.g., `tranId`, `trandate`)
- **Output**: Standardized CDF names (e.g., `order_id`, `order_date`)
- **Missing Fields**: Filled with `null` values
- **Data Types**: Properly formatted (dates, decimals, etc.)
## πŸš€ **Quick Validation Steps**
1. **Health Check**: `GET /health` β†’ Should return healthy status
2. **List ERPs**: `GET /erps` β†’ Should show 11 ERP systems
3. **List Entities**: `GET /entities` β†’ Should show 5 entity types
4. **Transform File**: `POST /transform/file` β†’ Should transform data successfully
## πŸ” **Troubleshooting**
### **Common Mistakes:**
- ❌ Putting "string" in entity/erp fields
- ❌ Not setting auto_select_* to true
- ❌ Using wrong file format
### **If You Get Errors:**
1. Check the `message` field in response
2. Ensure file is properly formatted
3. Try with `test_simple_netsuite.csv` first
4. Use auto-detection (leave entity/erp empty)
## πŸ“ˆ **Performance Expectations**
- **Small files** (< 1MB): < 100ms
- **Medium files** (1-10MB): < 500ms
- **Processing**: Real-time transformation
- **Memory**: Efficient with Polars + DuckDB
The application is working perfectly - just need to use the correct parameters! πŸŽ‰