Spaces:
Running
Running
File size: 2,557 Bytes
d80bf0f |
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 |
# 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']}") |