zrx-kishore commited on
Commit
1b6d05d
·
1 Parent(s): 02fb50b

Delete test.csv

Browse files
Files changed (1) hide show
  1. test.csv +0 -425
test.csv DELETED
@@ -1,425 +0,0 @@
1
- id,Instruction,output
2
- 1,Generate an ANSI/PRESTO sql query for the question :What is Kyprolis's claims volume in the last 7 months?,"
3
-
4
- SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
5
- FROM ""symphony-data"".""test_performance_v3""
6
- WHERE Drug_Name like '%KYPROLIS%'
7
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
8
- from ""symphony-data"".""test_performance_v3"") - interval '7' month);"
9
- 2,Generate an ANSI/PRESTO sql query for the question :What is Kyprolis's claims volume in the last 7 months for DLBCL indication?,"SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
10
- FROM ""symphony-data"".""test_performance_v3""
11
- WHERE Drug_Name like '%KYPROLIS%'
12
- AND indication like '%DLBCL%'
13
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
14
- from ""symphony-data"".""test_performance_v3"") - interval '7' month);"
15
- 3,Generate an ANSI/PRESTO sql query for the question :Which brand had the highest claims in DLBCL indication in last 7 months?,"SELECT Drug_Name, COUNT(distinct(claim_ID)) as num_claims
16
- FROM ""symphony-data"".""test_performance_v3""
17
- WHERE indication like '%DLBCL%'
18
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
19
- from ""symphony-data"".""test_performance_v3"") - interval '7' month)
20
- GROUP BY Drug_Name
21
- ORDER BY num_claims DESC
22
- LIMIT 1;"
23
- 4,Generate an ANSI/PRESTO sql query for the question :Which brand had the highest claims in NY state in DLBCL indication in last 7 months?,"
24
-
25
- WITH
26
- dlbcl_ny_claims AS (
27
- SELECT Drug_Name, COUNT(distinct(claim_ID)) AS num_claims
28
- FROM ""symphony-data"".""test_performance_v3""
29
- WHERE indication like '%DLBCL%'
30
- AND Patient_State = 'NY'
31
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
32
- from ""symphony-data"".""test_performance_v3"") - interval '7' month)
33
- GROUP BY Drug_Name
34
- )
35
- SELECT Drug_Name, num_claims
36
- FROM dlbcl_ny_claims
37
- ORDER BY num_claims DESC
38
- LIMIT 1;"
39
- 5,Generate an ANSI/PRESTO sql query for the question :Identify the state where Kyprolis had the least prescriptions for DLBCL indications? Ignore blanks for state,"
40
-
41
- SELECT Patient_State, COUNT(distinct(Claim_ID)) as num_prescriptions
42
- FROM ""symphony-data"".""test_performance_v3""
43
- WHERE Drug_Name like '%KYPROLIS%'
44
- AND indication like '%DLBCL%'
45
- AND Patient_State NOT LIKE 'None'
46
- AND Patient_State NOT LIKE ''
47
- GROUP BY Patient_State
48
- ORDER BY num_prescriptions ASC
49
- LIMIT 1;"
50
- 6,Generate an ANSI/PRESTO sql query for the question :What was the market share of the top 5 drugs prescribed for DLBCL indication over the last 7 months?,"
51
-
52
- WITH top_5_drugs AS (
53
- SELECT Drug_Name, count(distinct(claim_ID)) as num_prescriptions
54
- FROM ""symphony-data"".""test_performance_v3""
55
- WHERE indication like '%DLBCL%'
56
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
57
- from ""symphony-data"".""test_performance_v3"") - interval '7' month)
58
- GROUP BY Drug_Name
59
- order by num_prescriptions desc
60
- limit 5
61
- ),
62
- total_prescriptions AS (
63
- SELECT COUNT(distinct(claim_ID)) as total_prescriptions
64
- FROM ""symphony-data"".""test_performance_v3""
65
- WHERE indication like '%DLBCL%'
66
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
67
- from ""symphony-data"".""test_performance_v3"") - interval '7' month)
68
- )
69
- SELECT Drug_Name, ROUND(100.0 * num_prescriptions / total_prescriptions, 2) as market_share
70
- FROM top_5_drugs, total_prescriptions;"
71
- 7,Generate an ANSI/PRESTO sql query for the question :Give me the market share by drug for the top 5 drugs for DLBCL indication over the last 7 months,"
72
-
73
- WITH top_5_drugs AS (
74
- SELECT Drug_Name, count(distinct(claim_ID)) as num_prescriptions
75
- FROM ""symphony-data"".""test_performance_v3""
76
- WHERE indication like '%DLBCL%'
77
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
78
- from ""symphony-data"".""test_performance_v3"") - interval '7' month)
79
- GROUP BY Drug_Name
80
- order by num_prescriptions desc
81
- limit 5
82
- ),
83
- total_prescriptions AS (
84
- SELECT COUNT(distinct(claim_ID)) as total_prescriptions
85
- FROM ""symphony-data"".""test_performance_v3""
86
- WHERE indication like '%DLBCL%'
87
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
88
- from ""symphony-data"".""test_performance_v3"") - interval '7' month)
89
- )
90
- SELECT Drug_Name, ROUND(100.0 * num_prescriptions / total_prescriptions, 2) as market_share
91
- FROM top_5_drugs, total_prescriptions;"
92
- 8,Generate an ANSI/PRESTO sql query for the question :What was the market share for Kyprolis for years 2020 and 2021 for DLBCL indication?,"
93
-
94
- WITH
95
- kyprolis_2020 AS (
96
- SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
97
- FROM ""symphony-data"".""test_performance_v3""
98
- WHERE Drug_Name like '%KYPROLIS%'
99
- AND Prescription_Fill_Year_Month >= date('2020-01-01')
100
- AND Prescription_Fill_Year_Month <= date('2020-12-31')
101
- AND indication like '%DLBCL%'
102
- ),
103
- kyprolis_2021 AS (
104
- SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
105
- FROM ""symphony-data"".""test_performance_v3""
106
- WHERE Drug_Name like '%KYPROLIS%'
107
- AND Prescription_Fill_Year_Month >= date('2021-01-01')
108
- AND Prescription_Fill_Year_Month <= date('2021-12-31')
109
- AND indication like '%DLBCL%'
110
- ),
111
- total_2020 AS (
112
- SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
113
- FROM ""symphony-data"".""test_performance_v3""
114
- WHERE Prescription_Fill_Year_Month >= date('2020-01-01')
115
- AND Prescription_Fill_Year_Month <= date('2020-12-31')
116
- AND indication like '%DLBCL%'
117
- ),
118
- total_2021 AS (
119
- SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
120
- FROM ""symphony-data"".""test_performance_v3""
121
- WHERE Prescription_Fill_Year_Month >= date('2021-01-01')
122
- AND Prescription_Fill_Year_Month <= date('2021-12-31')
123
- AND indication like '%DLBCL%'
124
- )
125
- SELECT
126
- ROUND(100.0 * kyprolis_2020.num_prescriptions / total_2020.num_prescriptions, 2) AS kyprolis_2020_market_share,
127
- ROUND(100.0 * kyprolis_2021.num_prescriptions / total_2021.num_prescriptions, 2) AS kyprolis_2021_market_share
128
- FROM kyprolis_2020, kyprolis_2021, total_2020, total_2021;"
129
- 9,Generate an ANSI/PRESTO sql query for the question :What's the most prescribed brand for DLBCL indication? What is it's market share?,"
130
-
131
- WITH num AS (
132
- SELECT COUNT(DISTINCT(Claim_ID)) AS num_data
133
- FROM ""symphony-data"".""test_performance_v3""
134
- WHERE indication LIKE '%DLBCL%'
135
- AND Prescription_Fill_Year_Month >= date((SELECT MAX(Prescription_Fill_Year_Month)
136
- FROM ""symphony-data"".""test_performance_v3"") - INTERVAL '7' MONTH)
137
- AND Drug_Name IN (SELECT Drug_Name
138
- FROM ""symphony-data"".""test_performance_v3""
139
- WHERE indication LIKE '%DLBCL%'
140
- GROUP BY Drug_Name
141
- ORDER BY COUNT(DISTINCT(Claim_ID)) DESC
142
- LIMIT 1)
143
- ),
144
- den AS (
145
- SELECT COUNT(DISTINCT(Claim_ID)) AS den_data
146
- FROM ""symphony-data"".""test_performance_v3""
147
- WHERE indication IN (SELECT DISTINCT(indication)
148
- FROM ""symphony-data"".""test_performance_v3""
149
- WHERE indication NOT LIKE 'No Indication'
150
- AND indication NOT LIKE 'Unknown_Flag'
151
- AND indication LIKE '%DLBCL%')
152
- AND Prescription_Fill_Year_Month >= date((SELECT MAX(Prescription_Fill_Year_Month)
153
- FROM ""symphony-data"".""test_performance_v3"") - INTERVAL '7' MONTH)
154
- )
155
- SELECT ROUND(100.0 * num_data / den_data, 2) AS market_share
156
- FROM num, den;"
157
- 10,"Generate an ANSI/PRESTO sql query for the question :Over the past 3 months, which state in the US has seen a higher number of claims for Kyprolis in the DLBCL indication compared to its competitors?","
158
-
159
- WITH kyprolis_prescriptions AS (
160
- SELECT COUNT(distinct(claim_ID)) AS num_prescriptions, Patient_State
161
- FROM ""symphony-data"".""test_performance_v3""
162
- WHERE Drug_Name like '%KYPROLIS%'
163
- AND indication like '%DLBCL%'
164
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
165
- from ""symphony-data"".""test_performance_v3"") - interval '90' day)
166
- GROUP BY Patient_State
167
- ),
168
- competitor_prescriptions AS (
169
- SELECT COUNT(distinct(claim_ID)) AS num_prescriptions, Patient_State
170
- FROM ""symphony-data"".""test_performance_v3""
171
- WHERE Drug_Name not like '%KYPROLIS%'
172
- AND indication like '%DLBCL%'
173
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
174
- from ""symphony-data"".""test_performance_v3"") - interval '90' day)
175
- GROUP BY Patient_State
176
- )
177
- SELECT kyprolis_prescriptions.Patient_State
178
- FROM kyprolis_prescriptions, competitor_prescriptions
179
- WHERE kyprolis_prescriptions.num_prescriptions > competitor_prescriptions.num_prescriptions
180
- ORDER BY kyprolis_prescriptions.num_prescriptions DESC
181
- LIMIT 5;"
182
- 11,Generate an ANSI/PRESTO sql query for the question :What is the relative growth of Kyprolis in last 7 months compared to previous year?,"
183
-
184
- WITH
185
- numerator AS (
186
- select count(Distinct(claim_ID)) as total_claims from ""symphony-data"".""test_performance_v3"" where Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
187
- from ""symphony-data"".""test_performance_v3"") - interval '7' month) and Drug_Name like '%KYPROLIS%'
188
- ),
189
- denominator AS(
190
- select count(distinct(claim_ID)) as total_claims from ""symphony-data"".""test_performance_v3"" where Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
191
- from ""symphony-data"".""test_performance_v3"") - interval '1' year - interval '7' month) and Prescription_Fill_Year_Month <= date((select max(Prescription_Fill_Year_Month)
192
- from ""symphony-data"".""test_performance_v3"") - interval '1' year) and Drug_Name like '%KYPROLIS%'
193
- )
194
- SELECT (cast(numerator.total_claims as double) / (denominator.total_claims)-1)*100 as relative_growth from numerator, denominator;"
195
- 12,Generate an ANSI/PRESTO sql query for the question :How did Kyprolis prescriptions for DLBCL indication grow for 2021 vs 2020?,"
196
-
197
- WITH
198
- kyprolis_prescriptions_2021 AS (
199
- SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
200
- FROM ""symphony-data"".""test_performance_v3""
201
- WHERE Drug_Name like '%KYPROLIS%'
202
- AND indication like '%DLBCL%'
203
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
204
- from ""symphony-data"".""test_performance_v3"") - interval '1' year)
205
- AND Prescription_Fill_Year_Month <= date((select max(Prescription_Fill_Year_Month)
206
- from ""symphony-data"".""test_performance_v3""))
207
- ),
208
- kyprolis_prescriptions_2020 AS (
209
- SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
210
- FROM ""symphony-data"".""test_performance_v3""
211
- WHERE Drug_Name like '%KYPROLIS%'
212
- AND indication like '%DLBCL%'
213
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
214
- from ""symphony-data"".""test_performance_v3"") - interval '2' year)
215
- AND Prescription_Fill_Year_Month <= date((select max(Prescription_Fill_Year_Month)
216
- from ""symphony-data"".""test_performance_v3"") - interval '1' year)
217
- )
218
- SELECT (cast(kyprolis_prescriptions_2021.num_prescriptions as double) / (kyprolis_prescriptions_2020.num_prescriptions)-1)*100 as growth from kyprolis_prescriptions_2021, kyprolis_prescriptions_2020;"
219
- 13,Generate an ANSI/PRESTO sql query for the question :Calculate evolution index for Kyprolis for DLBCL indication for the last 7 months versus same time period last year,"WITH
220
- kyprolis_prescriptions_current AS (
221
- SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
222
- FROM ""symphony-data"".""test_performance_v3""
223
- WHERE Drug_Name like '%KYPROLIS%'
224
- AND indication like '%DLBCL%'
225
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
226
- from ""symphony-data"".""test_performance_v3"") - interval '7' month)
227
- ),
228
- kyprolis_prescriptions_previous AS (
229
- SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
230
- FROM ""symphony-data"".""test_performance_v3""
231
- WHERE Drug_Name like '%KYPROLIS%'
232
- AND indication like '%DLBCL%'
233
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
234
- from ""symphony-data"".""test_performance_v3"") - interval '14' month)
235
- AND Prescription_Fill_Year_Month <= date((select max(Prescription_Fill_Year_Month)
236
- from ""symphony-data"".""test_performance_v3"") - interval '7' month)
237
- ),
238
- dlbc_prescriptions_current AS (
239
- SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
240
- FROM ""symphony-data"".""test_performance_v3""
241
- WHERE indication like '%DLBCL%'
242
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
243
- from ""symphony-data"".""test_performance_v3"") - interval '7' month)
244
- ),
245
- dlbc_prescriptions_previous AS (
246
- SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
247
- FROM ""symphony-data"".""test_performance_v3""
248
- WHERE indication like '%DLBCL%'
249
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
250
- from ""symphony-data"".""test_performance_v3"") - interval '14' month)
251
- AND Prescription_Fill_Year_Month <= date((select max(Prescription_Fill_Year_Month)
252
- from ""symphony-data"".""test_performance_v3"") - interval '7' month)
253
- )
254
- SELECT (cast((kyprolis_prescriptions_current.num_prescriptions/kyprolis_prescriptions_previous.num_prescriptions)-1 as double) / (dlbc_prescriptions_current.num_prescriptions/dlbc_prescriptions_previous.num_prescriptions)-1)*100 as evolution_index from kyprolis_prescriptions_current, kyprolis_prescriptions_previous, dlbc_prescriptions_current, dlbc_prescriptions_previous;"
255
- 14,Generate an ANSI/PRESTO sql query for the question :In which state has Kyprolis presciption count grown the most over the last 7 months compared to the same time period last year?,"
256
-
257
- WITH
258
- kyprolis_prescriptions_current_year AS (
259
- SELECT Patient_State, COUNT(distinct(claim_ID)) AS num_prescriptions
260
- FROM ""symphony-data"".""test_performance_v3""
261
- WHERE Drug_Name like '%KYPROLIS%'
262
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
263
- from ""symphony-data"".""test_performance_v3"") - interval '7' month)
264
- GROUP BY Patient_State
265
- ),
266
- kyprolis_prescriptions_previous_year AS (
267
- SELECT Patient_State, COUNT(distinct(claim_ID)) AS num_prescriptions
268
- FROM ""symphony-data"".""test_performance_v3""
269
- WHERE Drug_Name like '%KYPROLIS%'
270
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
271
- from ""symphony-data"".""test_performance_v3"") - interval '1' year - interval '7' month)
272
- AND Prescription_Fill_Year_Month <= date((select max(Prescription_Fill_Year_Month)
273
- from ""symphony-data"".""test_performance_v3"") - interval '1' year)
274
- GROUP BY Patient_State
275
- )
276
- SELECT
277
- kyprolis_prescriptions_current_year.Patient_State,
278
- (cast(kyprolis_prescriptions_current_year.num_prescriptions as double) / (kyprolis_prescriptions_previous_year.num_prescriptions)-1)*100 as growth
279
- FROM kyprolis_prescriptions_current_year, kyprolis_prescriptions_previous_year
280
- WHERE kyprolis_prescriptions_current_year.Patient_State = kyprolis_prescriptions_previous_year.Patient_State
281
- ORDER BY growth DESC
282
- LIMIT 1;"
283
- 15,"Generate an ANSI/PRESTO sql query for the question :For patients over 60 prescribed drugs for DLBCL indication, what percentage of those prescriptions were for Kyprolis? ","
284
-
285
- WITH
286
- total_prescriptions AS (
287
- SELECT COUNT(distinct(claim_ID)) AS total_prescriptions
288
- FROM ""symphony-data"".""test_performance_v3""
289
- WHERE indication like '%DLBCL%'
290
- AND patient_age >= 60
291
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
292
- from ""symphony-data"".""test_performance_v3"") - interval '90' day)
293
- ),
294
- kyprolis_prescriptions AS (
295
- SELECT COUNT(distinct(claim_ID)) AS kyprolis_prescriptions
296
- FROM ""symphony-data"".""test_performance_v3""
297
- WHERE indication like '%DLBCL%'
298
- AND patient_age >= 60
299
- AND Drug_Name like '%KYPROLIS%'
300
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
301
- from ""symphony-data"".""test_performance_v3"") - interval '90' day)
302
- )
303
- SELECT ROUND(100.0 * kyprolis_prescriptions.kyprolis_prescriptions / total_prescriptions.total_prescriptions, 2) as kyprolis_percentage
304
- FROM total_prescriptions, kyprolis_prescriptions;"
305
- 16,Generate an ANSI/PRESTO sql query for the question :What is the market share of Kyprolis in DLBCL indication for patients above 40 years?,"
306
-
307
- WITH num AS
308
- (
309
- SELECT COUNT(DISTINCT(Claim_ID)) AS num_data
310
- FROM ""symphony-data"".""test_performance_v3""
311
- WHERE Drug_Name LIKE '%KYPROLIS%'
312
- AND indication LIKE '%DLBCL%'
313
- AND patient_age > 40
314
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
315
- from ""symphony-data"".""test_performance_v3"") - interval '90' day)
316
- ),
317
- den AS
318
- (
319
- SELECT COUNT(DISTINCT(Claim_ID)) AS den_data
320
- FROM ""symphony-data"".""test_performance_v3""
321
- WHERE indication LIKE '%DLBCL%'
322
- AND patient_age > 40
323
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
324
- from ""symphony-data"".""test_performance_v3"") - interval '90' day)
325
- )
326
- SELECT ROUND(100.0 * num_data / den_data, 2) AS market_share
327
- FROM num, den;"
328
- 17,Generate an ANSI/PRESTO sql query for the question :What is the market share of Kyprolis in DLBCL indication for female/male patients over the last 7 months?,"
329
-
330
- WITH
331
- kyprolis_prescriptions AS (
332
- SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
333
- FROM ""symphony-data"".""test_performance_v3""
334
- WHERE Drug_Name like '%KYPROLIS%'
335
- AND indication like '%DLBCL%'
336
- AND Patient_Gender IN ('Male', 'Female')
337
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
338
- from ""symphony-data"".""test_performance_v3"") - interval '7' month)
339
- ),
340
- total_prescriptions AS (
341
- SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
342
- FROM ""symphony-data"".""test_performance_v3""
343
- WHERE indication like '%DLBCL%'
344
- AND Patient_Gender IN ('Male', 'Female')
345
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
346
- from ""symphony-data"".""test_performance_v3"") - interval '7' month)
347
- )
348
- SELECT ROUND(100.0 * kyprolis_prescriptions.num_prescriptions / total_prescriptions.num_prescriptions, 2) as market_share from kyprolis_prescriptions, total_prescriptions;"
349
- 18,Generate an ANSI/PRESTO sql query for the question :Which drug had highest claims for patients above 60 in DLBCL indication over the last 1 year?,"SELECT Drug_Name, COUNT(distinct(claim_ID)) as num_claims
350
- FROM ""symphony-data"".""test_performance_v3""
351
- WHERE indication like '%DLBCL%'
352
- AND patient_age > 60
353
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
354
- from ""symphony-data"".""test_performance_v3"") - interval '1' year)
355
- GROUP BY Drug_Name
356
- ORDER BY num_claims DESC
357
- LIMIT 1;"
358
- 19,Generate an ANSI/PRESTO sql query for the question :Which state in the US had the highest number of claims in the DLBCL indication for patients over the age of 60 over the last 7 months? Exclude None and blank values in state column,"
359
- SELECT Patient_State, COUNT(distinct(Claim_ID)) as num_claims
360
- FROM ""symphony-data"".""test_performance_v3""
361
- WHERE indication like '%DLBCL%'
362
- AND patient_age > 60
363
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
364
- from ""symphony-data"".""test_performance_v3"") - interval '7' month)
365
- AND Patient_State NOT IN ('None', '')
366
- GROUP BY Patient_State
367
- ORDER BY num_claims DESC
368
- LIMIT 1;"
369
- 20,Generate an ANSI/PRESTO sql query for the question :What is the most common payer type for Kyprolis in last 7 months?,"
370
- WITH kyprolis_prescriptions AS (
371
- SELECT plan_type_description, COUNT(distinct(claim_ID)) AS num_prescriptions
372
- FROM ""symphony-data"".""test_performance_v3""
373
- WHERE Drug_Name like '%KYPROLIS%'
374
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
375
- from ""symphony-data"".""test_performance_v3"") - interval '7' month)
376
- AND plan_type_description NOT IN ('NONE', '')
377
- GROUP BY plan_type_description
378
- )
379
- SELECT plan_type_description, num_prescriptions
380
- FROM kyprolis_prescriptions
381
- ORDER BY num_prescriptions DESC
382
- LIMIT 1;"
383
- 21,Generate an ANSI/PRESTO sql query for the question :What is the avg. out of pocket pay for Kyprolis in NY state in last 7 months?,"
384
- SELECT AVG(Total_Patient_Responsibility) as avg_patient_pay
385
- FROM ""symphony-data"".""test_performance_v3""
386
- WHERE Drug_Name like '%KYPROLIS%'
387
- AND Patient_State = 'NY'
388
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
389
- from ""symphony-data"".""test_performance_v3"") - interval '7' month);"
390
- 22,Generate an ANSI/PRESTO sql query for the question :Could you provide a ranking of all the brands in the DLBCL indication based on their share of commercial payers over the last 7 months?,"
391
- WITH
392
- commercial_payers AS (
393
- SELECT Drug_Name, COUNT(distinct(claim_ID)) as num_prescriptions
394
- FROM ""symphony-data"".""test_performance_v3""
395
- WHERE plan_type_description = 'COMMERCIAL'
396
- AND indication like '%DLBCL%'
397
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
398
- from ""symphony-data"".""test_performance_v3"") - interval '7' month)
399
- GROUP BY Drug_Name
400
- ),
401
- total_payers AS (
402
- SELECT COUNT(distinct(claim_ID)) as total_prescriptions
403
- FROM ""symphony-data"".""test_performance_v3""
404
- WHERE indication like '%DLBCL%'
405
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
406
- from ""symphony-data"".""test_performance_v3"") - interval '7' month)
407
- )
408
- SELECT Drug_Name, ROUND(100.0 * num_prescriptions / total_prescriptions, 2) as share_of_commercial_payers
409
- FROM commercial_payers, total_payers
410
- ORDER BY share_of_commercial_payers DESC
411
- LIMIT 5;"
412
- 23,"Generate an ANSI/PRESTO sql query for the question :Based on the average out-of-pocket expenses for patients over 60 years old in the DLBCL indication over the last 6 months, could you please give me the 5 drugs with lowest out-of-pocket expenses?","
413
- WITH avg_patient_pay AS (
414
- SELECT Drug_Name, AVG(Total_Patient_Responsibility) as avg_patient_pay
415
- FROM ""symphony-data"".""test_performance_v3""
416
- WHERE indication like '%DLBCL%'
417
- AND patient_age >= 60
418
- AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
419
- from ""symphony-data"".""test_performance_v3"") - interval '6' month)
420
- GROUP BY Drug_Name
421
- )
422
- SELECT Drug_Name, avg_patient_pay
423
- FROM avg_patient_pay
424
- ORDER BY avg_patient_pay ASC
425
- LIMIT 5;"