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

Rishabh/sqlite fixes #195

Merged
merged 6 commits into from
Jul 2, 2024
Merged

Rishabh/sqlite fixes #195

merged 6 commits into from
Jul 2, 2024

Conversation

rishsriv
Copy link
Member

@rishsriv rishsriv commented Jul 1, 2024

Fixed some questions. Also an additional prompt for the LoRA models to deal with the loss of attention with LoRA models, and be better aligned with the prompt used while training.

This is a temporary solution until our LoRA models are trained with the same prompt as our current prompt_cot.md

@rishsriv rishsriv requested a review from wendy-aw July 1, 2024 16:01
@@ -19,7 +19,7 @@ broker,sqlite,instructions_date_join,"SELECT strftime('%Y-%m', sbCustJoinDate) A
CR = customer rank by total transaction amount, where the top customer has the highest amount.
PMCS = per month customer signups. PMAT = per month average transaction amount. Truncate date to month for aggregation.
TAC = Total Active Customers who joined after a specified date"
broker,sqlite,instructions_date_join,"SELECT COUNT(DISTINCT sb.sbTxId) AS num_transactions, SUM(sb.sbTxAmount) AS total_transaction_amount FROM sbTransaction AS sb JOIN sbCustomer AS sc ON sb.sbTxCustId = sc.sbCustId WHERE LOWER(sc.sbCustCountry) = 'usa' AND sb.sbTxDateTime >= DATE('now', '-7 days', 'weekday 0', '-6 days') AND sb.sbTxDateTime <= DATE('now', '-7 days', 'weekday 0');",How many transactions were made by customers from the USA last week (exclusive of the current week)? Return the number of transactions and total transaction amount.,"Last week = DATE('now', '-7 days', 'weekday 1', '-7 days') to before DATE('now', '-7 days', 'weekday 1'). Always join transactions with customers before using the transactions table.","To analyze stock performance, join the daily price and ticker tables and calculate price change To get the total transaction amount per customer, join the customer and transaction tables, group by customer, and sum the transaction amounts. Last week = DATE('now', '-7 days', 'weekday 1', '-7 days') to before DATE('now', '-7 days', 'weekday 1'). Always join transactions with customers before using the transactions table. To get the success rate of transactions per customer, join customer and transaction tables, group by customer, and calculate the percentage of successful transactions"
broker,sqlite,instructions_date_join,"SELECT COUNT(DISTINCT sb.sbTxId) AS num_transactions, SUM(sb.sbTxAmount) AS total_transaction_amount FROM sbTransaction AS sb JOIN sbCustomer AS sc ON sb.sbTxCustId = sc.sbCustId WHERE LOWER(sc.sbCustCountry) = 'usa' AND sb.sbTxDateTime >= DATE('now', '-7 days', 'weekday 1', '-7 days') AND sb.sbTxDateTime <= DATE('now', '-7 days', 'weekday 1');",How many transactions were made by customers from the USA last week (exclusive of the current week)? Return the number of transactions and total transaction amount.,"Last week = DATE('now', '-7 days', 'weekday 1', '-7 days') to before DATE('now', '-7 days', 'weekday 1'). Always join transactions with customers before using the transactions table.","To analyze stock performance, join the daily price and ticker tables and calculate price change To get the total transaction amount per customer, join the customer and transaction tables, group by customer, and sum the transaction amounts. Last week = DATE('now', '-7 days', 'weekday 1', '-7 days') to before DATE('now', '-7 days', 'weekday 1'). Always join transactions with customers before using the transactions table. To get the success rate of transactions per customer, join customer and transaction tables, group by customer, and calculate the percentage of successful transactions"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops sorry for not matching the query to the instructions even though they are semantically similar. Good catch 🙏

@@ -137,7 +137,7 @@ derm_treatment,sqlite,keywords_aggregate,SELECT AVG(weight_kg) AS caw FROM patie
CAW = cohort average weight in kilograms
To calculate the D7D100PIR, subtract the average PASI score at the beginning of the period from the average at the end, divide by the initial average, and multiply by 100
The Defined Daily Dose (DDD) is calculated as the total consumed medication divided by the treatment duration"
derm_treatment,sqlite,keywords_ratio,"SELECT d.drug_name, AVG(t.tot_drug_amt / NULLIF((t.end_dt - t.start_dt), 0)) AS ddd FROM treatments AS t JOIN drugs AS d ON t.drug_id = d.drug_id WHERE NOT t.end_dt IS NULL GROUP BY d.drug_name;",Calculate the average DDD for each drug. Return the drug name and average DDD value.,"DDD (defined daily dose) = total drug amount consumed during one treatment / total days of treatment (end - start date in days), where end date is not null","DDD (defined daily dose) = total drug amount consumed during one treatment / total days of treatment (end - start date in days). To find the average weight of patients treated with a specific drug, first join patients with treatments on patient_id, then filter by the drug name. To identify doctors who have prescribed a certain drug type and their respective locations, first join doctors with treatments on doc_id, then filter by the drug type. To calculate the total number of adverse events reported for treatments involving certain drug types, first join treatments with adverse_events on treatment_id, then filter by the drug type."
derm_treatment,sqlite,keywords_ratio,"SELECT d.drug_name, AVG(t.tot_drug_amt / NULLIF((JULIANDAY(t.end_dt) - JULIANDAY(t.start_dt)), 0)) AS ddd FROM treatments AS t JOIN drugs AS d ON t.drug_id = d.drug_id WHERE NOT t.end_dt IS NULL GROUP BY d.drug_name;",Calculate the average DDD for each drug. Return the drug name and average DDD value.,"DDD (defined daily dose) = total drug amount consumed during one treatment / total days of treatment (end - start date in days), where end date is not null","DDD (defined daily dose) = total drug amount consumed during one treatment / total days of treatment (end - start date in days). To find the average weight of patients treated with a specific drug, first join patients with treatments on patient_id, then filter by the drug name. To identify doctors who have prescribed a certain drug type and their respective locations, first join doctors with treatments on doc_id, then filter by the drug type. To calculate the total number of adverse events reported for treatments involving certain drug types, first join treatments with adverse_events on treatment_id, then filter by the drug type."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh thanks for this. Missed out on this date sub

@wendy-aw wendy-aw self-requested a review July 2, 2024 01:59
Copy link
Contributor

@wendy-aw wendy-aw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making it more robust!

@wendy-aw wendy-aw merged commit d7d23ee into main Jul 2, 2024
2 checks passed
@wendy-aw wendy-aw deleted the rishabh/sqlite-fixes branch July 2, 2024 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants