Showing 20 of 78 results
Filtered
Show unique queries only
Filter Unique Queries
When enabled, only the latest unique queries based on text content are displayed
Query ID | Neuron ID | SQL Query | Author | Run Count | Run Date |
|---|---|---|---|---|---|
| 6-1 | AST_198 | SELECT sdc.patient_id, sdc.study_drug, sdc.claim_date AS fill_date, sdc.days_supply, LEAD(sdc.claim_date) OVER (PARTITION BY sdc.patient_id, sdc.study_drug ORDER BY sdc.claim_date) AS next_fill_date FROM study_drug_pharm_claims AS sdc JOIN t2d_cvd_clean AS base ON sdc.patient_id = base.patient_id WHERE sdc.claim_date >= base.index_date AND sdc.claim_date <= '2025-12-31' | Omnya El Massad | 24 | N/A |
| 8-1 | AST_50 | SELECT c.patient_id, MIN(c.admission_date) AS first_hf_admit FROM inpatient_claims AS c JOIN t2d_cvd_clean AS base ON c.patient_id = base.patient_id WHERE c.dx_code LIKE 'I50%' AND c.admission_date >= base.index_date AND c.admission_date <= '2025-12-31' GROUP BY c.patient_id | Omnya El Massad | 24 | N/A |
| 9-1 | AST_141 | SELECT mc.patient_id, SUM(mc.allowed_amount) AS total_medical_cost FROM medical_claims AS mc JOIN t2d_cvd_clean AS base ON mc.patient_id = base.patient_id WHERE mc.service_date >= base.index_date AND mc.service_date <= '2025-12-31' GROUP BY mc.patient_id | Omnya El Massad | 24 | N/A |
| 10-1 | AST_163 | SELECT pc.patient_id, SUM(pc.cost) AS total_pharmacy_cost FROM pharmacy_claims AS pc JOIN t2d_cvd_clean AS base ON pc.patient_id = base.patient_id WHERE pc.claim_date >= base.index_date AND pc.claim_date <= '2025-12-31' GROUP BY pc.patient_id | Omnya El Massad | 24 | N/A |
| 12-1 | AST_53 | SELECT c.patient_id, MIN(d.claim_date) AS first_fill_date, d.study_drug AS index_drug FROM t2d_cvd_clean AS c JOIN study_drug_pharm_claims AS d ON c.patient_id = d.patient_id WHERE d.claim_date = c.index_date GROUP BY c.patient_id, d.study_drug | Omnya El Massad | 24 | N/A |
| 15-2 | AST_44 | SELECT bl.patient_id, bl.index_drug, bl.first_fill_date, tcc.dob, tcc.coverage_type, tcc.index_date FROM baseline_regimen AS bl JOIN t2d_cvd_clean AS tcc ON bl.patient_id = tcc.patient_id | Omnya El Massad | 24 | N/A |
| 18-2 | AST_143 | SELECT mp.*, ROW_NUMBER() OVER (PARTITION BY tirz_pt ORDER BY ps_diff) AS rank_within_tirz FROM matched_pairs AS mp | Omnya El Massad | 24 | N/A |
| 20-1 | AST_159 | SELECT patient_id, service_date FROM inpatient_claims WHERE service_date < (SELECT MIN(index_date) FROM t2d_cvd_clean WHERE patient_id = inpatient_claims.patient_id) | Omnya El Massad | 24 | N/A |
| 21-1 | AST_157 | SELECT patient_id, SUM(gap_days) AS total_gaps FROM (SELECT mp.patient_id, CASE WHEN DATEDIFF(next_fill_date, fill_date) - days_supply > 45 THEN 1 ELSE 0 END AS gap_days FROM medication_persistence AS mp) AS sub GROUP BY patient_id HAVING SUM(gap_days) > 0 | Omnya El Massad | 24 | N/A |
| 21-2 | AST_144 | SELECT mp.patient_id, CASE WHEN DATEDIFF(next_fill_date, fill_date) - days_supply > 45 THEN 1 ELSE 0 END AS gap_days FROM medication_persistence AS mp | Omnya El Massad | 24 | N/A |
| 22-1 | AST_160 | SELECT patient_id, total_cost_post_index FROM total_costs WHERE total_cost_post_index > 1000000 | Omnya El Massad | 24 | N/A |
| 28-1 | AST_170 | SELECT person_id, MIN(index_date) AS index_date, MIN(therapy_class) AS therapy_class FROM TEMP_COHORT_BASE GROUP BY person_id | Omnya El Massad | 24 | N/A |
| 31-1 | AST_76 | SELECT c.person_id, v.visit_start_date, v.visit_concept_id, CASE WHEN v.visit_concept_id = 9201 THEN 'INPATIENT' WHEN v.visit_concept_id = 9203 THEN 'ED' ELSE 'OTHER' END AS visit_type FROM VISIT_OCCURRENCE AS v JOIN TEMP_COHORT_DEDUP AS c ON v.person_id = c.person_id WHERE v.visit_start_date >= c.index_date AND v.visit_start_date <= DATEADD(DAY, 365, c.index_date) | Omnya El Massad | 24 | N/A |
| 33-1 | AST_74 | SELECT c.person_id, SUM(cost.total_charge) AS total_12mo_charge FROM TEMP_COHORT_DEDUP AS c JOIN COST AS cost ON c.person_id = cost.person_id WHERE cost.cost_event_date >= c.index_date AND cost.cost_event_date <= DATEADD(DAY, 365, c.index_date) GROUP BY c.person_id | Omnya El Massad | 24 | N/A |
| 34-1 | AST_75 | SELECT c.person_id, c.index_date, c.therapy_class AS index_therapy_class, CASE WHEN NOT d.discontinuation_date IS NULL AND d.discontinuation_date <= DATEADD(DAY, 365, c.index_date) THEN DATEDIFF(DAY, c.index_date) ELSE NULL END AS time_to_discontinuation, CASE WHEN NOT s.switch_date IS NULL THEN DATEDIFF(DAY, c.index_date) ELSE NULL END AS time_to_switch, s.switched_to, (SELECT COUNT(*) FROM TEMP_VISITS AS v WHERE v.person_id = c.person_id AND v.visit_type = 'INPATIENT') AS hosp_count, (SELECT COUNT(*) FROM TEMP_VISITS AS v WHERE v.person_id = c.person_id AND v.visit_type = 'ED') AS ed_count, CASE WHEN NOT i.infection_date IS NULL THEN 1 ELSE 0 END AS infection_flag, COALESCE(t.total_12mo_charge, 0) AS total_12mo_charge FROM TEMP_COHORT_DEDUP AS c LEFT JOIN TEMP_DISCONTINUATION AS d ON c.person_id = d.person_id LEFT JOIN TEMP_SWITCHES AS s ON c.person_id = s.person_id LEFT JOIN TEMP_INFECTIONS AS i ON c.person_id = i.person_id LEFT JOIN TEMP_TOTAL_COSTS AS t ON c.person_id = t.person_id | Omnya El Massad | 24 | N/A |
| 40-1 | AST_146 | SELECT n.patient_id, MIN(tx.fill_date) AS index_date, (CASE WHEN MIN(tx.therapy_class) = 'KRAS_G12C' THEN 'KRAS_G12C' WHEN MIN(tx.therapy_class) = 'EGFR_INHIB' THEN 'EGFR_INHIB' WHEN MIN(tx.therapy_class) = 'OTHER_TARGETED' THEN 'OTHER_TARGETED' ELSE 'UNKNOWN' END) AS index_therapy_class FROM TEMP_NSCLC_BASE AS n JOIN TEMP_TARGETED_RX AS tx ON n.patient_id = tx.patient_id GROUP BY n.patient_id | Omnya El Massad | 24 | N/A |
| 42-2 | AST_193 | SELECT rx.patient_id, rx.fill_date, rx.ndc, rx.days_supply, LEAD(rx.fill_date) OVER (PARTITION BY rx.patient_id ORDER BY rx.fill_date) AS next_fill_date FROM pharmacy_claims AS rx JOIN TEMP_COHORT_CLEAN AS c ON rx.patient_id = c.patient_id WHERE rx.fill_date >= c.index_date AND rx.fill_date <= DATEADD(DAY, 365, c.index_date) | Omnya El Massad | 24 | N/A |
| 49-1 | AST_116 | SELECT index_therapy_class, COUNT(*) AS n_patients, AVG(age_at_index) AS avg_age, STDDEV(age_at_index) AS std_age, 100.0 * SUM(CASE WHEN sex = 'F' THEN 1 ELSE 0 END) / COUNT(*) AS pct_female, 100.0 * SUM(CASE WHEN sex = 'M' THEN 1 ELSE 0 END) / COUNT(*) AS pct_male, 100.0 * SUM(CASE WHEN plan_type = 'COMMERCIAL' THEN 1 ELSE 0 END) / COUNT(*) AS pct_commercial, 100.0 * SUM(CASE WHEN plan_type = 'MEDICARE' THEN 1 ELSE 0 END) / COUNT(*) AS pct_medicare FROM FINAL_NSCLC_STUDY GROUP BY index_therapy_class | Omnya El Massad | 24 | N/A |
| 50-1 | AST_16 | SELECT CONCAT(YEAR(index_date), '-Q', CASE WHEN MONTH(index_date) BETWEEN 1 AND 3 THEN 1 WHEN MONTH(index_date) BETWEEN 4 AND 6 THEN 2 WHEN MONTH(index_date) BETWEEN 7 AND 9 THEN 3 ELSE 4 END) AS index_quarter, index_therapy_class, COUNT(*) AS initiators FROM FINAL_NSCLC_STUDY GROUP BY CONCAT(YEAR(index_date), '-Q', CASE WHEN MONTH(index_date) BETWEEN 1 AND 3 THEN 1 WHEN MONTH(index_date) BETWEEN 4 AND 6 THEN 2 WHEN MONTH(index_date) BETWEEN 7 AND 9 THEN 3 ELSE 4 END), index_therapy_class ORDER BY 1, 2 | Omnya El Massad | 24 | N/A |
| 51-1 | AST_118 | SELECT index_therapy_class, COUNT(*) AS total_patients, COUNT(ttd_days) AS discontinue_events, AVG(ttd_days) AS avg_ttd_days FROM FINAL_NSCLC_STUDY GROUP BY index_therapy_class | Omnya El Massad | 24 | N/A |
Page 1 of 4
