Delete MONGODB_DATA_STRUCTURE.md
Browse files- MONGODB_DATA_STRUCTURE.md +0 -197
MONGODB_DATA_STRUCTURE.md
DELETED
|
@@ -1,197 +0,0 @@
|
|
| 1 |
-
# MongoDB Data Storage Structure
|
| 2 |
-
|
| 3 |
-
This document describes exactly what data is stored in MongoDB when you use the Image Colorization API.
|
| 4 |
-
|
| 5 |
-
## Database: `colorization_db`
|
| 6 |
-
|
| 7 |
-
### Collection 1: `api_calls`
|
| 8 |
-
|
| 9 |
-
Stores every API endpoint call with timestamp.
|
| 10 |
-
|
| 11 |
-
**Data Structure:**
|
| 12 |
-
```json
|
| 13 |
-
{
|
| 14 |
-
"_id": ObjectId("..."), // MongoDB auto-generated ID
|
| 15 |
-
"endpoint": "/health", // API endpoint path
|
| 16 |
-
"method": "GET", // HTTP method (GET, POST)
|
| 17 |
-
"status_code": 200, // HTTP status code
|
| 18 |
-
"timestamp": ISODate("2025-11-27T04:22:27.823Z"), // UTC timestamp when API was called
|
| 19 |
-
"request_data": { // Request parameters/data
|
| 20 |
-
"filename": "Descratch.png",
|
| 21 |
-
"content_type": "image/png"
|
| 22 |
-
},
|
| 23 |
-
"response_data": { // Response data returned
|
| 24 |
-
"status": "healthy",
|
| 25 |
-
"model_loaded": true
|
| 26 |
-
},
|
| 27 |
-
"error": null, // Error message if any
|
| 28 |
-
"user_id": null, // User ID if authenticated
|
| 29 |
-
"ip_address": "127.0.0.1" // Client IP address
|
| 30 |
-
}
|
| 31 |
-
```
|
| 32 |
-
|
| 33 |
-
**Example for `/upload` endpoint:**
|
| 34 |
-
```json
|
| 35 |
-
{
|
| 36 |
-
"endpoint": "/upload",
|
| 37 |
-
"method": "POST",
|
| 38 |
-
"status_code": 200,
|
| 39 |
-
"timestamp": ISODate("2025-11-27T10:00:00.000Z"),
|
| 40 |
-
"request_data": {
|
| 41 |
-
"filename": "Descratch.png",
|
| 42 |
-
"content_type": "image/png"
|
| 43 |
-
},
|
| 44 |
-
"response_data": {
|
| 45 |
-
"success": true,
|
| 46 |
-
"image_id": "abc123-def456-ghi789",
|
| 47 |
-
"image_url": "https://.../uploads/abc123.jpg",
|
| 48 |
-
"filename": "abc123.jpg"
|
| 49 |
-
},
|
| 50 |
-
"error": null,
|
| 51 |
-
"user_id": null,
|
| 52 |
-
"ip_address": "192.168.1.100"
|
| 53 |
-
}
|
| 54 |
-
```
|
| 55 |
-
|
| 56 |
-
**Example for `/colorize` endpoint:**
|
| 57 |
-
```json
|
| 58 |
-
{
|
| 59 |
-
"endpoint": "/colorize",
|
| 60 |
-
"method": "POST",
|
| 61 |
-
"status_code": 200,
|
| 62 |
-
"timestamp": ISODate("2025-11-27T10:00:05.000Z"),
|
| 63 |
-
"request_data": {
|
| 64 |
-
"filename": "Descratch.png",
|
| 65 |
-
"content_type": "image/png",
|
| 66 |
-
"positive_prompt": "colorize this image",
|
| 67 |
-
"negative_prompt": "low quality",
|
| 68 |
-
"seed": 123,
|
| 69 |
-
"num_inference_steps": 8
|
| 70 |
-
},
|
| 71 |
-
"response_data": {
|
| 72 |
-
"success": true,
|
| 73 |
-
"result_id": "xyz789-abc123-def456",
|
| 74 |
-
"download_url": "https://.../results/xyz789.png",
|
| 75 |
-
"api_download_url": "https://.../download/xyz789",
|
| 76 |
-
"filename": "xyz789.png",
|
| 77 |
-
"caption": "colorized image"
|
| 78 |
-
},
|
| 79 |
-
"error": null,
|
| 80 |
-
"user_id": null,
|
| 81 |
-
"ip_address": "192.168.1.100"
|
| 82 |
-
}
|
| 83 |
-
```
|
| 84 |
-
|
| 85 |
-
---
|
| 86 |
-
|
| 87 |
-
### Collection 2: `image_uploads`
|
| 88 |
-
|
| 89 |
-
Stores information about every image upload.
|
| 90 |
-
|
| 91 |
-
**Data Structure:**
|
| 92 |
-
```json
|
| 93 |
-
{
|
| 94 |
-
"_id": ObjectId("..."), // MongoDB auto-generated ID
|
| 95 |
-
"image_id": "abc123-def456-ghi789", // Unique image identifier (UUID)
|
| 96 |
-
"filename": "Descratch.png", // Original filename
|
| 97 |
-
"file_size": 245678, // File size in bytes
|
| 98 |
-
"content_type": "image/png", // MIME type
|
| 99 |
-
"uploaded_at": ISODate("2025-11-27T10:00:00.000Z"), // UTC timestamp
|
| 100 |
-
"user_id": null, // User ID if authenticated
|
| 101 |
-
"ip_address": "192.168.1.100" // Client IP address
|
| 102 |
-
}
|
| 103 |
-
```
|
| 104 |
-
|
| 105 |
-
**Example with Descratch.png:**
|
| 106 |
-
```json
|
| 107 |
-
{
|
| 108 |
-
"image_id": "abc123-def456-ghi789",
|
| 109 |
-
"filename": "Descratch.png",
|
| 110 |
-
"file_size": 245678,
|
| 111 |
-
"content_type": "image/png",
|
| 112 |
-
"uploaded_at": ISODate("2025-11-27T10:00:00.000Z"),
|
| 113 |
-
"user_id": null,
|
| 114 |
-
"ip_address": "192.168.1.100"
|
| 115 |
-
}
|
| 116 |
-
```
|
| 117 |
-
|
| 118 |
-
---
|
| 119 |
-
|
| 120 |
-
### Collection 3: `colorizations`
|
| 121 |
-
|
| 122 |
-
Stores information about every colorization request.
|
| 123 |
-
|
| 124 |
-
**Data Structure:**
|
| 125 |
-
```json
|
| 126 |
-
{
|
| 127 |
-
"_id": ObjectId("..."), // MongoDB auto-generated ID
|
| 128 |
-
"result_id": "xyz789-abc123-def456", // Unique result identifier (UUID)
|
| 129 |
-
"image_id": "abc123-def456-ghi789", // Original image identifier
|
| 130 |
-
"prompt": "colorize this image", // Text prompt used (if any)
|
| 131 |
-
"model_type": "sdxl", // Model type: "fastai", "pytorch", "sdxl", "gan"
|
| 132 |
-
"processing_time": 3.45, // Time taken to process in seconds
|
| 133 |
-
"created_at": ISODate("2025-11-27T10:00:05.000Z"), // UTC timestamp
|
| 134 |
-
"user_id": null, // User ID if authenticated
|
| 135 |
-
"ip_address": "192.168.1.100" // Client IP address
|
| 136 |
-
}
|
| 137 |
-
```
|
| 138 |
-
|
| 139 |
-
**Example with Descratch.png:**
|
| 140 |
-
```json
|
| 141 |
-
{
|
| 142 |
-
"result_id": "xyz789-abc123-def456",
|
| 143 |
-
"image_id": "abc123-def456-ghi789",
|
| 144 |
-
"prompt": "colorize this image with vibrant natural colors",
|
| 145 |
-
"model_type": "sdxl",
|
| 146 |
-
"processing_time": 3.45,
|
| 147 |
-
"created_at": ISODate("2025-11-27T10:00:05.000Z"),
|
| 148 |
-
"user_id": null,
|
| 149 |
-
"ip_address": "192.168.1.100"
|
| 150 |
-
}
|
| 151 |
-
```
|
| 152 |
-
|
| 153 |
-
---
|
| 154 |
-
|
| 155 |
-
## What Gets Stored When You Use Descratch.png
|
| 156 |
-
|
| 157 |
-
When you upload and colorize `Descratch.png`, the following data will be stored:
|
| 158 |
-
|
| 159 |
-
1. **API Call Logs** (`api_calls` collection):
|
| 160 |
-
- `/health` - Health check call
|
| 161 |
-
- `/upload` - Image upload call with request/response data
|
| 162 |
-
- `/colorize` - Colorization call with processing parameters
|
| 163 |
-
- `/download` - Download result call (if you download the result)
|
| 164 |
-
- `/results` - Public result access call (if accessed)
|
| 165 |
-
|
| 166 |
-
2. **Image Upload Record** (`image_uploads` collection):
|
| 167 |
-
- Image ID (UUID)
|
| 168 |
-
- Filename: "Descratch.png"
|
| 169 |
-
- File size in bytes
|
| 170 |
-
- Content type: "image/png"
|
| 171 |
-
- Upload timestamp
|
| 172 |
-
- IP address
|
| 173 |
-
|
| 174 |
-
3. **Colorization Record** (`colorizations` collection):
|
| 175 |
-
- Result ID (UUID)
|
| 176 |
-
- Image ID reference
|
| 177 |
-
- Model type used
|
| 178 |
-
- Processing time
|
| 179 |
-
- Creation timestamp
|
| 180 |
-
- IP address
|
| 181 |
-
|
| 182 |
-
## All Data Includes Timestamps
|
| 183 |
-
|
| 184 |
-
Every record includes a UTC timestamp:
|
| 185 |
-
- `api_calls.timestamp` - When the API endpoint was called
|
| 186 |
-
- `image_uploads.uploaded_at` - When the image was uploaded
|
| 187 |
-
- `colorizations.created_at` - When the colorization was created
|
| 188 |
-
|
| 189 |
-
## Querying the Data
|
| 190 |
-
|
| 191 |
-
You can query MongoDB to:
|
| 192 |
-
- Find all API calls in the last 24 hours
|
| 193 |
-
- Track which images were uploaded
|
| 194 |
-
- Monitor colorization processing times
|
| 195 |
-
- Analyze API usage patterns
|
| 196 |
-
- Track errors and status codes
|
| 197 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|