WITH parms as (
select cid::integer as cid from unnest(regexp_split_to_array( nullif($1::text, '')::text, '\s*,\s*')) as cid)
SELECT avg(t.cost_per_pill)::numeric avg_val_num, max(t.cost_per_pill)::numeric max_val_num, min(t.cost_per_pill)::numeric min_val_num, t.drug_concept_id
from (
select c.total_paid/d.quantity as cost_per_pill, d.drug_concept_id
FROM @cdm.cost c
JOIN @cdm.drug_exposure d
ON d.drug_exposure_id = c.cost_event_id
WHERE d.quantity > 0
AND d.drug_concept_id
IN (select cid from parms) ) t
GROUP BY t.drug_concept_id
ORDER BY t.drug_concept_id;
| Parameter | Example | Mandatory | Notes | | --- | --- | --- | --- | | list of drug_concept_id | 906805, 1517070, 19010522 | Yes |
| Field | Description | | --- | --- | | drug_concept_id | Drug concept id | | avg_val_num | Average cost per pill | | max_val_num | Max cost per pill | | min_val_num | Min cost per pill |
| Field | Description | | --- | --- | | drug_concept_id | 19010522 | | avg_val_num | 2.6983903185925794872997154 | | max_val_num | 3197.50 | | min_val_num | 0 |
https://github.com/OHDSI/CommonDataModel/wiki/
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.