Spaces:
Running
Running
| # Create the sample data JSON file | |
| import json | |
| from datetime import datetime | |
| import os | |
| # Create examples directory if it doesn't exist | |
| os.makedirs("examples", exist_ok=True) | |
| # Create sample data | |
| sample_data = { | |
| "sales_data": [ | |
| { | |
| "sale_id": "S123456", | |
| "product_id": 1000001, | |
| "product_name": "Товар 1", | |
| "article": "ART1001", | |
| "sale_date": "2024-06-01T10:30:00", | |
| "total_price": 1500.0, | |
| "quantity": 1, | |
| "category": "Одежда", | |
| "brand": "Бренд A", | |
| "warehouse": "Коледино", | |
| "discount_percent": 10 | |
| }, | |
| { | |
| "sale_id": "S123457", | |
| "product_id": 1000002, | |
| "product_name": "Товар 2", | |
| "article": "ART1002", | |
| "sale_date": "2024-06-01T14:15:00", | |
| "total_price": 2300.0, | |
| "quantity": 1, | |
| "category": "Обувь", | |
| "brand": "Бренд B", | |
| "warehouse": "Электросталь", | |
| "discount_percent": 15 | |
| } | |
| ], | |
| "inventory_data": [ | |
| { | |
| "product_id": 1000001, | |
| "product_name": "Товар 1", | |
| "article": "ART1001", | |
| "current_stock": 45, | |
| "warehouse": "Коледино", | |
| "category": "Одежда", | |
| "brand": "Бренд A", | |
| "price": 1500.0, | |
| "last_change_date": "2024-06-07T09:00:00" | |
| }, | |
| { | |
| "product_id": 1000002, | |
| "product_name": "Товар 2", | |
| "article": "ART1002", | |
| "current_stock": 12, | |
| "warehouse": "Электросталь", | |
| "category": "Обувь", | |
| "brand": "Бренд B", | |
| "price": 2300.0, | |
| "last_change_date": "2024-06-07T09:00:00" | |
| } | |
| ], | |
| "metadata": { | |
| "generated_at": datetime.now().isoformat(), | |
| "description": "Sample data for Wildberries Analytics Dashboard", | |
| "note": "This is demo data for testing purposes only", | |
| "version": "1.0" | |
| } | |
| } | |
| # Save to JSON file | |
| with open("examples/sample_data.json", "w", encoding="utf-8") as f: | |
| json.dump(sample_data, f, ensure_ascii=False, indent=2) | |
| print("Created examples/sample_data.json") | |
| print("Sample data structure:") | |
| print(f"- Sales records: {len(sample_data['sales_data'])}") | |
| print(f"- Inventory records: {len(sample_data['inventory_data'])}") | |
| print(f"- Generated at: {sample_data['metadata']['generated_at']}") |