Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small data fixes #19

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions defog_data/broker/broker.sql
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ INSERT INTO sbCustomer (sbCustId, sbCustName, sbCustEmail, sbCustPhone, sbCustAd
('C008', 'Sarah Nguyen', 'sarah.nguyen@email.com', '555-623-7419', '951 Pine Rd', 'Yourtown', 'CA', 'USA', '92101', '2019-04-01', 'closed'),
('C009', 'William Garcia', 'william.garcia@email.com', '555-148-5326', '258 Elm Ave', 'Anytown', 'CA', 'USA', '90001', '2021-08-22', 'active'),
('C010', 'Jessica Hernandez', 'jessica.hernandez@email.com', '555-963-8520', '147 Cedar Blvd', 'Someville', 'NY', 'USA', '10002', '2020-03-10', 'inactive'),
('C011', 'Alex Rodriguez', 'alex.rodriguez@email.com', '555-246-1357', '753 Oak St', 'Newtown', 'NJ', 'USA', '08801', '2023-01-15', 'active');
('C011', 'Alex Rodriguez', 'alex.rodriguez@email.com', '555-246-1357', '753 Oak St', 'Newtown', 'NJ', 'USA', '08801', '2023-01-15', 'active'),
('C012', 'Olivia Johnson', 'olivia.johnson@email.com', '555-987-6543', '321 Elm St', 'Newtown', 'NJ', 'USA', '08801', '2023-01-05', 'active'),
('C013', 'Ethan Davis', 'ethan.davis@email.com', '555-246-8135', '654 Oak Ave', 'Someville', 'NY', 'USA', '10002', '2023-02-12', 'active'),
('C014', 'Ava Wilson', 'ava.wilson@email.com', '555-135-7902', '987 Pine Rd', 'Anytown', 'CA', 'USA', '90001', '2023-03-20', 'active');

-- sbTicker
INSERT INTO sbTicker (sbTickerId, sbTickerSymbol, sbTickerName, sbTickerType, sbTickerExchange, sbTickerCurrency, sbTickerDb2x, sbTickerIsActive) VALUES
Expand Down Expand Up @@ -165,4 +168,14 @@ INSERT INTO sbTransaction (sbTxId, sbTxCustId, sbTxTickerId, sbTxDateTime, sbTxT
('TX036', 'C006', 'T006', NOW() - INTERVAL '4 days', 'sell', 70, 300.00, 21000.00, 'USD', 105.00, 15.00, 'KP036', TO_CHAR(NOW() - INTERVAL '4 days', '%Y%m%d %H:%i:%s'), 'success'),
('TX037', 'C007', 'T007', NOW() - INTERVAL '3 days', 'buy', 110, 220.00, 24200.00, 'USD', 121.00, 10.00, 'KP037', TO_CHAR(NOW() - INTERVAL '3 days', '%Y%m%d %H:%i:%s'), 'success'),
('TX038', 'C008', 'T008', NOW() - INTERVAL '2 days', 'sell', 100, 350.00, 35000.00, 'USD', 175.00, 25.00, 'KP038', TO_CHAR(NOW() - INTERVAL '2 days', '%Y%m%d %H:%i:%s'), 'success'),
('TX039', 'C009', 'T009', NOW() - INTERVAL '1 day', 'buy', 80, 230.00, 18400.00, 'USD', 92.00, 18.00, 'KP039', TO_CHAR(NOW() - INTERVAL '1 day', '%Y%m%d %H:%i:%s'), 'pending');
('TX039', 'C009', 'T009', NOW() - INTERVAL '1 day', 'buy', 80, 230.00, 18400.00, 'USD', 92.00, 18.00, 'KP039', TO_CHAR(NOW() - INTERVAL '1 day', '%Y%m%d %H:%i:%s'), 'pending'),
('TX040', 'C001', 'T011', NOW() - INTERVAL '10 days', 'buy', 50, 400.00, 20000.00, 'USD', 100.00, 20.00, 'KP040', TO_CHAR(NOW() - INTERVAL '10 days', '%Y%m%d %H:%i:%s'), 'success'),
('TX041', 'C002', 'T012', NOW() - INTERVAL '9 days', 'sell', 30, 320.00, 9600.00, 'USD', 48.00, 15.00, 'KP041', TO_CHAR(NOW() - INTERVAL '9 days', '%Y%m%d %H:%i:%s'), 'success'),
('TX042', 'C003', 'T013', NOW() - INTERVAL '8 days', 'buy', 80, 180.00, 14400.00, 'USD', 72.00, 10.00, 'KP042', TO_CHAR(NOW() - INTERVAL '8 days', '%Y%m%d %H:%i:%s'), 'success'),
('TX043', 'C004', 'T014', NOW() - INTERVAL '7 days', 'sell', 60, 220.00, 13200.00, 'USD', 66.00, 12.00, 'KP043', TO_CHAR(NOW() - INTERVAL '7 days', '%Y%m%d %H:%i:%s'), 'success'),
('TX044', 'C012', 'T001', '2023-01-15 10:00:00', 'buy', 80, 155.00, 12400.00, 'USD', 62.00, 10.00, 'KP044', '20230115 10:00:00', 'success'),
('TX045', 'C013', 'T002', '2023-02-20 11:30:00', 'sell', 60, 285.00, 17100.00, 'USD', 85.50, 15.00, 'KP045', '20230220 11:30:00', 'success'),
('TX046', 'C014', 'T003', '2023-03-25 14:45:00', 'buy', 5, 3250.00, 16250.00, 'USD', 81.25, 20.00, 'KP046', '20230325 14:45:00', 'success'),
('TX047', 'C012', 'T004', '2023-01-30 13:15:00', 'sell', 40, 190.00, 7600.00, 'USD', 38.00, 10.00, 'KP047', '20230130 13:15:00', 'success'),
('TX048', 'C013', 'T005', '2023-02-28 16:00:00', 'buy', 2, 2550.00, 5100.00, 'USD', 25.50, 15.00, 'KP048', '20230228 16:00:00', 'success'),
('TX049', 'C014', 'T006', '2023-03-31 09:45:00', 'sell', 30, 210.00, 6300.00, 'USD', 31.50, 10.00, 'KP049', '20230331 09:45:00', 'success');
5 changes: 0 additions & 5 deletions defog_data/car_dealership/car_dealership.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@
"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",
Expand Down
8 changes: 6 additions & 2 deletions defog_data/car_dealership/car_dealership.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ CREATE TABLE cars (
engine_type TEXT NOT NULL, -- type of engine (e.g., V6, V8, Electric)
transmission TEXT NOT NULL, -- type of transmission (e.g., Automatic, Manual)
price NUMERIC(10, 2) NOT NULL, -- selling price of the car
is_sold BOOLEAN NOT NULL DEFAULT FALSE, -- indicates if the car has been sold
crtd_ts TIMESTAMP NOT NULL DEFAULT NOW() -- timestamp when the car was added to the system
);

Expand Down Expand Up @@ -204,4 +203,9 @@ VALUES
('Utility Company', '2023-04-15', 1500.00, 'bank_transfer', 'INV-009', '2023-04-01', '2023-04-30'),
('Marketing Agency', '2023-04-20', 15000.00, 'credit_card', 'INV-010', '2023-04-15', '2023-05-15'),
('Insurance Provider', '2023-04-25', 5000.00, 'bank_transfer', 'INV-011', '2023-04-20', '2023-05-20'),
('Cleaning Service', '2023-04-30', 2000.00, 'check', 'INV-012', '2023-04-25', '2023-05-25');
('Cleaning Service', '2023-04-30', 2000.00, 'check', 'INV-012', '2023-04-25', '2023-05-25'),
('Toyota Auto Parts', NOW() - INTERVAL '5 days', 12500.00, 'bank_transfer', 'INV-013', NOW() - INTERVAL '10 days', NOW() + INTERVAL '20 days'),
('Honda Manufacturing', NOW() - INTERVAL '3 days', 18000.00, 'check', 'INV-014', NOW() - INTERVAL '8 days', NOW() + INTERVAL '22 days'),
('Ford Supplier Co', NOW() - INTERVAL '2 days', 22000.00, 'bank_transfer', 'INV-015', NOW() - INTERVAL '7 days', NOW() + INTERVAL '23 days'),
('Tesla Parts Inc', NOW() - INTERVAL '1 day', 15000.00, 'credit_card', 'INV-016', NOW() - INTERVAL '6 days', NOW() + INTERVAL '24 days'),
('Chevrolet Auto', NOW(), 20000.00, 'bank_transfer', 'INV-017', NOW() - INTERVAL '5 days', NOW() + INTERVAL '25 days');
4 changes: 2 additions & 2 deletions defog_data/derm_treatment/derm_treatment.sql
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ VALUES
(7, 6, 1, 3, '2023-01-01', '2023-06-30', false, 240, 'mg'),
(1, 7, 2, 4, '2023-02-01', '2023-07-31', false, 180, 'mg'),
(2, 1, 3, 5, '2023-03-01', '2023-08-31', false, 360, 'g'),
(1, 2, 4, 6, DATE_TRUNC('month', CURRENT_DATE - INTERVAL '7 months'), DATE_TRUNC('month', CURRENT_DATE - INTERVAL '2 months'), false, 300, 'mg'),
(2, 5, 1, 8, DATE_TRUNC('month', CURRENT_DATE - INTERVAL '6 month'), DATE_TRUNC('month', CURRENT_DATE - INTERVAL '4 months'), false, 80, 'mg'),
(1, 2, 4, 6, DATE_TRUNC('month', CURRENT_DATE - INTERVAL '2 year'), DATE_TRUNC('month', CURRENT_DATE - INTERVAL '2 months'), false, 300, 'mg'),
(2, 5, 1, 8, DATE_TRUNC('month', CURRENT_DATE - INTERVAL '1 year'), DATE_TRUNC('month', CURRENT_DATE - INTERVAL '4 months'), false, 80, 'mg'),
(3, 6, 2, 9, DATE_TRUNC('month', CURRENT_DATE - INTERVAL '5 months'), NULL, true, 200, 'mg'),
(1, 7, 3, 10, DATE_TRUNC('month', CURRENT_DATE - INTERVAL '4 months'), NULL, false, 150, 'g'),
(2, 1, 4, 1, DATE_TRUNC('month', CURRENT_DATE - INTERVAL '3 months'), NULL, false, 100, 'mg'),
Expand Down
2 changes: 1 addition & 1 deletion tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def test_car_dealership(self):
]
self.assertEqual(list(db_schema.keys()), expected_tables)
num_columns = sum([len(db_schema[table]) for table in db_schema])
self.assertEqual(num_columns, 56)
self.assertEqual(num_columns, 55)

def test_derm_treatment(self):
db_name = "derm_treatment"
Expand Down
Loading