Skip to content

Commit

Permalink
Added 2 new schema
Browse files Browse the repository at this point in the history
- car_dealership
- derm_treatment
  • Loading branch information
wongjingping committed Mar 26, 2024
1 parent 42736ea commit 06fd72a
Show file tree
Hide file tree
Showing 7 changed files with 1,170 additions and 3 deletions.
299 changes: 299 additions & 0 deletions defog_data/car_dealership/car_dealership.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,299 @@
{
"table_metadata": {
"cars": [
{
"data_type": "SERIAL",
"column_name": "id",
"column_description": "Primary key for the cars table"
},
{
"data_type": "TEXT",
"column_name": "make",
"column_description": "Manufacturer of the car"
},
{
"data_type": "TEXT",
"column_name": "model",
"column_description": "Model name of the car"
},
{
"data_type": "INTEGER",
"column_name": "year",
"column_description": "Year of manufacture"
},
{
"data_type": "TEXT",
"column_name": "color",
"column_description": "Color of the car"
},
{
"data_type": "VARCHAR(17)",
"column_name": "vin_number",
"column_description": "Vehicle Identification Number"
},
{
"data_type": "TEXT",
"column_name": "engine_type",
"column_description": "Type of engine (e.g., V6, V8, Electric)"
},
{
"data_type": "TEXT",
"column_name": "transmission",
"column_description": "Type of transmission (e.g., Automatic, Manual)"
},
{
"data_type": "NUMERIC(10, 2)",
"column_name": "price",
"column_description": "Selling price of the car"
},
{
"data_type": "BOOLEAN",
"column_name": "is_sold",
"column_description": "Indicates if the car has been sold"
},
{
"data_type": "TIMESTAMP",
"column_name": "crtd_ts",
"column_description": "Timestamp when the car was added to the system"
}
],
"salespersons": [
{
"data_type": "SERIAL",
"column_name": "id",
"column_description": "Primary key for the salespersons table"
},
{
"data_type": "TEXT",
"column_name": "first_name",
"column_description": "First name of the salesperson"
},
{
"data_type": "TEXT",
"column_name": "last_name",
"column_description": "Last name of the salesperson"
},
{
"data_type": "VARCHAR(255)",
"column_name": "email",
"column_description": "Email address of the salesperson"
},
{
"data_type": "VARCHAR(20)",
"column_name": "phone",
"column_description": "Phone number of the salesperson"
},
{
"data_type": "DATE",
"column_name": "hire_date",
"column_description": "Date when the salesperson was hired"
},
{
"data_type": "DATE",
"column_name": "termination_date",
"column_description": "Date when the salesperson's employment was terminated"
},
{
"data_type": "TIMESTAMP",
"column_name": "crtd_ts",
"column_description": "Timestamp when the salesperson record was created"
}
],
"customers": [
{
"data_type": "SERIAL",
"column_name": "id",
"column_description": "Primary key for the customers table"
},
{
"data_type": "TEXT",
"column_name": "first_name",
"column_description": "First name of the customer"
},
{
"data_type": "TEXT",
"column_name": "last_name",
"column_description": "Last name of the customer"
},
{
"data_type": "VARCHAR(255)",
"column_name": "email",
"column_description": "Email address of the customer"
},
{
"data_type": "VARCHAR(20)",
"column_name": "phone",
"column_description": "Phone number of the customer"
},
{
"data_type": "TEXT",
"column_name": "address",
"column_description": "Address of the customer"
},
{
"data_type": "TEXT",
"column_name": "city",
"column_description": "City of the customer"
},
{
"data_type": "TEXT",
"column_name": "state",
"column_description": "State of the customer"
},
{
"data_type": "VARCHAR(10)",
"column_name": "zip_code",
"column_description": "ZIP code of the customer"
},
{
"data_type": "TIMESTAMP",
"column_name": "crtd_ts",
"column_description": "Timestamp when the customer record was created"
}
],
"sales": [
{
"data_type": "SERIAL",
"column_name": "id",
"column_description": "Primary key for the sales table"
},
{
"data_type": "INTEGER",
"column_name": "car_id",
"column_description": "Foreign key referencing the cars table"
},
{
"data_type": "INTEGER",
"column_name": "salesperson_id",
"column_description": "Foreign key referencing the salespersons table"
},
{
"data_type": "INTEGER",
"column_name": "customer_id",
"column_description": "Foreign key referencing the customers table"
},
{
"data_type": "NUMERIC(10, 2)",
"column_name": "sale_price",
"column_description": "Price at which the car was sold"
},
{
"data_type": "DATE",
"column_name": "sale_date",
"column_description": "Date when the car was sold"
},
{
"data_type": "TIMESTAMP",
"column_name": "crtd_ts",
"column_description": "Timestamp when the sale record was created"
}
],
"inventory_snapshots": [
{
"data_type": "SERIAL",
"column_name": "id",
"column_description": "Primary key for the inventory_snapshots table"
},
{
"data_type": "DATE",
"column_name": "snapshot_date",
"column_description": "Date of the inventory snapshot"
},
{
"data_type": "INTEGER",
"column_name": "car_id",
"column_description": "Foreign key referencing the cars table"
},
{
"data_type": "BOOLEAN",
"column_name": "is_in_inventory",
"column_description": "Indicates if the car was in inventory on the snapshot date"
},
{
"data_type": "TIMESTAMP",
"column_name": "crtd_ts",
"column_description": "Timestamp when the inventory snapshot record was created"
}
],
"payments_received": [
{
"data_type": "SERIAL",
"column_name": "id",
"column_description": "Primary key for the payments_received table"
},
{
"data_type": "INTEGER",
"column_name": "sale_id",
"column_description": "Foreign key referencing the sales table"
},
{
"data_type": "DATE",
"column_name": "payment_date",
"column_description": "Date when the payment was received"
},
{
"data_type": "NUMERIC(10, 2)",
"column_name": "payment_amount",
"column_description": "Amount of the payment received"
},
{
"data_type": "TEXT",
"column_name": "payment_method",
"column_description": "Method of payment (e.g., cash, check, card, banktrf, trp01)"
},
{
"data_type": "TIMESTAMP",
"column_name": "crtd_ts",
"column_description": "Timestamp when the payment received record was created"
}
],
"payments_made": [
{
"data_type": "SERIAL",
"column_name": "id",
"column_description": "Primary key for the payments_made table"
},
{
"data_type": "TEXT",
"column_name": "vendor_name",
"column_description": "Name of the vendor to whom the payment was made"
},
{
"data_type": "DATE",
"column_name": "payment_date",
"column_description": "Date when the payment was made"
},
{
"data_type": "NUMERIC(10, 2)",
"column_name": "payment_amount",
"column_description": "Amount of the payment made"
},
{
"data_type": "TEXT",
"column_name": "payment_method",
"column_description": "Method of payment (e.g., check, bank_transfer, credit_card)"
},
{
"data_type": "VARCHAR(50)",
"column_name": "invoice_number",
"column_description": "Invoice number associated with the payment"
},
{
"data_type": "DATE",
"column_name": "invoice_date",
"column_description": "Date of the invoice"
},
{
"data_type": "DATE",
"column_name": "due_date",
"column_description": "Due date of the invoice"
},
{
"data_type": "TIMESTAMP",
"column_name": "crtd_ts",
"column_description": "Timestamp when the payment made record was created"
}
]
},
"glossary": "- `cars.id` can be joined with `car_id` from `sales` and `inventory_snapshots` tables\n- `salespersons.id` can be joined with `salesperson_id` from `sales` table\n- `customers.id` can be joined with `customer_id` from `sales` table\n- `sales.id` can be joined with `sale_id` from `payments_received` table\n- All string columns should be matched exactly unless specified otherwise\n- `cars.make`, `cars.model`, `cars.color`, `customers.address`, `customers.city`, `customers.state` can be filtered with ILIKE '%<text>%'\n- `cars.vin_number` should be matched case-insensitively\n- Total Sales = SUM(sale_price) from `sales` table\n- Total Payments Received = SUM(payment_amount) from `payments_received` table\n- Total Payments Made = SUM(payment_amount) from `payments_made` table\n- Profit = Total Sales - Total Payments Made"
}
Loading

0 comments on commit 06fd72a

Please sign in to comment.