Spaces:
Runtime error
Runtime error
File size: 3,963 Bytes
3d8755c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | # 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! π
|