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

Added 10 more date questions #180

Merged
merged 2 commits into from
Jun 24, 2024
Merged

Added 10 more date questions #180

merged 2 commits into from
Jun 24, 2024

Conversation

wongjingping
Copy link
Collaborator

Added 10 more date questions. 5 for derm_treatment and 5 for ewallet. The questions are designed to use different tables as much as possible, and are designed to have the following syntax:

derm_treatment:

  • date diff date
  • extract year window cte
  • current date diff date
  • text convert date diff date
  • date null

ewallet:

  • snapshot info
  • left join on date overlap
  • date diff date agg (avg)
  • current date agg (pct)
  • date diff date agg (min)

"How many treatments for diagnoses containing 'psoriasis' (match with wildcards case-insensitively) involve drugs still under FDA trial and have not yet ended?","SELECT COUNT(*) FROM treatments t JOIN diagnoses d ON t.diag_id = d.diag_id JOIN drugs dr ON t.drug_id = dr.drug_id WHERE d.diag_name ILIKE '%psoriasis%' AND dr.fda_appr_dt IS NULL AND t.end_dt IS NULL;",derm_treatment,date_functions,
"What was the average transaction daily and monthly limit for the earliest setting snapshot in 2023?","SELECT AVG(tx_limit_daily) AS avg_daily_limit, AVG(tx_limit_monthly) AS avg_monthly_limit FROM consumer_div.user_setting_snapshot WHERE snapshot_date = (SELECT MIN(snapshot_date) FROM consumer_div.user_setting_snapshot WHERE snapshot_date >= '2023-01-01' AND snapshot_date < '2024-01-01' );",ewallet,date_functions,
"Which users did not get a notification within the first year of signing up? Return their usernames, emails and signup dates.","SELECT u.username, u.email, u.created_at FROM consumer_div.users u LEFT JOIN consumer_div.notifications n ON u.uid = n.user_id AND n.created_at BETWEEN u.created_at AND u.created_at + INTERVAL '1 year' WHERE n.user_id IS NULL;",ewallet,date_functions,
Copy link
Member

Choose a reason for hiding this comment

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

Took me a while to wrap my head around this, but looks good!

Copy link
Member

@rishsriv rishsriv left a comment

Choose a reason for hiding this comment

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

Thank you for these super thoughtful and varied additions. These are significantly harder than the other questions we have in this category, and should be a good "stress test" for all models

@rishsriv rishsriv merged commit 28048ae into main Jun 24, 2024
1 check passed
@rishsriv rishsriv deleted the jp/update2 branch June 24, 2024 15:27
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