zrx-kishore commited on
Commit
b1fc605
·
1 Parent(s): f684a5a

Create train,csv

Browse files
Files changed (1) hide show
  1. train,csv +1693 -0
train,csv ADDED
@@ -0,0 +1,1693 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ id,Instruction,output
2
+ 1,Generate an ANSI/PRESTO sql query for the question :What is Kyprolis's claims volume in the last 3 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 '90' day);"
9
+ 2,Generate an ANSI/PRESTO sql query for the question :What is Kyprolis's claims volume in the last 3 months for MM indication?,"
10
+
11
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
12
+ FROM ""symphony-data"".""test_performance_v3""
13
+ WHERE Drug_Name like '%KYPROLIS%'
14
+ AND indication like '%MM%'
15
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
16
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day);"
17
+ 3,Generate an ANSI/PRESTO sql query for the question :Which brand had the highest claims in MM indication in last 3 months?,"
18
+
19
+ SELECT Drug_Name, COUNT(distinct(claim_ID)) as num_prescriptions
20
+ FROM ""symphony-data"".""test_performance_v3""
21
+ WHERE indication like '%MM%'
22
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
23
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
24
+ GROUP BY Drug_Name
25
+ ORDER BY num_prescriptions DESC
26
+ LIMIT 1;"
27
+ 4,Generate an ANSI/PRESTO sql query for the question :Which brand had the highest claims in NY state in MM indication in last 3 months?,"
28
+
29
+ SELECT Drug_Name, COUNT(distinct(claim_ID)) as num_prescriptions
30
+ FROM ""symphony-data"".""test_performance_v3""
31
+ WHERE indication like '%MM%'
32
+ AND Patient_State = 'NY'
33
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
34
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
35
+ GROUP BY Drug_Name
36
+ ORDER BY num_prescriptions DESC
37
+ LIMIT 1;"
38
+ 5,Generate an ANSI/PRESTO sql query for the question :Identify the state where Kyprolis had the most prescriptions for MM indications? Ignore blanks for state,"
39
+
40
+ SELECT Patient_State, COUNT(distinct(Claim_ID)) as num_prescriptions
41
+ FROM ""symphony-data"".""test_performance_v3""
42
+ WHERE Drug_Name like '%KYPROLIS%'
43
+ AND indication like '%MM%'
44
+ AND Patient_State NOT LIKE 'None'
45
+ AND Patient_State NOT LIKE ''
46
+ GROUP BY Patient_State
47
+ ORDER BY num_prescriptions DESC
48
+ LIMIT 1;"
49
+ 6,Generate an ANSI/PRESTO sql query for the question :What was the market share of the top 5 drugs prescribed for MM indication over the last 3 months?,"
50
+
51
+ WITH top_5_drugs AS (
52
+ SELECT Drug_Name, count (distinct(claim_id)) as prescription_count
53
+ FROM ""symphony-data"".""test_performance_v3""
54
+ WHERE indication like '%MM%'
55
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
56
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
57
+ GROUP BY Drug_Name
58
+ order by prescription_count desc
59
+ limit 5
60
+ ),
61
+ total_prescriptions AS (
62
+ SELECT COUNT(distinct(claim_ID)) AS total_prescriptions
63
+ FROM ""symphony-data"".""test_performance_v3""
64
+ WHERE indication like '%MM%'
65
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
66
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
67
+ )
68
+ SELECT
69
+ top_5_drugs.Drug_Name,
70
+ ROUND(100.0 * top_5_drugs.prescription_count / total_prescriptions.total_prescriptions, 2) as market_share
71
+ FROM top_5_drugs, total_prescriptions;"
72
+ 7,Generate an ANSI/PRESTO sql query for the question :Give me the market share by drug for the top 5 drugs for MM indication over the last 3 months,"
73
+
74
+ WITH
75
+ top_5_drugs AS (
76
+ SELECT Drug_Name, count (distinct(claim_id)) as prescription_count
77
+ FROM ""symphony-data"".""test_performance_v3""
78
+ WHERE indication like '%MM%'
79
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
80
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
81
+ GROUP BY Drug_Name
82
+ order by prescription_count desc
83
+ limit 5
84
+ ),
85
+ total_claims AS (
86
+ SELECT COUNT(distinct(claim_ID)) AS total_claims
87
+ FROM ""symphony-data"".""test_performance_v3""
88
+ WHERE indication like '%MM%'
89
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
90
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
91
+ )
92
+ SELECT
93
+ top_5_drugs.Drug_Name,
94
+ ROUND(100.0 * top_5_drugs.prescription_count / total_claims.total_claims, 2) as market_share
95
+ FROM top_5_drugs, total_claims;"
96
+ 8,Generate an ANSI/PRESTO sql query for the question :What was the market share for Kyprolis for years 2021 and 2022 for MM indication?,"
97
+ WITH
98
+ kyprolis_2021 AS (
99
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
100
+ FROM """"symphony-data"""".""""test_performance_v3""""
101
+ WHERE Drug_Name like '%KYPROLIS%'
102
+ AND Prescription_Fill_Year_Month >= date('2021-01-01')
103
+ AND Prescription_Fill_Year_Month <= date('2021-12-31')
104
+ AND indication like '%MM%'
105
+ ),
106
+ kyprolis_2022 AS (
107
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
108
+ FROM """"symphony-data"""".""""test_performance_v3""""
109
+ WHERE Drug_Name like '%KYPROLIS%'
110
+ AND Prescription_Fill_Year_Month >= date('2022-01-01')
111
+ AND Prescription_Fill_Year_Month <= date('2022-12-31')
112
+ AND indication like '%MM%'
113
+ ),
114
+ total_2021 AS (
115
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
116
+ FROM """"symphony-data"""".""""test_performance_v3""""
117
+ WHERE Prescription_Fill_Year_Month >= date('2021-01-01')
118
+ AND Prescription_Fill_Year_Month <= date('2021-12-31')
119
+ AND indication like '%MM%'
120
+ ),
121
+ total_2022 AS (
122
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
123
+ FROM """"symphony-data"""".""""test_performance_v3""""
124
+ WHERE Prescription_Fill_Year_Month >= date('2022-01-01')
125
+ AND Prescription_Fill_Year_Month <= date('2022-12-31')
126
+ AND indication like '%MM%'
127
+ )
128
+ SELECT
129
+ ROUND(100.0 * kyprolis_2021.num_prescriptions / total_2021.num_prescriptions, 2) AS kyprolis_2021_market_share,
130
+ ROUND(100.0 * kyprolis_2022.num_prescriptions / total_2022.num_prescriptions, 2) AS kyprolis_2022_market_share
131
+ FROM kyprolis_2021, kyprolis_2022, total_2021, total_2022;"
132
+ 9,Generate an ANSI/PRESTO sql query for the question :What's the most prescribed brand for MM indication? What is it's market share?,"""
133
+
134
+ WITH
135
+ kyprolis_2021 AS (
136
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
137
+ FROM """"symphony-data"""".""""test_performance_v3""""
138
+ WHERE Drug_Name like '%KYPROLIS%'
139
+ AND Prescription_Fill_Year_Month >= date('2021-01-01')
140
+ AND Prescription_Fill_Year_Month <= date('2021-12-31')
141
+ AND indication like '%MM%'
142
+ ),
143
+ kyprolis_2022 AS (
144
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
145
+ FROM """"symphony-data"""".""""test_performance_v3""""
146
+ WHERE Drug_Name like '%KYPROLIS%'
147
+ AND Prescription_Fill_Year_Month >= date('2022-01-01')
148
+ AND Prescription_Fill_Year_Month <= date('2022-12-31')
149
+ AND indication like '%MM%'
150
+ ),
151
+ total_2021 AS (
152
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
153
+ FROM """"symphony-data"""".""""test_performance_v3""""
154
+ WHERE Prescription_Fill_Year_Month >= date('2021-01-01')
155
+ AND Prescription_Fill_Year_Month <= date('2021-12-31')
156
+ AND indication like '%MM%'
157
+ ),
158
+ total_2022 AS (
159
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
160
+ FROM """"symphony-data"""".""""test_performance_v3""""
161
+ WHERE Prescription_Fill_Year_Month >= date('2022-01-01')
162
+ AND Prescription_Fill_Year_Month <= date('2022-12-31')
163
+ AND indication like '%MM%'
164
+ )
165
+ SELECT
166
+ ROUND(100.0 * kyprolis_2021.num_prescriptions / total_2021.num_prescriptions, 2) AS kyprolis_2021_market_share,
167
+ ROUND(100.0 * kyprolis_2022.num_prescriptions / total_2022.num_prescriptions, 2) AS kyprolis_2022_market_share
168
+ FROM kyprolis_2021, kyprolis_2022, total_2021, total_2022;"""
169
+ 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 MM indication compared to its competitors?","
170
+
171
+ WITH kyprolis_claims AS (
172
+ SELECT Patient_State, COUNT(distinct(claim_ID)) AS num_claims
173
+ FROM ""symphony-data"".""test_performance_v3""
174
+ WHERE Drug_Name like '%KYPROLIS%'
175
+ AND indication like '%MM%'
176
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
177
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
178
+ GROUP BY Patient_State
179
+ ),
180
+ competitor_claims AS (
181
+ SELECT Patient_State, COUNT(distinct(claim_ID)) AS num_claims
182
+ FROM ""symphony-data"".""test_performance_v3""
183
+ WHERE Drug_Name not like '%KYPROLIS%'
184
+ AND indication like '%MM%'
185
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
186
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
187
+ GROUP BY Patient_State
188
+ )
189
+ SELECT kyprolis_claims.Patient_State
190
+ FROM kyprolis_claims, competitor_claims
191
+ WHERE kyprolis_claims.num_claims > competitor_claims.num_claims;"
192
+ 11,Generate an ANSI/PRESTO sql query for the question :What is the relative growth of Kyprolis in last 3 months compared to previous year?,"
193
+
194
+ WITH
195
+ numerator AS (
196
+ 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)
197
+ from ""symphony-data"".""test_performance_v3"") - interval '3' month) and Drug_Name like '%KYPROLIS%'
198
+ ),
199
+ denominator AS(
200
+ 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)
201
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year - interval '3' month) and Prescription_Fill_Year_Month <= date((select max(Prescription_Fill_Year_Month)
202
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year) and Drug_Name like '%KYPROLIS%'
203
+ )
204
+ SELECT (cast(numerator.total_claims as double) / (denominator.total_claims)-1)*100 as relative_growth from numerator, denominator;"
205
+ 12,Generate an ANSI/PRESTO sql query for the question :How did Kyprolis prescriptions for MM indication grow for 2021 vs 2020?,"
206
+
207
+ WITH
208
+ kyprolis_prescriptions_2021 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 '%MM%'
213
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
214
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year)
215
+ AND Prescription_Fill_Year_Month < date((select max(Prescription_Fill_Year_Month)
216
+ from ""symphony-data"".""test_performance_v3""))
217
+ ),
218
+ kyprolis_prescriptions_2020 AS (
219
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
220
+ FROM ""symphony-data"".""test_performance_v3""
221
+ WHERE Drug_Name like '%KYPROLIS%'
222
+ AND indication like '%MM%'
223
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
224
+ from ""symphony-data"".""test_performance_v3"") - interval '2' year)
225
+ AND Prescription_Fill_Year_Month < date((select max(Prescription_Fill_Year_Month)
226
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year)
227
+ )
228
+ 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;"
229
+ 13,Generate an ANSI/PRESTO sql query for the question :Calculate evolution index for Kyprolis for MM indication for the last 3 months versus same time period last year,"
230
+
231
+ WITH
232
+ kyprolis_prescriptions_current AS (
233
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
234
+ FROM ""symphony-data"".""test_performance_v3""
235
+ WHERE Drug_Name like '%KYPROLIS%'
236
+ AND indication like '%MM%'
237
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
238
+ from ""symphony-data"".""test_performance_v3"") - interval '3' month)
239
+ ),
240
+ kyprolis_prescriptions_previous AS (
241
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
242
+ FROM ""symphony-data"".""test_performance_v3""
243
+ WHERE Drug_Name like '%KYPROLIS%'
244
+ AND indication like '%MM%'
245
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
246
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year - interval '3' month)
247
+ AND Prescription_Fill_Year_Month <= date((select max(Prescription_Fill_Year_Month)
248
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year)
249
+ ),
250
+ mm_prescriptions_current AS (
251
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
252
+ FROM ""symphony-data"".""test_performance_v3""
253
+ WHERE indication like '%MM%'
254
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
255
+ from ""symphony-data"".""test_performance_v3"") - interval '3' month)
256
+ ),
257
+ mm_prescriptions_previous AS (
258
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
259
+ FROM ""symphony-data"".""test_performance_v3""
260
+ WHERE indication like '%MM%'
261
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
262
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year - interval '3' month)
263
+ AND Prescription_Fill_Year_Month <= date((select max(Prescription_Fill_Year_Month)
264
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year)
265
+ )
266
+ SELECT
267
+ ROUND(((1 + (cast(kyprolis_prescriptions_current.num_prescriptions as double) / kyprolis_prescriptions_previous.num_prescriptions - 1)) / (1 + (cast(mm_prescriptions_current.num_prescriptions as double) / mm_prescriptions_previous.num_prescriptions - 1))) ,2) as evolution_index"
268
+ 14,Generate an ANSI/PRESTO sql query for the question :In which state has Kyprolis presciption count grown the most over the last 3 months compared to the same time period last year?,"
269
+
270
+ WITH
271
+ numerator AS (
272
+ SELECT Patient_State, COUNT(distinct(claim_ID)) as total_claims
273
+ FROM ""symphony-data"".""test_performance_v3""
274
+ WHERE Drug_Name like '%KYPROLIS%'
275
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
276
+ from ""symphony-data"".""test_performance_v3"") - interval '3' month)
277
+ GROUP BY Patient_State
278
+ ),
279
+ denominator AS(
280
+ SELECT Patient_State, COUNT(distinct(claim_ID)) as total_claims
281
+ FROM ""symphony-data"".""test_performance_v3""
282
+ WHERE Drug_Name like '%KYPROLIS%'
283
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
284
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year - interval '3' month)
285
+ AND Prescription_Fill_Year_Month <= date((select max(Prescription_Fill_Year_Month)
286
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year)
287
+ GROUP BY Patient_State
288
+ )
289
+ SELECT numerator.Patient_State, (cast(numerator.total_claims as double) / (denominator.total_claims)-1)*100 as growth_percentage
290
+ FROM numerator, denominator
291
+ ORDER BY growth_percentage DESC
292
+ LIMIT 1;"
293
+ 15,"Generate an ANSI/PRESTO sql query for the question :For patients over 60 prescribed drugs for MM indication, what percentage of those prescriptions were for Kyprolis? ","
294
+
295
+ WITH
296
+ total_prescriptions AS (
297
+ SELECT COUNT(distinct(claim_ID)) AS total_prescriptions
298
+ FROM ""symphony-data"".""test_performance_v3""
299
+ WHERE indication like '%MM%'
300
+ AND patient_age >= 60
301
+ ),
302
+ kyprolis_prescriptions AS (
303
+ SELECT COUNT(distinct(claim_ID)) AS kyprolis_prescriptions
304
+ FROM ""symphony-data"".""test_performance_v3""
305
+ WHERE indication like '%MM%'
306
+ AND patient_age >= 60
307
+ AND Drug_Name like '%KYPROLIS%'
308
+ )
309
+ SELECT ROUND(100.0 * kyprolis_prescriptions.kyprolis_prescriptions / total_prescriptions.total_prescriptions, 2) as kyprolis_percentage
310
+ FROM total_prescriptions, kyprolis_prescriptions;"
311
+ 16,Generate an ANSI/PRESTO sql query for the question :What is the market share of Kyprolis in MM indication for patients above 60 years?,"
312
+
313
+ WITH num AS (
314
+ SELECT COUNT(DISTINCT(Claim_ID)) AS num_data
315
+ FROM ""symphony-data"".""test_performance_v3""
316
+ WHERE Drug_Name LIKE '%KYPROLIS%'
317
+ AND indication LIKE '%MM%'
318
+ AND patient_age >= 60
319
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
320
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
321
+ ),
322
+ den AS (
323
+ SELECT COUNT(DISTINCT(Claim_ID)) AS den_data
324
+ FROM ""symphony-data"".""test_performance_v3""
325
+ WHERE indication LIKE '%MM%'
326
+ AND patient_age >= 60
327
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
328
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
329
+ )
330
+ SELECT ROUND(100.0 * num_data / den_data, 2) AS market_share
331
+ FROM num, den;"
332
+ 17,Generate an ANSI/PRESTO sql query for the question :What is the market share of Kyprolis in MM indication for female/male patients over the last 6 months?,"
333
+
334
+ WITH num AS
335
+ (
336
+ SELECT COUNT(DISTINCT(Claim_ID)) AS num_data
337
+ FROM ""symphony-data"".""test_performance_v3""
338
+ WHERE Drug_Name LIKE '%KYPROLIS%'
339
+ AND indication LIKE '%MM%'
340
+ AND Patient_Gender IN ('Male', 'Female')
341
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
342
+ from ""symphony-data"".""test_performance_v3"") - interval '180' day)
343
+ ),
344
+ den AS
345
+ (
346
+ SELECT COUNT(DISTINCT(Claim_ID)) AS den_data
347
+ FROM ""symphony-data"".""test_performance_v3""
348
+ WHERE indication LIKE '%MM%'
349
+ AND Patient_Gender IN ('Male', 'Female')
350
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
351
+ from ""symphony-data"".""test_performance_v3"") - interval '180' day)
352
+ )
353
+ SELECT ROUND(100.0 * num_data / den_data, 2) AS market_share
354
+ FROM num, den;"
355
+ 18,Generate an ANSI/PRESTO sql query for the question :Which drug had highest claims for patients above 60 in MM indication over the last 1 year?,"
356
+
357
+ SELECT Drug_Name, COUNT(distinct(claim_ID)) as num_prescriptions
358
+ FROM ""symphony-data"".""test_performance_v3""
359
+ WHERE indication like '%MM%'
360
+ AND patient_age > 60
361
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
362
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year)
363
+ GROUP BY Drug_Name
364
+ ORDER BY num_prescriptions DESC
365
+ LIMIT 1;"
366
+ 19,Generate an ANSI/PRESTO sql query for the question :Which state in the US had the highest number of claims in the MM indication for patients over the age of 60 over the last 3 months? Exclude None and blank values in state column,"
367
+ SELECT Patient_State, COUNT(distinct(Claim_ID)) as num_claims
368
+ FROM ""symphony-data"".""test_performance_v3""
369
+ WHERE indication like '%MM%'
370
+ AND Patient_State NOT IN ('None', '')
371
+ AND patient_age > 60
372
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
373
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
374
+ GROUP BY Patient_State
375
+ ORDER BY num_claims DESC
376
+ LIMIT 1;"
377
+ 20,Generate an ANSI/PRESTO sql query for the question :What is the most common payer type for Kyprolis in last 3 months?,"
378
+ SELECT plan_type_description, COUNT(distinct(claim_ID)) as num_prescriptions
379
+ FROM ""symphony-data"".""test_performance_v3""
380
+ WHERE Drug_Name like '%KYPROLIS%'
381
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
382
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
383
+ AND plan_type_description NOT IN ('NONE', '')
384
+ GROUP BY plan_type_description
385
+ ORDER BY num_prescriptions DESC
386
+ LIMIT 1;"
387
+ 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 3 months?,"
388
+ SELECT AVG(Total_Patient_Responsibility) as avg_patient_pay
389
+ FROM ""symphony-data"".""test_performance_v3""
390
+ WHERE Drug_Name like '%KYPROLIS%'
391
+ AND Patient_State = 'NY'
392
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
393
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day);"
394
+ 22,Generate an ANSI/PRESTO sql query for the question :Could you provide a ranking of all the brands in the MM indication based on their share of commercial payers over the last 3 months?,"
395
+ WITH
396
+ commercial_payers AS (
397
+ SELECT Drug_Name, COUNT(distinct(claim_ID)) as num_prescriptions
398
+ FROM ""symphony-data"".""test_performance_v3""
399
+ WHERE plan_type_description = 'COMMERCIAL'
400
+ AND indication like '%MM%'
401
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
402
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
403
+ GROUP BY Drug_Name
404
+ ),
405
+ total_payers AS (
406
+ SELECT COUNT(distinct(claim_ID)) as total_prescriptions
407
+ FROM ""symphony-data"".""test_performance_v3""
408
+ WHERE indication like '%MM%'
409
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
410
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
411
+ )
412
+ SELECT Drug_Name, ROUND(100.0 * num_prescriptions / total_prescriptions, 2) as share_of_commercial_payers
413
+ FROM commercial_payers, total_payers
414
+ ORDER BY share_of_commercial_payers DESC;"
415
+ 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 MM indication over the last 6 months, could you please give me the 5 drugs with lowest out-of-pocket expenses?","
416
+ WITH avg_patient_pay AS (
417
+ SELECT Drug_Name, AVG(Total_Patient_Responsibility) as avg_patient_pay
418
+ FROM ""symphony-data"".""test_performance_v3""
419
+ WHERE indication like '%MM%'
420
+ AND patient_age >= 60
421
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
422
+ from ""symphony-data"".""test_performance_v3"") - interval '6' month)
423
+ GROUP BY Drug_Name
424
+ )
425
+ SELECT Drug_Name, avg_patient_pay
426
+ FROM avg_patient_pay
427
+ ORDER BY avg_patient_pay ASC
428
+ LIMIT 5;"
429
+ 24,Generate an ANSI/PRESTO sql query for the question :What is Kyprolis's claims volume in the last 9 months?,"
430
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
431
+ FROM ""symphony-data"".""test_performance_v3""
432
+ WHERE Drug_Name like '%KYPROLIS%'
433
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
434
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month);"
435
+ 25,Generate an ANSI/PRESTO sql query for the question :What is Kyprolis's claims volume in the last 9 months for CML indication?,"
436
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
437
+ FROM ""symphony-data"".""test_performance_v3""
438
+ WHERE Drug_Name like '%KYPROLIS%'
439
+ AND indication like '%CML%'
440
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
441
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month);"
442
+ 26,Generate an ANSI/PRESTO sql query for the question :Which brand had the highest claims in CML indication in last 9 months?,"
443
+ SELECT Drug_Name, COUNT(distinct(claim_ID)) as num_prescriptions
444
+ FROM ""symphony-data"".""test_performance_v3""
445
+ WHERE indication like '%CML%'
446
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
447
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month)
448
+ GROUP BY Drug_Name
449
+ ORDER BY num_prescriptions DESC
450
+ LIMIT 1;"
451
+ 27,Generate an ANSI/PRESTO sql query for the question :Which brand had the highest claims in NY state in CML indication in last 9 months?,"
452
+ SELECT Drug_Name, COUNT(distinct(claim_ID)) as num_claims
453
+ FROM ""symphony-data"".""test_performance_v3""
454
+ WHERE indication like '%CML%'
455
+ AND Patient_State = 'NY'
456
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
457
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month)
458
+ GROUP BY Drug_Name
459
+ ORDER BY num_claims DESC
460
+ LIMIT 1;"
461
+ 28,Generate an ANSI/PRESTO sql query for the question :Identify the state where Kyprolis had the least prescriptions for CML indications? Ignore blanks for state,"
462
+ SELECT Patient_State, COUNT(distinct(Claim_ID)) as num_prescriptions
463
+ FROM ""symphony-data"".""test_performance_v3""
464
+ WHERE Drug_Name like '%KYPROLIS%'
465
+ AND indication like '%CML%'
466
+ AND Patient_State NOT LIKE 'None'
467
+ AND Patient_State NOT LIKE ''
468
+ GROUP BY Patient_State
469
+ ORDER BY num_prescriptions ASC
470
+ LIMIT 1;"
471
+ 29,Generate an ANSI/PRESTO sql query for the question :What was the market share of the top 5 drugs prescribed for CML indication over the last 9 months?,"
472
+ WITH top_5_drugs AS (
473
+ SELECT Drug_Name, count(distinct(claim_ID)) as num_prescriptions
474
+ FROM ""symphony-data"".""test_performance_v3""
475
+ WHERE indication like '%CML%'
476
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
477
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month)
478
+ GROUP BY Drug_Name
479
+ order by num_prescriptions desc
480
+ limit 5
481
+ ),
482
+ total_prescriptions AS (
483
+ SELECT COUNT(distinct(claim_ID)) as total_prescriptions
484
+ FROM ""symphony-data"".""test_performance_v3""
485
+ WHERE indication like '%CML%'
486
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
487
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month)
488
+ )
489
+ SELECT
490
+ top_5_drugs.Drug_Name,
491
+ ROUND(100.0 * top_5_drugs.num_prescriptions / total_prescriptions.total_prescriptions, 2) as market_share
492
+ FROM top_5_drugs, total_prescriptions;"
493
+ 30,Generate an ANSI/PRESTO sql query for the question :Give me the market share by drug for the top 5 drugs for CML indication over the last 9 months,"
494
+ WITH top_5_drugs AS (
495
+ SELECT Drug_Name, count (distinct(claim_id)) as prescription_count
496
+ FROM ""symphony-data"".""test_performance_v3""
497
+ WHERE indication like '%CML%'
498
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
499
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month)
500
+ GROUP BY Drug_Name
501
+ order by prescription_count desc
502
+ limit 5
503
+ ),
504
+ total_prescriptions AS (
505
+ SELECT COUNT(distinct(claim_ID)) AS total_prescriptions
506
+ FROM ""symphony-data"".""test_performance_v3""
507
+ WHERE indication like '%CML%'
508
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
509
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month)
510
+ )
511
+ SELECT
512
+ top_5_drugs.Drug_Name,
513
+ ROUND(100.0 * top_5_drugs.prescription_count / total_prescriptions.total_prescriptions, 2) as market_share
514
+ FROM top_5_drugs, total_prescriptions;"
515
+ 31,Generate an ANSI/PRESTO sql query for the question :What was the market share for Kyprolis for years 2020 and 2022 for CML indication?,"
516
+ WITH
517
+ kyprolis_2020 AS (
518
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
519
+ FROM ""symphony-data"".""test_performance_v3""
520
+ WHERE Drug_Name like '%KYPROLIS%'
521
+ AND Prescription_Fill_Year_Month >= date '2020-01-01'
522
+ AND Prescription_Fill_Year_Month <= date '2020-12-31'
523
+ AND indication like '%CML%'
524
+ ),
525
+ kyprolis_2022 AS (
526
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
527
+ FROM ""symphony-data"".""test_performance_v3""
528
+ WHERE Drug_Name like '%KYPROLIS%'
529
+ AND Prescription_Fill_Year_Month >= date '2022-01-01'
530
+ AND Prescription_Fill_Year_Month <= date '2022-12-31'
531
+ AND indication like '%CML%'
532
+ ),
533
+ total_2020 AS (
534
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
535
+ FROM ""symphony-data"".""test_performance_v3""
536
+ WHERE Prescription_Fill_Year_Month >= date '2020-01-01'
537
+ AND Prescription_Fill_Year_Month <= date '2020-12-31'
538
+ AND indication like '%CML%'
539
+ ),
540
+ total_2022 AS (
541
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
542
+ FROM ""symphony-data"".""test_performance_v3""
543
+ WHERE Prescription_Fill_Year_Month >= date '2022-01-01'
544
+ AND Prescription_Fill_Year_Month <= date '2022-12-31'
545
+ AND indication like '%CML%'
546
+ )
547
+ SELECT
548
+ ROUND(100.0 * kyprolis_2020.num_prescriptions / total_2020.num_prescriptions, 2) AS kyprolis_2020_market_share,
549
+ ROUND(100.0 * kyprolis_2022.num_prescriptions / total_2022.num_prescriptions, 2) AS kyprolis_2022_market_share
550
+ FROM kyprolis_2020, kyprolis_2022, total_2020, total_2022;"
551
+ 32,Generate an ANSI/PRESTO sql query for the question :What's the most prescribed brand for CML indication? What is it's market share?,"
552
+ WITH num AS (
553
+ SELECT COUNT(DISTINCT(Claim_ID)) AS num_data
554
+ FROM ""symphony-data"".""test_performance_v3""
555
+ WHERE indication LIKE '%CML%'
556
+ AND Prescription_Fill_Year_Month >= date((SELECT MAX(Prescription_Fill_Year_Month)
557
+ FROM ""symphony-data"".""test_performance_v3"") - INTERVAL '9' MONTH)
558
+ AND Drug_Name IN (SELECT Drug_Name
559
+ FROM ""symphony-data"".""test_performance_v3""
560
+ WHERE indication LIKE '%CML%'
561
+ GROUP BY Drug_Name
562
+ ORDER BY COUNT(DISTINCT(Claim_ID)) DESC
563
+ LIMIT 1)
564
+ ),
565
+ den AS (
566
+ SELECT COUNT(DISTINCT(Claim_ID)) AS den_data
567
+ FROM ""symphony-data"".""test_performance_v3""
568
+ WHERE indication IN (SELECT DISTINCT(indication)
569
+ FROM ""symphony-data"".""test_performance_v3""
570
+ WHERE indication NOT LIKE 'No Indication'
571
+ AND indication NOT LIKE 'Unknown_Flag'
572
+ AND indication LIKE '%CML%')
573
+ AND Prescription_Fill_Year_Month >= date((SELECT MAX(Prescription_Fill_Year_Month)
574
+ FROM ""symphony-data"".""test_performance_v3"") - INTERVAL '9' MONTH)
575
+ )
576
+ SELECT ROUND(100.0 * num_data / den_data, 2) AS market_share
577
+ FROM num, den;"
578
+ 33,"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 CML indication compared to its competitors?","
579
+ WITH kyprolis_prescriptions AS (
580
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions, Patient_State
581
+ FROM ""symphony-data"".""test_performance_v3""
582
+ WHERE Drug_Name like '%KYPROLIS%'
583
+ AND indication like '%CML%'
584
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
585
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
586
+ GROUP BY Patient_State
587
+ ),
588
+ competitor_prescriptions AS (
589
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions, Patient_State
590
+ FROM ""symphony-data"".""test_performance_v3""
591
+ WHERE Drug_Name not like '%KYPROLIS%'
592
+ AND indication like '%CML%'
593
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
594
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
595
+ GROUP BY Patient_State
596
+ )
597
+ SELECT kyprolis_prescriptions.Patient_State, kyprolis_prescriptions.num_prescriptions AS kyprolis_prescription_count, competitor_prescriptions.num_prescriptions AS competitor_prescription_count
598
+ FROM kyprolis_prescriptions, competitor_prescriptions
599
+ WHERE kyprolis_prescriptions.Patient_State = competitor_prescriptions.Patient_State
600
+ AND kyprolis_prescriptions.num_prescriptions > competitor_prescriptions.num_prescriptions
601
+ ORDER BY kyprolis_prescriptions.num_prescriptions DESC;"
602
+ 34,Generate an ANSI/PRESTO sql query for the question :What is the relative growth of Kyprolis in last 9 months compared to previous year?,"
603
+ WITH
604
+ numerator AS (
605
+ 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)
606
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month) and Drug_Name like '%KYPROLIS%'
607
+ ),
608
+ denominator AS(
609
+ 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)
610
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year - interval '9' month) and Prescription_Fill_Year_Month <= date((select max(Prescription_Fill_Year_Month)
611
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year) and Drug_Name like '%KYPROLIS%'
612
+ )
613
+ SELECT (cast(numerator.total_claims as double) / (denominator.total_claims)-1)*100 as relative_growth from numerator, denominator;"
614
+ 35,Generate an ANSI/PRESTO sql query for the question :How did Kyprolis prescriptions for CML indication grow for 2022 vs 2020?,"
615
+ WITH
616
+ kyprolis_prescriptions_2020 AS (
617
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
618
+ FROM ""symphony-data"".""test_performance_v3""
619
+ WHERE Drug_Name like '%KYPROLIS%'
620
+ AND indication like '%CML%'
621
+ AND Prescription_Fill_Year_Month >= date('2020-01-01')
622
+ AND Prescription_Fill_Year_Month <= date('2020-12-31')
623
+ ),
624
+ kyprolis_prescriptions_2022 AS (
625
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
626
+ FROM ""symphony-data"".""test_performance_v3""
627
+ WHERE Drug_Name like '%KYPROLIS%'
628
+ AND indication like '%CML%'
629
+ AND Prescription_Fill_Year_Month >= date('2022-01-01')
630
+ AND Prescription_Fill_Year_Month <= date('2022-12-31')
631
+ )
632
+ SELECT (cast(kyprolis_prescriptions_2022.num_prescriptions as double) / (kyprolis_prescriptions_2020.num_prescriptions)-1)*100 as growth from kyprolis_prescriptions_2020, kyprolis_prescriptions_2022;"
633
+ 36,Generate an ANSI/PRESTO sql query for the question :Calculate evolution index for Kyprolis for CML indication for the last 9 months versus same time period last year,"WITH
634
+ kyprolis_prescriptions_current AS (
635
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
636
+ FROM ""symphony-data"".""test_performance_v3""
637
+ WHERE Drug_Name like '%KYPROLIS%'
638
+ AND indication like '%CML%'
639
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
640
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month)
641
+ ),
642
+ kyprolis_prescriptions_previous AS (
643
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
644
+ FROM ""symphony-data"".""test_performance_v3""
645
+ WHERE Drug_Name like '%KYPROLIS%'
646
+ AND indication like '%CML%'
647
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
648
+ from ""symphony-data"".""test_performance_v3"") - interval '18' month)
649
+ AND Prescription_Fill_Year_Month <= date((select max(Prescription_Fill_Year_Month)
650
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month)
651
+ ),
652
+ cml_prescriptions_current AS (
653
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
654
+ FROM ""symphony-data"".""test_performance_v3""
655
+ WHERE indication like '%CML%'
656
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
657
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month)
658
+ ),
659
+ cml_prescriptions_previous AS (
660
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
661
+ FROM ""symphony-data"".""test_performance_v3""
662
+ WHERE indication like '%CML%'
663
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
664
+ from ""symphony-data"".""test_performance_v3"") - interval '18' month)
665
+ AND Prescription_Fill_Year_Month <= date((select max(Prescription_Fill_Year_Month)
666
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month)
667
+ )
668
+ SELECT (cast((kyprolis_prescriptions_current.num_prescriptions/kyprolis_prescriptions_previous.num_prescriptions)-1 as double) / (cast((cml_prescriptions_current.num_prescriptions/cml_prescriptions_previous.num_prescriptions)-1 as double))) as evolution_index
669
+ FROM kyprolis_prescriptions_current, kyprolis_prescriptions_previous, cml_prescriptions_current, cml_prescriptions_previous;"
670
+ 37,Generate an ANSI/PRESTO sql query for the question :In which state has Kyprolis presciption count grown the most over the last 9 months compared to the same time period last year?,"
671
+ WITH
672
+ kyprolis_prescriptions_current_year AS (
673
+ SELECT Patient_State, COUNT(distinct(claim_ID)) AS num_prescriptions
674
+ FROM ""symphony-data"".""test_performance_v3""
675
+ WHERE Drug_Name like '%KYPROLIS%'
676
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
677
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month)
678
+ GROUP BY Patient_State
679
+ ),
680
+ kyprolis_prescriptions_previous_year AS (
681
+ SELECT Patient_State, COUNT(distinct(claim_ID)) AS num_prescriptions
682
+ FROM ""symphony-data"".""test_performance_v3""
683
+ WHERE Drug_Name like '%KYPROLIS%'
684
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
685
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year - interval '9' month)
686
+ AND Prescription_Fill_Year_Month <= date((select max(Prescription_Fill_Year_Month)
687
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year)
688
+ GROUP BY Patient_State
689
+ )
690
+ SELECT
691
+ kyprolis_prescriptions_current_year.Patient_State,
692
+ (cast(kyprolis_prescriptions_current_year.num_prescriptions as double) / (kyprolis_prescriptions_previous_year.num_prescriptions)-1)*100 as growth
693
+ FROM kyprolis_prescriptions_current_year, kyprolis_prescriptions_previous_year
694
+ WHERE kyprolis_prescriptions_current_year.Patient_State = kyprolis_prescriptions_previous_year.Patient_State
695
+ ORDER BY growth DESC
696
+ LIMIT 1;"
697
+ 38,"Generate an ANSI/PRESTO sql query for the question :For patients over 60 prescribed drugs for CML indication, what percentage of those prescriptions were for Kyprolis? ","
698
+ WITH
699
+ total_prescriptions AS (
700
+ SELECT COUNT(distinct(claim_ID)) AS total_prescriptions
701
+ FROM ""symphony-data"".""test_performance_v3""
702
+ WHERE indication like '%CML%'
703
+ AND patient_age >= 60
704
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
705
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
706
+ ),
707
+ kyprolis_prescriptions AS (
708
+ SELECT COUNT(distinct(claim_ID)) AS kyprolis_prescriptions
709
+ FROM ""symphony-data"".""test_performance_v3""
710
+ WHERE Drug_Name like '%KYPROLIS%'
711
+ AND indication like '%CML%'
712
+ AND patient_age >= 60
713
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
714
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
715
+ )
716
+ SELECT ROUND(100.0 * kyprolis_prescriptions.kyprolis_prescriptions / total_prescriptions.total_prescriptions, 2) as kyprolis_percentage
717
+ FROM total_prescriptions, kyprolis_prescriptions;"
718
+ 39,Generate an ANSI/PRESTO sql query for the question :What is the market share of Kyprolis in CML indication for patients above 40 years?,"
719
+ WITH num AS (
720
+ SELECT COUNT(DISTINCT(Claim_ID)) AS num_data
721
+ FROM ""symphony-data"".""test_performance_v3""
722
+ WHERE Drug_Name LIKE '%KYPROLIS%'
723
+ AND indication LIKE '%CML%'
724
+ AND patient_age > 40
725
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
726
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
727
+ ),
728
+ den AS (
729
+ SELECT COUNT(DISTINCT(Claim_ID)) AS den_data
730
+ FROM ""symphony-data"".""test_performance_v3""
731
+ WHERE indication LIKE '%CML%'
732
+ AND patient_age > 40
733
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
734
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
735
+ )
736
+ SELECT ROUND(100.0 * num_data / den_data, 2) AS market_share
737
+ FROM num, den;"
738
+ 40,Generate an ANSI/PRESTO sql query for the question :What is the market share of Kyprolis in CML indication for female/male patients over the last 9 months?,"""WITH
739
+ kyprolis_prescriptions AS (
740
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
741
+ FROM """"symphony-data"""".""""test_performance_v3""""
742
+ WHERE Drug_Name like '%KYPROLIS%'
743
+ AND indication like '%CML%'
744
+ AND Patient_Gender IN ('Male', 'Female')
745
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
746
+ from """"symphony-data"""".""""test_performance_v3"""") - interval '9' month)
747
+ ),
748
+ total_prescriptions AS (
749
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
750
+ FROM """"symphony-data"""".""""test_performance_v3""""
751
+ WHERE indication like '%CML%'
752
+ AND Patient_Gender IN ('Male', 'Female')
753
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
754
+ from """"symphony-data"""".""""test_performance_v3"""") - interval '9' month)
755
+ )
756
+ SELECT ROUND(100.0 * kyprolis_prescriptions.num_prescriptions / total_prescriptions.num_prescriptions, 2) as market_share from kyprolis_prescriptions, total_prescriptions;"""
757
+ 41,Generate an ANSI/PRESTO sql query for the question :Which drug had highest claims for patients above 60 in CML indication over the last 1 year?,"WITH
758
+ kyprolis_prescriptions AS (
759
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
760
+ FROM ""symphony-data"".""test_performance_v3""
761
+ WHERE Drug_Name like '%KYPROLIS%'
762
+ AND indication like '%CML%'
763
+ AND Patient_Gender IN ('Male', 'Female')
764
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
765
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month)
766
+ ),
767
+ total_prescriptions AS (
768
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
769
+ FROM ""symphony-data"".""test_performance_v3""
770
+ WHERE indication like '%CML%'
771
+ AND Patient_Gender IN ('Male', 'Female')
772
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
773
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month)
774
+ )
775
+ SELECT ROUND(100.0 * kyprolis_prescriptions.num_prescriptions / total_prescriptions.num_prescriptions, 2) as market_share from kyprolis_prescriptions, total_prescriptions;
776
+ WITH cml_prescriptions AS (
777
+ SELECT Drug_Name, COUNT(distinct(claim_ID)) AS num_prescriptions
778
+ FROM ""symphony-data"".""test_performance_v3""
779
+ WHERE indication like '%CML%'
780
+ AND patient_age > 60
781
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
782
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year)
783
+ GROUP BY Drug_Name
784
+ )
785
+ SELECT Drug_Name, num_prescriptions
786
+ FROM cml_prescriptions
787
+ ORDER BY num_prescriptions DESC
788
+ LIMIT 1;"
789
+ 42,Generate an ANSI/PRESTO sql query for the question :Which state in the US had the highest number of claims in the CML indication for patients over the age of 60 over the last 9 months? Exclude None and blank values in state column,"
790
+ WITH
791
+ kyprolis_prescriptions AS (
792
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
793
+ FROM ""symphony-data"".""test_performance_v3""
794
+ WHERE Drug_Name like '%KYPROLIS%'
795
+ AND indication like '%CML%'
796
+ AND Patient_Gender IN ('Male', 'Female')
797
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
798
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month)
799
+ ),
800
+ total_prescriptions AS (
801
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
802
+ FROM ""symphony-data"".""test_performance_v3""
803
+ WHERE indication like '%CML%'
804
+ AND Patient_Gender IN ('Male', 'Female')
805
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
806
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month)
807
+ )
808
+ SELECT ROUND(100.0 * kyprolis_prescriptions.num_prescriptions / total_prescriptions.num_prescriptions, 2) as market_share from kyprolis_prescriptions, total_prescriptions;
809
+ WITH cml_prescriptions AS (
810
+ SELECT Drug_Name, COUNT(distinct(claim_ID)) AS num_prescriptions
811
+ FROM ""symphony-data"".""test_performance_v3""
812
+ WHERE indication like '%CML%'
813
+ AND patient_age > 60
814
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
815
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year)
816
+ GROUP BY Drug_Name
817
+ )
818
+ SELECT Drug_Name, num_prescriptions
819
+ FROM cml_prescriptions
820
+ ORDER BY num_prescriptions DESC
821
+ LIMIT 1;
822
+ SELECT Patient_State, COUNT(distinct(Claim_ID)) as num_claims
823
+ FROM ""symphony-data"".""test_performance_v3""
824
+ WHERE indication like '%CML%'
825
+ AND Patient_State NOT IN ('None', '')
826
+ AND patient_age > 60
827
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
828
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month)
829
+ GROUP BY Patient_State
830
+ ORDER BY num_claims DESC
831
+ LIMIT 1;"
832
+ 43,Generate an ANSI/PRESTO sql query for the question :What is the most common payer type for Kyprolis in last 9 months?,"
833
+ WITH kyprolis_prescriptions AS (
834
+ SELECT plan_type_description, COUNT(distinct(claim_ID)) AS num_prescriptions
835
+ FROM ""symphony-data"".""test_performance_v3""
836
+ WHERE Drug_Name like '%KYPROLIS%'
837
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
838
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month)
839
+ AND plan_type_description NOT IN ('NONE', '')
840
+ GROUP BY plan_type_description
841
+ )
842
+ SELECT plan_type_description, num_prescriptions
843
+ FROM kyprolis_prescriptions
844
+ ORDER BY num_prescriptions DESC
845
+ LIMIT 1;"
846
+ 44,Generate an ANSI/PRESTO sql query for the question :What is the avg. out of pocket pay for Kyprolis in NY state in last 9 months?,"
847
+ SELECT AVG(Total_Patient_Responsibility) as avg_patient_pay
848
+ FROM ""symphony-data"".""test_performance_v3""
849
+ WHERE Drug_Name like '%KYPROLIS%'
850
+ AND Patient_State = 'New York'
851
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
852
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month);"
853
+ 45,Generate an ANSI/PRESTO sql query for the question :Could you provide a ranking of all the brands in the CML indication based on their share of commercial payers over the last 9 months?,"WITH
854
+ commercial_payers AS (
855
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
856
+ FROM ""symphony-data"".""test_performance_v3""
857
+ WHERE plan_type_description = 'COMMERCIAL'
858
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
859
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month)
860
+ AND indication like '%CML%'
861
+ ),
862
+ total_payers AS (
863
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
864
+ FROM ""symphony-data"".""test_performance_v3""
865
+ WHERE Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
866
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month)
867
+ AND indication like '%CML%'
868
+ )
869
+ SELECT Drug_Name, ROUND(100.0 * commercial_payers.num_prescriptions / total_payers.num_prescriptions, 2) as share_of_commercial_payers
870
+ FROM commercial_payers, total_payers
871
+ WHERE Drug_Name in (SELECT distinct(Drug_Name) FROM ""symphony-data"".""test_performance_v3"" WHERE indication like '%CML%')
872
+ ORDER BY share_of_commercial_payers DESC;"
873
+ 46,"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 CML indication over the last 6 months, could you please give me the 5 drugs with lowest out-of-pocket expenses?","
874
+ WITH patient_expenses AS (
875
+ SELECT Drug_Name, AVG(Total_Patient_Responsibility) as avg_patient_pay
876
+ FROM ""symphony-data"".""test_performance_v3""
877
+ WHERE indication like '%CML%'
878
+ AND patient_age >= 60
879
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
880
+ from ""symphony-data"".""test_performance_v3"") - interval '6' month)
881
+ GROUP BY Drug_Name
882
+ )
883
+ SELECT Drug_Name, avg_patient_pay
884
+ FROM patient_expenses
885
+ ORDER BY avg_patient_pay ASC
886
+ LIMIT 5;"
887
+ 47,Generate an ANSI/PRESTO sql query for the question :What is Kyprolis's claims volume in the last 6 months?,"
888
+ SELECT COUNT(distinct(claim_ID)) AS num_claims
889
+ FROM ""symphony-data"".""test_performance_v3""
890
+ WHERE Drug_Name like '%KYPROLIS%'
891
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
892
+ from ""symphony-data"".""test_performance_v3"") - interval '6' month);"
893
+ 48,Generate an ANSI/PRESTO sql query for the question :What is Kyprolis's claims volume in the last 6 months for ITP indication?,"
894
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
895
+ FROM ""symphony-data"".""test_performance_v3""
896
+ WHERE Drug_Name like '%KYPROLIS%'
897
+ AND indication like '%ITP%'
898
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
899
+ from ""symphony-data"".""test_performance_v3"") - interval '6' month);"
900
+ 49,Generate an ANSI/PRESTO sql query for the question :Which brand had the highest claims in ITP indication in last 6 months?,"
901
+ SELECT Drug_Name, COUNT(distinct(claim_ID)) as num_claims
902
+ FROM ""symphony-data"".""test_performance_v3""
903
+ WHERE indication like '%ITP%'
904
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
905
+ from ""symphony-data"".""test_performance_v3"") - interval '6' month)
906
+ GROUP BY Drug_Name
907
+ ORDER BY num_claims DESC
908
+ LIMIT 1;"
909
+ 50,Generate an ANSI/PRESTO sql query for the question :Which brand had the highest claims in NY state in ITP indication in last 6 months?,"
910
+ SELECT Drug_Name, COUNT(distinct(claim_ID)) as num_claims
911
+ FROM ""symphony-data"".""test_performance_v3""
912
+ WHERE indication like '%ITP%'
913
+ AND Patient_State = 'NY'
914
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
915
+ from ""symphony-data"".""test_performance_v3"") - interval '6' month)
916
+ GROUP BY Drug_Name
917
+ ORDER BY num_claims DESC
918
+ LIMIT 1;"
919
+ 51,Generate an ANSI/PRESTO sql query for the question :Identify the state where Kyprolis had the most prescriptions for ITP indications? Ignore blanks for state,"
920
+ SELECT Patient_State, COUNT(distinct(Claim_ID)) as num_prescriptions
921
+ FROM ""symphony-data"".""test_performance_v3""
922
+ WHERE Drug_Name like '%KYPROLIS%'
923
+ AND indication like '%ITP%'
924
+ AND Patient_State NOT LIKE 'None'
925
+ AND Patient_State NOT LIKE ''
926
+ GROUP BY Patient_State
927
+ ORDER BY num_prescriptions DESC
928
+ LIMIT 1;"
929
+ 52,Generate an ANSI/PRESTO sql query for the question :What was the market share of the top 3 drugs prescribed for ITP indication over the last 6 months?,"
930
+ WITH
931
+ top_3_drugs AS (
932
+ SELECT Drug_Name, COUNT(distinct(claim_ID)) as num_prescriptions
933
+ FROM ""symphony-data"".""test_performance_v3""
934
+ WHERE indication like '%ITP%'
935
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
936
+ from ""symphony-data"".""test_performance_v3"") - interval '6' month)
937
+ GROUP BY Drug_Name
938
+ order by num_prescriptions desc
939
+ limit 3
940
+ ),
941
+ total_prescriptions AS (
942
+ SELECT COUNT(distinct(claim_ID)) as total_prescriptions
943
+ FROM ""symphony-data"".""test_performance_v3""
944
+ WHERE indication like '%ITP%'
945
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
946
+ from ""symphony-data"".""test_performance_v3"") - interval '6' month)
947
+ )
948
+ SELECT
949
+ top_3_drugs.Drug_Name,
950
+ ROUND(100.0 * top_3_drugs.num_prescriptions / total_prescriptions.total_prescriptions, 2) as market_share
951
+ FROM top_3_drugs, total_prescriptions;"
952
+ 53,Generate an ANSI/PRESTO sql query for the question :Give me the market share by drug for the top 10 drugs for ITP indication over the last 6 months,"
953
+ WITH num AS (
954
+ SELECT Drug_Name, COUNT(DISTINCT(Claim_ID)) AS num_data
955
+ FROM ""symphony-data"".""test_performance_v3""
956
+ WHERE indication like '%ITP%'
957
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
958
+ from ""symphony-data"".""test_performance_v3"") - interval '6' month)
959
+ GROUP BY Drug_Name
960
+ ORDER BY num_data DESC
961
+ LIMIT 10
962
+ ),
963
+ den AS (
964
+ SELECT COUNT(DISTINCT(Claim_ID)) AS den_data
965
+ FROM ""symphony-data"".""test_performance_v3""
966
+ WHERE indication like '%ITP%'
967
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
968
+ from ""symphony-data"".""test_performance_v3"") - interval '6' month)
969
+ )
970
+ SELECT num.Drug_Name, ROUND(100.0 * num.num_data / den.den_data, 2) AS market_share
971
+ FROM num, den;"
972
+ 54,Generate an ANSI/PRESTO sql query for the question :What was the market share for Kyprolis for years 2021 and 2022 for ITP indication?,"
973
+ WITH num_2021 AS (
974
+ SELECT COUNT(distinct(Claim_ID)) as num_data_2021 from ""symphony-data"".""test_performance_v3"" where Drug_Name like '%KYPROLIS%' and Prescription_Fill_Year_Month >= date('2021-01-01') and Prescription_Fill_Year_Month <= date('2021-12-31') and indication like '%ITP%'
975
+ ),
976
+ den_2021 AS (
977
+ SELECT COUNT(distinct(Claim_ID)) as den_data_2021 from ""symphony-data"".""test_performance_v3"" where indication in (SELECT distinct(indication) FROM ""symphony-data"".""test_performance_v3"" where Drug_Name like '%KYPROLIS%' and indication like '%ITP%' and indication not like 'No Indication' and indication not like 'Unknown_Flag') and Prescription_Fill_Year_Month >= date('2021-01-01') and Prescription_Fill_Year_Month <= date('2021-12-31')
978
+ ),
979
+ num_2022 AS (
980
+ SELECT COUNT(distinct(Claim_ID)) as num_data_2022 from ""symphony-data"".""test_performance_v3"" where Drug_Name like '%KYPROLIS%' and Prescription_Fill_Year_Month >= date('2022-01-01') and Prescription_Fill_Year_Month <= date('2022-12-31') and indication like '%ITP%'
981
+ ),
982
+ den_2022 AS (
983
+ SELECT COUNT(distinct(Claim_ID)) as den_data_2022 from ""symphony-data"".""test_performance_v3"" where indication in (SELECT distinct(indication) FROM ""symphony-data"".""test_performance_v3"" where Drug_Name like '%KYPROLIS%' and indication like '%ITP%' and indication not like 'No Indication' and indication not like 'Unknown_Flag') and Prescription_Fill_Year_Month >= date('2022-01-01') and Prescription_Fill_Year_Month <= date('2022-12-31')
984
+ )
985
+ SELECT ROUND(100.0 * num_data_2021 / den_data_2021, 2) as market_share_2021, ROUND(100.0 * num_data_2022 / den_data_2022, 2) as market_share_2022 from num_2021, den_2021, num_2022, den_2022;"
986
+ 55,Generate an ANSI/PRESTO sql query for the question :What's the most prescribed brand for ITP indication? What is it's market share?,"
987
+ WITH num AS (
988
+ SELECT COUNT(distinct(Claim_ID)) as num_data
989
+ FROM ""symphony-data"".""test_performance_v3""
990
+ WHERE indication like '%ITP%'
991
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
992
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
993
+ ),
994
+ den AS (
995
+ SELECT COUNT(distinct(Claim_ID)) as den_data
996
+ FROM ""symphony-data"".""test_performance_v3""
997
+ WHERE indication like '%ITP%'
998
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
999
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
1000
+ ),
1001
+ brand_data AS (
1002
+ SELECT Drug_Name, COUNT(distinct(Claim_ID)) as brand_data
1003
+ FROM ""symphony-data"".""test_performance_v3""
1004
+ WHERE indication like '%ITP%'
1005
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1006
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
1007
+ GROUP BY Drug_Name
1008
+ ORDER BY brand_data DESC
1009
+ LIMIT 1
1010
+ )
1011
+ SELECT Drug_Name, ROUND(100.0 * brand_data / den_data, 2) as market_share
1012
+ FROM num, den, brand_data;"
1013
+ 56,"Generate an ANSI/PRESTO sql query for the question :Over the past 6 months, which state in the US has seen a higher number of claims for Kyprolis in the ITP indication compared to its competitors?","
1014
+ WITH kyprolis_claims AS (
1015
+ SELECT COUNT(distinct(claim_ID)) AS num_claims, Patient_State
1016
+ FROM ""symphony-data"".""test_performance_v3""
1017
+ WHERE Drug_Name like '%KYPROLIS%'
1018
+ AND indication like '%ITP%'
1019
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1020
+ from ""symphony-data"".""test_performance_v3"") - interval '180' day)
1021
+ GROUP BY Patient_State
1022
+ ),
1023
+ competitor_claims AS (
1024
+ SELECT COUNT(distinct(claim_ID)) AS num_claims, Patient_State
1025
+ FROM ""symphony-data"".""test_performance_v3""
1026
+ WHERE Drug_Name not like '%KYPROLIS%'
1027
+ AND indication like '%ITP%'
1028
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1029
+ from ""symphony-data"".""test_performance_v3"") - interval '180' day)
1030
+ GROUP BY Patient_State
1031
+ )
1032
+ SELECT kyprolis_claims.Patient_State
1033
+ FROM kyprolis_claims, competitor_claims
1034
+ WHERE kyprolis_claims.num_claims > competitor_claims.num_claims;"
1035
+ 57,Generate an ANSI/PRESTO sql query for the question :What is the relative growth of Kyprolis in last 9 months compared to previous year?,"
1036
+ WITH
1037
+ numerator AS (
1038
+ 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)
1039
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month) and Drug_Name like '%KYPROLIS%'
1040
+ ),
1041
+ denominator AS(
1042
+ 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)
1043
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year - interval '9' month) and Prescription_Fill_Year_Month <= date((select max(Prescription_Fill_Year_Month)
1044
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year) and Drug_Name like '%KYPROLIS%'
1045
+ )
1046
+ SELECT (cast(numerator.total_claims as double) / (denominator.total_claims)-1)*100 as relative_growth from numerator, denominator;"
1047
+ 58,Generate an ANSI/PRESTO sql query for the question :How did Kyprolis prescriptions for ITP indication grow for 2022 vs 2021?,"
1048
+ WITH kyprolis_prescriptions_2021 AS (
1049
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
1050
+ FROM ""symphony-data"".""test_performance_v3""
1051
+ WHERE Drug_Name like '%KYPROLIS%'
1052
+ AND indication like '%ITP%'
1053
+ AND Prescription_Fill_Year_Month >= date('2021-01-01')
1054
+ AND Prescription_Fill_Year_Month <= date('2021-12-31')
1055
+ ),
1056
+ kyprolis_prescriptions_2022 AS (
1057
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
1058
+ FROM ""symphony-data"".""test_performance_v3""
1059
+ WHERE Drug_Name like '%KYPROLIS%'
1060
+ AND indication like '%ITP%'
1061
+ AND Prescription_Fill_Year_Month >= date('2022-01-01')
1062
+ AND Prescription_Fill_Year_Month <= date('2022-12-31')
1063
+ )
1064
+ SELECT (cast(kyprolis_prescriptions_2022.num_prescriptions as double) / (kyprolis_prescriptions_2021.num_prescriptions)-1)*100 as growth from kyprolis_prescriptions_2021, kyprolis_prescriptions_2022;"
1065
+ 59,Generate an ANSI/PRESTO sql query for the question :Calculate evolution index for Kyprolis for ITP indication for the last 5 months versus same time period last year,"
1066
+ WITH
1067
+ kyprolis_prescriptions_current AS (
1068
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
1069
+ FROM ""symphony-data"".""test_performance_v3""
1070
+ WHERE Drug_Name like '%KYPROLIS%'
1071
+ AND indication like '%ITP%'
1072
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1073
+ from ""symphony-data"".""test_performance_v3"") - interval '5' month)
1074
+ ),
1075
+ kyprolis_prescriptions_previous AS (
1076
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
1077
+ FROM ""symphony-data"".""test_performance_v3""
1078
+ WHERE Drug_Name like '%KYPROLIS%'
1079
+ AND indication like '%ITP%'
1080
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1081
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year - interval '5' month)
1082
+ AND Prescription_Fill_Year_Month <= date((select max(Prescription_Fill_Year_Month)
1083
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year)
1084
+ ),
1085
+ itp_prescriptions_current AS (
1086
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
1087
+ FROM ""symphony-data"".""test_performance_v3""
1088
+ WHERE indication like '%ITP%'
1089
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1090
+ from ""symphony-data"".""test_performance_v3"") - interval '5' month)
1091
+ ),
1092
+ itp_prescriptions_previous AS (
1093
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
1094
+ FROM ""symphony-data"".""test_performance_v3""
1095
+ WHERE indication like '%ITP%'
1096
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1097
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year - interval '5' month)
1098
+ AND Prescription_Fill_Year_Month <= date((select max(Prescription_Fill_Year_Month)
1099
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year)
1100
+ )
1101
+ SELECT (cast((kyprolis_prescriptions_current.num_prescriptions/kyprolis_prescriptions_previous.num_prescriptions)-1 as double) / (cast((itp_prescriptions_current.num_prescriptions/itp_prescriptions_previous.num_prescriptions)-1 as double))) as evolution_index
1102
+ FROM kyprolis_prescriptions_current, kyprolis_prescriptions_previous, itp_prescriptions_current, itp_prescriptions_previous;"
1103
+ 60,Generate an ANSI/PRESTO sql query for the question :In which state has Kyprolis presciption count grown the most over the last 5 months compared to the same time period last year?,"
1104
+ WITH
1105
+ kyprolis_prescriptions_current_year AS (
1106
+ SELECT Patient_State, COUNT(distinct(claim_ID)) AS num_prescriptions
1107
+ FROM ""symphony-data"".""test_performance_v3""
1108
+ WHERE Drug_Name like '%KYPROLIS%'
1109
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1110
+ from ""symphony-data"".""test_performance_v3"") - interval '5' month)
1111
+ GROUP BY Patient_State
1112
+ ),
1113
+ kyprolis_prescriptions_previous_year AS (
1114
+ SELECT Patient_State, COUNT(distinct(claim_ID)) AS num_prescriptions
1115
+ FROM ""symphony-data"".""test_performance_v3""
1116
+ WHERE Drug_Name like '%KYPROLIS%'
1117
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1118
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year - interval '5' month)
1119
+ AND Prescription_Fill_Year_Month <= date((select max(Prescription_Fill_Year_Month)
1120
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year)
1121
+ GROUP BY Patient_State
1122
+ )
1123
+ SELECT
1124
+ kyprolis_prescriptions_current_year.Patient_State,
1125
+ (cast(kyprolis_prescriptions_current_year.num_prescriptions as double) / (kyprolis_prescriptions_previous_year.num_prescriptions)-1)*100 as growth
1126
+ FROM kyprolis_prescriptions_current_year, kyprolis_prescriptions_previous_year
1127
+ WHERE kyprolis_prescriptions_current_year.Patient_State = kyprolis_prescriptions_previous_year.Patient_State
1128
+ ORDER BY growth DESC
1129
+ LIMIT 1;"
1130
+ 61,"Generate an ANSI/PRESTO sql query for the question :For patients over 60 prescribed drugs for ITP indication, what percentage of those prescriptions were for Kyprolis? ","
1131
+ WITH
1132
+ total_prescriptions AS (
1133
+ SELECT COUNT(distinct(claim_ID)) AS total_prescriptions
1134
+ FROM ""symphony-data"".""test_performance_v3""
1135
+ WHERE indication like '%ITP%'
1136
+ AND patient_age >= 60
1137
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1138
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
1139
+ ),
1140
+ kyprolis_prescriptions AS (
1141
+ SELECT COUNT(distinct(claim_ID)) AS kyprolis_prescriptions
1142
+ FROM ""symphony-data"".""test_performance_v3""
1143
+ WHERE Drug_Name like '%KYPROLIS%'
1144
+ AND indication like '%ITP%'
1145
+ AND patient_age >= 60
1146
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1147
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
1148
+ )
1149
+ SELECT ROUND(100.0 * kyprolis_prescriptions.kyprolis_prescriptions / total_prescriptions.total_prescriptions, 2) as kyprolis_percentage
1150
+ FROM total_prescriptions, kyprolis_prescriptions;"
1151
+ 62,Generate an ANSI/PRESTO sql query for the question :What is the market share of Kyprolis in ITP indication for patients above 60 years?,"
1152
+ WITH num AS (
1153
+ SELECT COUNT(DISTINCT(Claim_ID)) AS num_data
1154
+ FROM ""symphony-data"".""test_performance_v3""
1155
+ WHERE Drug_Name LIKE '%KYPROLIS%'
1156
+ AND indication LIKE '%ITP%'
1157
+ AND patient_age > 60
1158
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1159
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
1160
+ ),
1161
+ den AS (
1162
+ SELECT COUNT(DISTINCT(Claim_ID)) AS den_data
1163
+ FROM ""symphony-data"".""test_performance_v3""
1164
+ WHERE indication LIKE '%ITP%'
1165
+ AND patient_age > 60
1166
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1167
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
1168
+ )
1169
+ SELECT ROUND(100.0 * num_data / den_data, 2) AS market_share
1170
+ FROM num, den;"
1171
+ 63,Generate an ANSI/PRESTO sql query for the question :What is the market share of Kyprolis in ITP indication for female/male patients over the last 6 months?,"
1172
+ WITH num AS (
1173
+ SELECT COUNT(DISTINCT(Claim_ID)) AS num_data
1174
+ FROM ""symphony-data"".""test_performance_v3""
1175
+ WHERE Drug_Name LIKE '%KYPROLIS%'
1176
+ AND indication LIKE '%ITP%'
1177
+ AND Patient_Gender IN ('Male', 'Female')
1178
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1179
+ from ""symphony-data"".""test_performance_v3"") - interval '180' day)
1180
+ ),
1181
+ den AS (
1182
+ SELECT COUNT(DISTINCT(Claim_ID)) AS den_data
1183
+ FROM ""symphony-data"".""test_performance_v3""
1184
+ WHERE indication LIKE '%ITP%'
1185
+ AND Patient_Gender IN ('Male', 'Female')
1186
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1187
+ from ""symphony-data"".""test_performance_v3"") - interval '180' day)
1188
+ )
1189
+ SELECT ROUND(100.0 * num_data / den_data, 2) AS market_share
1190
+ FROM num, den;"
1191
+ 64,Generate an ANSI/PRESTO sql query for the question :Which drug had highest claims for patients above 60 in ITP indication over the last 1 year?,"
1192
+ WITH
1193
+ age_60_plus AS (
1194
+ SELECT COUNT(distinct(claim_ID)) as num_claims
1195
+ FROM ""symphony-data"".""test_performance_v3""
1196
+ WHERE patient_age >= 60
1197
+ AND indication like '%ITP%'
1198
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1199
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year)
1200
+ ),
1201
+ drug_claims AS (
1202
+ SELECT Drug_Name, COUNT(distinct(claim_ID)) as num_claims
1203
+ FROM ""symphony-data"".""test_performance_v3""
1204
+ WHERE patient_age >= 60
1205
+ AND indication like '%ITP%'
1206
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1207
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year)
1208
+ GROUP BY Drug_Name
1209
+ )
1210
+ SELECT Drug_Name, num_claims
1211
+ FROM drug_claims
1212
+ ORDER BY num_claims DESC
1213
+ LIMIT 1;"
1214
+ 65,Generate an ANSI/PRESTO sql query for the question :Which state in the US had the highest number of claims in the ITP indication for patients over the age of 60 over the last 6 months? Exclude None and blank values in state column,"
1215
+ SELECT Patient_State, COUNT(distinct(Claim_ID)) as num_claims
1216
+ FROM ""symphony-data"".""test_performance_v3""
1217
+ WHERE indication like '%ITP%'
1218
+ AND Patient_State NOT IN ('None', '')
1219
+ AND patient_age > 60
1220
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1221
+ from ""symphony-data"".""test_performance_v3"") - interval '6' month)
1222
+ GROUP BY Patient_State
1223
+ ORDER BY num_claims DESC
1224
+ LIMIT 1;"
1225
+ 66,Generate an ANSI/PRESTO sql query for the question :What is the most common payer type for Kyprolis in last 6 months?,"
1226
+ WITH kyprolis_prescriptions AS (
1227
+ SELECT plan_type_description, COUNT(distinct(claim_ID)) AS num_prescriptions
1228
+ FROM ""symphony-data"".""test_performance_v3""
1229
+ WHERE Drug_Name like '%KYPROLIS%'
1230
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1231
+ from ""symphony-data"".""test_performance_v3"") - interval '6' month)
1232
+ AND plan_type_description NOT IN ('NONE', '')
1233
+ GROUP BY plan_type_description
1234
+ )
1235
+ SELECT plan_type_description, num_prescriptions
1236
+ FROM kyprolis_prescriptions
1237
+ ORDER BY num_prescriptions DESC
1238
+ LIMIT 1;"
1239
+ 67,Generate an ANSI/PRESTO sql query for the question :What is the avg. out of pocket pay for Kyprolis in NY state in last 6 months?,"
1240
+ SELECT AVG(Total_Patient_Responsibility) as avg_patient_pay
1241
+ FROM ""symphony-data"".""test_performance_v3""
1242
+ WHERE Drug_Name like '%KYPROLIS%'
1243
+ AND Patient_State = 'NY'
1244
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1245
+ from ""symphony-data"".""test_performance_v3"") - interval '6' month);"
1246
+ 68,Generate an ANSI/PRESTO sql query for the question :Could you provide a ranking of all the brands in the ITP indication based on their share of commercial payers over the last 5 months?,"
1247
+ WITH
1248
+ commercial_payers AS (
1249
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
1250
+ FROM ""symphony-data"".""test_performance_v3""
1251
+ WHERE plan_type_description = 'COMMERCIAL'
1252
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1253
+ from ""symphony-data"".""test_performance_v3"") - interval '150' day)
1254
+ AND indication like '%ITP%'
1255
+ ),
1256
+ total_payers AS (
1257
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
1258
+ FROM ""symphony-data"".""test_performance_v3""
1259
+ WHERE Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1260
+ from ""symphony-data"".""test_performance_v3"") - interval '150' day)
1261
+ AND indication like '%ITP%'
1262
+ )
1263
+ SELECT Drug_Name, ROUND(100.0 * commercial_payers.num_prescriptions / total_payers.num_prescriptions, 2) as share_of_commercial_payers
1264
+ FROM ""symphony-data"".""test_performance_v3""
1265
+ INNER JOIN commercial_payers
1266
+ ON ""symphony-data"".""test_performance_v3"".indication = commercial_payers.indication
1267
+ INNER JOIN total_payers
1268
+ ON ""symphony-data"".""test_performance_v3"".indication = total_payers.indication
1269
+ WHERE Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1270
+ from ""symphony-data"".""test_performance_v3"") - interval '150' day)
1271
+ AND indication like '%ITP%'
1272
+ GROUP BY Drug_Name
1273
+ ORDER BY share_of_commercial_payers DESC;"
1274
+ 69,"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 ITP indication over the last 3 months, could you please give me the 4 drugs with lowest out-of-pocket expenses?","
1275
+ WITH avg_patient_pay AS (
1276
+ SELECT Drug_Name, AVG(Total_Patient_Responsibility) as avg_patient_pay
1277
+ FROM ""symphony-data"".""test_performance_v3""
1278
+ WHERE indication like '%ITP%'
1279
+ AND patient_age >= 60
1280
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1281
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
1282
+ GROUP BY Drug_Name
1283
+ )
1284
+ SELECT Drug_Name, avg_patient_pay
1285
+ FROM avg_patient_pay
1286
+ ORDER BY avg_patient_pay ASC
1287
+ LIMIT 4;"
1288
+ 70,Generate an ANSI/PRESTO sql query for the question: What is Kyprolis's claims volume in the last 12 months?,"
1289
+ SELECT COUNT(distinct(claim_ID)) AS num_claims
1290
+ FROM ""symphony-data"".""test_performance_v3""
1291
+ WHERE Drug_Name like '%KYPROLIS%'
1292
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1293
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year);"
1294
+ 71,Generate an ANSI/PRESTO sql query for the question: What is Kyprolis's claims volume in the last 12 months for cll_or_fl indication?,"
1295
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
1296
+ FROM ""symphony-data"".""test_performance_v3""
1297
+ WHERE Drug_Name like '%KYPROLIS%'
1298
+ AND indication like '%CLL_OR_FL%'
1299
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1300
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year);"
1301
+ 72,Generate an ANSI/PRESTO sql query for the question: Which brand had the highest claims in cll_or_fl indication in last 12 months?,"
1302
+ SELECT Drug_Name, COUNT(distinct(claim_ID)) as num_claims
1303
+ FROM ""symphony-data"".""test_performance_v3""
1304
+ WHERE indication like '%CLL_OR_FL%'
1305
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1306
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year)
1307
+ GROUP BY Drug_Name
1308
+ ORDER BY num_claims DESC
1309
+ LIMIT 1;"
1310
+ 73,Generate an ANSI/PRESTO sql query for the question: Which brand had the highest claims in NY state in cll_or_fl indication in last 12 months?,"
1311
+ SELECT Drug_Name, COUNT(distinct(claim_ID)) as num_claims
1312
+ FROM ""symphony-data"".""test_performance_v3""
1313
+ WHERE indication like '%CLL_OR_FL%'
1314
+ AND Patient_State = 'NY'
1315
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1316
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year)
1317
+ GROUP BY Drug_Name
1318
+ ORDER BY num_claims DESC
1319
+ LIMIT 1;"
1320
+ 74,Generate an ANSI/PRESTO sql query for the question: Identify the state where Kyprolis had the most prescriptions for cll_or_fl indications? Ignore blanks for state,"
1321
+ SELECT Patient_State, COUNT(distinct(Claim_ID)) as num_prescriptions
1322
+ FROM ""symphony-data"".""test_performance_v3""
1323
+ WHERE Drug_Name like '%KYPROLIS%'
1324
+ AND indication like '%CLL_OR_FL%'
1325
+ AND Patient_State NOT LIKE 'None'
1326
+ AND Patient_State NOT LIKE ''
1327
+ GROUP BY Patient_State
1328
+ ORDER BY num_prescriptions DESC
1329
+ LIMIT 1;"
1330
+ 75,Generate an ANSI/PRESTO sql query for the question: What was the market share of the top 8 drugs prescribed for cll_or_fl indication over the last 12 months?,"
1331
+ WITH top_8_drugs AS (
1332
+ SELECT Drug_Name, COUNT(distinct(claim_ID)) as num_prescriptions
1333
+ FROM ""symphony-data"".""test_performance_v3""
1334
+ WHERE indication like '%CLL_OR_FL%'
1335
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1336
+ from ""symphony-data"".""test_performance_v3"") - interval '12' month)
1337
+ GROUP BY Drug_Name
1338
+ ORDER BY num_prescriptions DESC
1339
+ LIMIT 8
1340
+ ),
1341
+ total_prescriptions AS (
1342
+ SELECT COUNT(distinct(claim_ID)) as total_prescriptions
1343
+ FROM ""symphony-data"".""test_performance_v3""
1344
+ WHERE indication like '%CLL_OR_FL%'
1345
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1346
+ from ""symphony-data"".""test_performance_v3"") - interval '12' month)
1347
+ )
1348
+ SELECT Drug_Name, ROUND(100.0 * num_prescriptions / total_prescriptions, 2) as market_share
1349
+ FROM top_8_drugs, total_prescriptions;"
1350
+ 76,Generate an ANSI/PRESTO sql query for the question: Give me the market share by drug for the top 5 drugs for cll_or_fl indication over the last 12 months,"
1351
+ WITH top_5_drugs AS (
1352
+ SELECT Drug_Name, count(distinct(claim_ID)) as num_prescriptions
1353
+ FROM ""symphony-data"".""test_performance_v3""
1354
+ WHERE indication like '%CLL_OR_FL%'
1355
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1356
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year)
1357
+ GROUP BY Drug_Name
1358
+ order by num_prescriptions desc
1359
+ limit 5
1360
+ ),
1361
+ total_prescriptions AS (
1362
+ SELECT COUNT(distinct(claim_ID)) as total_prescriptions
1363
+ FROM ""symphony-data"".""test_performance_v3""
1364
+ WHERE indication like '%CLL_OR_FL%'
1365
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1366
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year)
1367
+ )
1368
+ SELECT
1369
+ top_5_drugs.Drug_Name,
1370
+ ROUND(100.0 * top_5_drugs.num_prescriptions / total_prescriptions.total_prescriptions, 2) as market_share
1371
+ FROM top_5_drugs, total_prescriptions;"
1372
+ 77,Generate an ANSI/PRESTO sql query for the question: What was the market share for Kyprolis for years 2019 and 2020 for cll_or_fl indication?,"
1373
+ WITH
1374
+ kyprolis_2019 AS (
1375
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
1376
+ FROM ""symphony-data"".""test_performance_v3""
1377
+ WHERE Drug_Name like '%KYPROLIS%'
1378
+ AND Prescription_Fill_Year_Month >= date('2019-01-01')
1379
+ AND Prescription_Fill_Year_Month <= date('2019-12-31')
1380
+ AND indication like '%CLL_OR_FL%'
1381
+ ),
1382
+ kyprolis_2020 AS (
1383
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
1384
+ FROM ""symphony-data"".""test_performance_v3""
1385
+ WHERE Drug_Name like '%KYPROLIS%'
1386
+ AND Prescription_Fill_Year_Month >= date('2020-01-01')
1387
+ AND Prescription_Fill_Year_Month <= date('2020-12-31')
1388
+ AND indication like '%CLL_OR_FL%'
1389
+ ),
1390
+ total_2019 AS (
1391
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
1392
+ FROM ""symphony-data"".""test_performance_v3""
1393
+ WHERE Prescription_Fill_Year_Month >= date('2019-01-01')
1394
+ AND Prescription_Fill_Year_Month <= date('2019-12-31')
1395
+ AND indication like '%CLL_OR_FL%'
1396
+ ),
1397
+ total_2020 AS (
1398
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
1399
+ FROM ""symphony-data"".""test_performance_v3""
1400
+ WHERE Prescription_Fill_Year_Month >= date('2020-01-01')
1401
+ AND Prescription_Fill_Year_Month <= date('2020-12-31')
1402
+ AND indication like '%CLL_OR_FL%'
1403
+ )
1404
+ SELECT
1405
+ ROUND(100.0 * kyprolis_2019.num_prescriptions / total_2019.num_prescriptions, 2) AS kyprolis_2019_market_share,
1406
+ ROUND(100.0 * kyprolis_2020.num_prescriptions / total_2020.num_prescriptions, 2) AS kyprolis_2020_market_share
1407
+ FROM kyprolis_2019, kyprolis_2020, total_2019, total_2020;"
1408
+ 78,Generate an ANSI/PRESTO sql query for the question: What's the most prescribed brand for cll_or_fl indication? What is it's market share?,"
1409
+ WITH num AS (
1410
+ SELECT COUNT(DISTINCT(Claim_ID)) AS num_data
1411
+ FROM ""symphony-data"".""test_performance_v3""
1412
+ WHERE indication LIKE '%CLL_OR_FL%'
1413
+ AND Drug_Name NOT LIKE '%NONE%'
1414
+ AND Drug_Name NOT LIKE '%BLANK%'
1415
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1416
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
1417
+ ),
1418
+ den AS (
1419
+ SELECT COUNT(DISTINCT(Claim_ID)) AS den_data
1420
+ FROM ""symphony-data"".""test_performance_v3""
1421
+ WHERE indication LIKE '%CLL_OR_FL%'
1422
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1423
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
1424
+ ),
1425
+ brand_data AS (
1426
+ SELECT Drug_Name, COUNT(DISTINCT(Claim_ID)) AS brand_data
1427
+ FROM ""symphony-data"".""test_performance_v3""
1428
+ WHERE indication LIKE '%CLL_OR_FL%'
1429
+ AND Drug_Name NOT LIKE '%NONE%'
1430
+ AND Drug_Name NOT LIKE '%BLANK%'
1431
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1432
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
1433
+ GROUP BY Drug_Name
1434
+ ORDER BY brand_data DESC
1435
+ LIMIT 1
1436
+ )
1437
+ SELECT brand_data.Drug_Name AS most_prescribed_brand, ROUND(100.0 * num_data / den_data, 2) AS market_share
1438
+ FROM num, den, brand_data;"
1439
+ 79,"Generate an ANSI/PRESTO sql query for the question: Over the past 9 months, which state in the US has seen a higher number of claims for Kyprolis in the cll_or_fl indication compared to its competitors?","
1440
+ WITH kyprolis_prescriptions AS (
1441
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions, Patient_State
1442
+ FROM ""symphony-data"".""test_performance_v3""
1443
+ WHERE Drug_Name like '%KYPROLIS%'
1444
+ AND indication like '%CLL_OR_FL%'
1445
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1446
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month)
1447
+ GROUP BY Patient_State
1448
+ ),
1449
+ competitor_prescriptions AS (
1450
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions, Patient_State
1451
+ FROM ""symphony-data"".""test_performance_v3""
1452
+ WHERE Drug_Name not like '%KYPROLIS%'
1453
+ AND indication like '%CLL_OR_FL%'
1454
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1455
+ from ""symphony-data"".""test_performance_v3"") - interval '9' month)
1456
+ GROUP BY Patient_State
1457
+ )
1458
+ SELECT kyprolis_prescriptions.Patient_State
1459
+ FROM kyprolis_prescriptions, competitor_prescriptions
1460
+ WHERE kyprolis_prescriptions.num_prescriptions > competitor_prescriptions.num_prescriptions;"
1461
+ 80,Generate an ANSI/PRESTO sql query for the question: What is the relative growth of Kyprolis in last 12 months compared to previous year?,"
1462
+ WITH
1463
+ numerator AS (
1464
+ 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)
1465
+ from ""symphony-data"".""test_performance_v3"") - interval '12' month) and Drug_Name like '%KYPROLIS%'
1466
+ ),
1467
+ denominator AS(
1468
+ 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)
1469
+ from ""symphony-data"".""test_performance_v3"") - interval '2' year - interval '12' month) and Prescription_Fill_Year_Month <= date((select max(Prescription_Fill_Year_Month)
1470
+ from ""symphony-data"".""test_performance_v3"") - interval '2' year) and Drug_Name like '%KYPROLIS%'
1471
+ )
1472
+ SELECT (cast(numerator.total_claims as double) / (denominator.total_claims)-1)*100 as relative_growth from numerator, denominator;"
1473
+ 81,Generate an ANSI/PRESTO sql query for the question: How did Kyprolis prescriptions for cll_or_fl indication grow for 2020 vs 2019?,"
1474
+ WITH
1475
+ kyprolis_prescriptions_2020 AS (
1476
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
1477
+ FROM ""symphony-data"".""test_performance_v3""
1478
+ WHERE Drug_Name like '%KYPROLIS%'
1479
+ AND indication like '%CLL_OR_FL%'
1480
+ AND Prescription_Fill_Year_Month >= date('2020-01-01')
1481
+ AND Prescription_Fill_Year_Month <= date('2020-12-31')
1482
+ ),
1483
+ kyprolis_prescriptions_2019 AS (
1484
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
1485
+ FROM ""symphony-data"".""test_performance_v3""
1486
+ WHERE Drug_Name like '%KYPROLIS%'
1487
+ AND indication like '%CLL_OR_FL%'
1488
+ AND Prescription_Fill_Year_Month >= date('2019-01-01')
1489
+ AND Prescription_Fill_Year_Month <= date('2019-12-31')
1490
+ )
1491
+ SELECT (cast(kyprolis_prescriptions_2020.num_prescriptions as double) / (kyprolis_prescriptions_2019.num_prescriptions)-1)*100 as growth from kyprolis_prescriptions_2020, kyprolis_prescriptions_2019;"
1492
+ 82,Generate an ANSI/PRESTO sql query for the question: Calculate evolution index for Kyprolis for cll_or_fl indication for the last 8 months versus same time period last year,"
1493
+ WITH
1494
+ kyprolis_prescriptions_current AS (
1495
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
1496
+ FROM ""symphony-data"".""test_performance_v3""
1497
+ WHERE Drug_Name like '%KYPROLIS%'
1498
+ AND indication like '%CLL_OR_FL%'
1499
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1500
+ from ""symphony-data"".""test_performance_v3"") - interval '8' month)
1501
+ ),
1502
+ kyprolis_prescriptions_previous AS (
1503
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
1504
+ FROM ""symphony-data"".""test_performance_v3""
1505
+ WHERE Drug_Name like '%KYPROLIS%'
1506
+ AND indication like '%CLL_OR_FL%'
1507
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1508
+ from ""symphony-data"".""test_performance_v3"") - interval '16' month)
1509
+ AND Prescription_Fill_Year_Month <= date((select max(Prescription_Fill_Year_Month)
1510
+ from ""symphony-data"".""test_performance_v3"") - interval '8' month)
1511
+ ),
1512
+ overall_indication_prescriptions_current AS (
1513
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
1514
+ FROM ""symphony-data"".""test_performance_v3""
1515
+ WHERE indication like '%CLL_OR_FL%'
1516
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1517
+ from ""symphony-data"".""test_performance_v3"") - interval '8' month)
1518
+ ),
1519
+ overall_indication_prescriptions_previous AS (
1520
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
1521
+ FROM ""symphony-data"".""test_performance_v3""
1522
+ WHERE indication like '%CLL_OR_FL%'
1523
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1524
+ from ""symphony-data"".""test_performance_v3"") - interval '16' month)
1525
+ AND Prescription_Fill_Year_Month <= date((select max(Prescription_Fill_Year_Month)
1526
+ from ""symphony-data"".""test_performance_v3"") - interval '8' month)
1527
+ )
1528
+ SELECT (cast((kyprolis_prescriptions_current.num_prescriptions/kyprolis_prescriptions_previous.num_prescriptions)-1 as double) / (cast((overall_indication_prescriptions_current.num_prescriptions/overall_indication_prescriptions_previous.num_prescriptions)-1 as double))) as evolution_index
1529
+ FROM kyprolis_prescriptions_current, kyprolis_prescriptions_previous, overall_indication_prescriptions_current, overall_indication_prescriptions_previous;"
1530
+ 83,Generate an ANSI/PRESTO sql query for the question: In which state has Kyprolis presciption count grown the most over the last 10 months compared to the same time period last year?,"
1531
+ WITH
1532
+ kyprolis_prescriptions_current_year AS (
1533
+ SELECT Patient_State, COUNT(distinct(claim_ID)) AS num_prescriptions
1534
+ FROM ""symphony-data"".""test_performance_v3""
1535
+ WHERE Drug_Name like '%KYPROLIS%'
1536
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1537
+ from ""symphony-data"".""test_performance_v3"") - interval '10' month)
1538
+ GROUP BY Patient_State
1539
+ ),
1540
+ kyprolis_prescriptions_previous_year AS (
1541
+ SELECT Patient_State, COUNT(distinct(claim_ID)) AS num_prescriptions
1542
+ FROM ""symphony-data"".""test_performance_v3""
1543
+ WHERE Drug_Name like '%KYPROLIS%'
1544
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1545
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year - interval '10' month)
1546
+ AND Prescription_Fill_Year_Month <= date((select max(Prescription_Fill_Year_Month)
1547
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year)
1548
+ GROUP BY Patient_State
1549
+ )
1550
+ SELECT
1551
+ kyprolis_prescriptions_current_year.Patient_State,
1552
+ (cast(kyprolis_prescriptions_current_year.num_prescriptions as double) / (kyprolis_prescriptions_previous_year.num_prescriptions)-1)*100 as growth
1553
+ FROM kyprolis_prescriptions_current_year, kyprolis_prescriptions_previous_year
1554
+ WHERE kyprolis_prescriptions_current_year.Patient_State = kyprolis_prescriptions_previous_year.Patient_State
1555
+ ORDER BY growth DESC
1556
+ LIMIT 1;"
1557
+ 84,"Generate an ANSI/PRESTO sql query for the question: For patients over 60 prescribed drugs for cll_or_fl indication, what percentage of those prescriptions were for Kyprolis? ","
1558
+ WITH
1559
+ total_prescriptions AS (
1560
+ SELECT COUNT(distinct(claim_ID)) AS total_prescriptions
1561
+ FROM ""symphony-data"".""test_performance_v3""
1562
+ WHERE indication like '%CLL_OR_FL%'
1563
+ AND patient_age >= 60
1564
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1565
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
1566
+ ),
1567
+ kyprolis_prescriptions AS (
1568
+ SELECT COUNT(distinct(claim_ID)) AS kyprolis_prescriptions
1569
+ FROM ""symphony-data"".""test_performance_v3""
1570
+ WHERE Drug_Name like '%KYPROLIS%'
1571
+ AND indication like '%CLL_OR_FL%'
1572
+ AND patient_age >= 60
1573
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1574
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
1575
+ )
1576
+ SELECT ROUND(100.0 * kyprolis_prescriptions.kyprolis_prescriptions / total_prescriptions.total_prescriptions, 2) as kyprolis_percentage
1577
+ FROM total_prescriptions, kyprolis_prescriptions;"
1578
+ 85,Generate an ANSI/PRESTO sql query for the question: What is the market share of Kyprolis in cll_or_fl indication for patients above 60 years?,"
1579
+ WITH num AS (
1580
+ SELECT COUNT(DISTINCT(Claim_ID)) AS num_data
1581
+ FROM ""symphony-data"".""test_performance_v3""
1582
+ WHERE Drug_Name LIKE '%KYPROLIS%'
1583
+ AND indication LIKE '%CLL_OR_FL%'
1584
+ AND patient_age >= 60
1585
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1586
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
1587
+ ),
1588
+ den AS (
1589
+ SELECT COUNT(DISTINCT(Claim_ID)) AS den_data
1590
+ FROM ""symphony-data"".""test_performance_v3""
1591
+ WHERE indication LIKE '%CLL_OR_FL%'
1592
+ AND patient_age >= 60
1593
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1594
+ from ""symphony-data"".""test_performance_v3"") - interval '90' day)
1595
+ )
1596
+ SELECT ROUND(100.0 * num_data / den_data, 2) AS market_share
1597
+ FROM num, den;"
1598
+ 86,Generate an ANSI/PRESTO sql query for the question: What is the market share of Kyprolis in cll_or_fl indication for female/male patients over the last 12 months?,"
1599
+ WITH
1600
+ kyprolis_prescriptions AS (
1601
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
1602
+ FROM ""symphony-data"".""test_performance_v3""
1603
+ WHERE Drug_Name like '%KYPROLIS%'
1604
+ AND indication like '%CLL_OR_FL%'
1605
+ AND Patient_Gender IN ('Male', 'Female')
1606
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1607
+ from ""symphony-data"".""test_performance_v3"") - interval '12' month)
1608
+ ),
1609
+ total_prescriptions AS (
1610
+ SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
1611
+ FROM ""symphony-data"".""test_performance_v3""
1612
+ WHERE indication like '%CLL_OR_FL%'
1613
+ AND Patient_Gender IN ('Male', 'Female')
1614
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1615
+ from ""symphony-data"".""test_performance_v3"") - interval '12' month)
1616
+ )
1617
+ SELECT ROUND(100.0 * kyprolis_prescriptions.num_prescriptions / total_prescriptions.num_prescriptions, 2) as market_share from kyprolis_prescriptions, total_prescriptions;"
1618
+ 87,Generate an ANSI/PRESTO sql query for the question: Which drug had highest claims for patients above 60 in cll_or_fl indication over the last 2 year?,"
1619
+ WITH cll_or_fl_claims AS (
1620
+ SELECT Drug_Name, COUNT(distinct(claim_ID)) AS num_claims
1621
+ FROM ""symphony-data"".""test_performance_v3""
1622
+ WHERE indication like '%CLL_OR_FL%'
1623
+ AND patient_age >= 60
1624
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1625
+ from ""symphony-data"".""test_performance_v3"") - interval '2' year)
1626
+ GROUP BY Drug_Name
1627
+ )
1628
+ SELECT Drug_Name, num_claims
1629
+ FROM cll_or_fl_claims
1630
+ ORDER BY num_claims DESC
1631
+ LIMIT 1;"
1632
+ 88,Generate an ANSI/PRESTO sql query for the question: Which state in the US had the highest number of claims in the cll_or_fl indication for patients over the age of 60 over the last 12 months? Exclude None and blank values in state column,"
1633
+ SELECT Patient_State, COUNT(distinct(Claim_ID)) as num_claims
1634
+ FROM ""symphony-data"".""test_performance_v3""
1635
+ WHERE indication like '%cll_or_fl%'
1636
+ AND patient_age > 60
1637
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1638
+ from ""symphony-data"".""test_performance_v3"") - interval '1' year)
1639
+ AND Patient_State NOT IN ('None', '')
1640
+ GROUP BY Patient_State
1641
+ ORDER BY num_claims DESC
1642
+ LIMIT 1;"
1643
+ 89,Generate an ANSI/PRESTO sql query for the question: What is the most common payer type for Kyprolis in last 10 months?,"
1644
+ SELECT plan_type_description, COUNT(distinct(claim_ID)) as num_prescriptions
1645
+ FROM ""symphony-data"".""test_performance_v3""
1646
+ WHERE Drug_Name like '%KYPROLIS%'
1647
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1648
+ from ""symphony-data"".""test_performance_v3"") - interval '10' month)
1649
+ AND plan_type_description NOT IN ('NONE', '')
1650
+ GROUP BY plan_type_description
1651
+ ORDER BY num_prescriptions DESC
1652
+ LIMIT 1;"
1653
+ 90,Generate an ANSI/PRESTO sql query for the question: What is the avg. out of pocket pay for Kyprolis in NY state in last 10 months?,"
1654
+ SELECT AVG(Total_Patient_Responsibility) as avg_patient_pay
1655
+ FROM ""symphony-data"".""test_performance_v3""
1656
+ WHERE Drug_Name like '%KYPROLIS%'
1657
+ AND Patient_State = 'NY'
1658
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1659
+ from ""symphony-data"".""test_performance_v3"") - interval '10' month);"
1660
+ 91,Generate an ANSI/PRESTO sql query for the question: Could you provide a ranking of all the brands in the cll_or_fl indication based on their share of commercial payers over the last 10 months?,"
1661
+ WITH commercial_payers AS (
1662
+ SELECT Drug_Name, COUNT(distinct(claim_ID)) as num_prescriptions
1663
+ FROM ""symphony-data"".""test_performance_v3""
1664
+ WHERE plan_type_description = 'COMMERCIAL'
1665
+ AND indication like '%cll_or_fl%'
1666
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1667
+ from ""symphony-data"".""test_performance_v3"") - interval '10' month)
1668
+ GROUP BY Drug_Name
1669
+ ),
1670
+ total_payers AS (
1671
+ SELECT COUNT(distinct(claim_ID)) as total_prescriptions
1672
+ FROM ""symphony-data"".""test_performance_v3""
1673
+ WHERE indication like '%cll_or_fl%'
1674
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1675
+ from ""symphony-data"".""test_performance_v3"") - interval '10' month)
1676
+ )
1677
+ SELECT Drug_Name, ROUND(100.0 * num_prescriptions / total_prescriptions, 2) as share_of_commercial_payers
1678
+ FROM commercial_payers, total_payers
1679
+ ORDER BY share_of_commercial_payers DESC;"
1680
+ 92,"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 cll_or_fl indication over the last 5 months, could you please give me the 8 drugs with lowest out-of-pocket expenses?","
1681
+ WITH avg_patient_pay AS (
1682
+ SELECT Drug_Name, AVG(Total_Patient_Responsibility) as avg_patient_pay
1683
+ FROM ""symphony-data"".""test_performance_v3""
1684
+ WHERE indication like '%cll_or_fl%'
1685
+ AND patient_age >= 60
1686
+ AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
1687
+ from ""symphony-data"".""test_performance_v3"") - interval '5' month)
1688
+ GROUP BY Drug_Name
1689
+ )
1690
+ SELECT Drug_Name, avg_patient_pay
1691
+ FROM avg_patient_pay
1692
+ ORDER BY avg_patient_pay ASC
1693
+ LIMIT 8;"