HCLS/ClinicalObservationsInteroperability/SPARQL8.html

From W3C Wiki
Clinical Protocol Criteria SDTM based SPARQL Expression
Start of the SPARQL query - setting up the appropriate patient variables SELECT ?patient
WHERE {
?patient rdf:type sdtm:Patient .
?x sdtm:subject ?patient .
monotherapy with metformin, insulin secretagogue, or alpha-glucosidase inhibitors, or a low-dose combination of these at ≤ 50% maximal dose
Dosing is stable for 8 weeks
| ?doseX1/?maxDose > 0.5)
}
FILTER (?doseX1/?maxDose < 0.5 && !BOUND(?x2))
UNION
/* similar expression for InsulinSecretagogue */
UNION
/* Similar expression for AlphaGlucosidaseInhibitors */
FPG ≤ 225 mg/dL and HbA1c > 7% and ≤ 9.5% ?result1 rdf:type sdtm:FPG .
?result1 sdtm:hasValue ?value1 .
?result1 sdtm:hasUnit sdtm:mgdL .
?result2 rdf:type sdtm:HbA1c .
?result2 sdtm:hasValue ?value2 .
?result2 sdtm:hasUnit sdtm:percentage
FILTER ( ?value1 <= 225 && ?value2 > 7 && ?value2 <= 9.5 )
Age ≥ 18 and < 75 ?patient sdtm:hasAge ?age .
FILTER ( ?age >= 18 && ?age < 75 )
History of long-term therapy with insulin (> 30 days) within the last year | (?date1 < (today-1year) && ?date2 > today && (today-1year-?date1 > 30 days | | ?date2-today+1year > 30 days))
| | ?date1 < today-1year
)
Therapy with rosiglitazone (Avandia) or pioglitazone (Actos), or extendin-4 (Byetta), alone or in combination in the previous 6 months ?x rdf:type ?y .
{
?y owl:equivalentClass sdtm:Rosiglitazone .
UNION
?y owl:equivalentClass sdtm:Pioglitazone .
UNION
?y owl:equivalentClass sdtm:ExtendIn-4 .
}
?x sdtm:startDateTime ?date1 .
?x sdtm:endDateTime ?date2 .
FILTER (?date1 > today-6months | | ?date2 > today-6months)
Patients requiring corticosteroids within 3 months or recurrent continuous oral corticosteroid treatment (more than 2 weeks) {
{?x rdf:type sdtm:Corticosteriod .
?x sdtm:startDateTime ?date .
FILTER (today - ?date < 3months) }
UNION
{ _:x1 rdf:type sdtm:Corticosteriod .
...
_:x14 rdf:type sdtm:Corticosteriod .
_:x1 sdtm:administrationRoute sdtm:Oral .
...
_:x14 sdtm:administrationRoute sdtm:Oral .
_:x1 sdtm:startDateTime ?date1 .
_:x2 sdtm:startDateTime ?date2 .
...
_:x14 sdtm:startDateTime ?date14 .
FILTER (?date2 = ?date1+1day && ... ?date14 = ?date1+14days) }
}
Use of weightloss drugs e.g., Xenical (orlistat), Meridia (sibutramine), Acutrim (phenylpropanol-amine), or similar medications within 3 months of screening ?x rdf:type sdtm:Medication .
?x sdtm:hasCategory sdtm:WeightLossMedication .
?x sdtm:startDateTime ?startDate .
?x sdtm:endDateTime ?endDate .
FILTER (?startDate > today-3months | | ?endDate > today - 3months)
Serum creatinine > 1.4 for women and > 1.5 for men or eGFR < 60 calculated using the Modification of Diet in Renal Disease (MDRD) equation { ?result rdf:type sdtm:SerumCreatinine .
?result sdtm:hasValue ?value .
?patient sdtm:gender ?gender .
FILTER ( ?value > 1.5 && ?gender = "male" | | ?value > 1.4 && ?gender = "female" ) }
UNION { ?result rdf:type sdtm:eGFR .
?result sdtm:hasValue ?value .
?result sdtm:hasMethod sdtm:MDRDEquation .
FILTER ( ?value < 60 ) }
Uncontrolled hypertension (defined as systolic blood pressure > 150 mmHg or diastolic blood pressure > 95 mmHg on three or more assessments on more than one day) ?bp1 sdtm:subject ?patient .
?bp1 sdtm:hasValue ?value1 .
?bp1 rdf:type ?y .
?bp1 sdtm:hasUnit sdtm:mmHg .
?bp1 sdtm:dateTimeOfMeasurement ?date1
...
?bp3 sdtm:subject ?patient .
?bp3 rdf:type ?y .
?bp3 sdtm:hasValue ?value3 .
?bp3 sdtm:hasUnit sdtm:mmHg .
?bp3 sdtm:dateTimeOfMeasurement ?date3
{ ?y owl:equivalentClass sdtm:SystolicBloodPressure .
FILTER (?value1 > 150 && ?value2 > 150 && ?value3 > 150 && (?date1 <> ?date2 | | ?date2 <> ?date3 | | ?date3 <> ?date1) }
UNION
{ ?y owl:equivalentClass sdtm:DiastolicBloodPressure .
FILTER (?value1 > 95 && ?value2 > 95 && ?value3 > 95 && (?date1 <> ?date2 | | ?date2 <> ?date3 | | ?date3 <> ?date1) )
Platelets < 100000 cu mm at screening ?x rdf:type sdtm:Platelets .
?x sdtm:hasValue ?value .
?x sdtm:hasUnit sdtm:cu_mm .
FILTER ( ?value < 100000 )
AST (SGOT) > 2.50 x ULN or ALT (SGPT) > 2.50 x ULN at screening { ?x rdf:type sdtm:AST_SGOT .
?x sdtm:hasValue ?value.
?x sdtm:upperLimitReferenceRange ?uln .
FILTER ( ?value > 2.5 * ?uln ) }
UNION
{ ?x rdf:type sdtm:ALT_SGPT .
?x sdtm:hasValue ?value.
?x sdtm:upperLimitReferenceRange .
FILTER ( ?value > 2.5 * ?uln ) }
Total Bilirubin > 1.50 x ULN at screening ?x rdf:type sdtm:TotalBilirubin .
?x sdtm:hasValue ?value .
?x sdtm:upperLimitReferenceRange ?uln .
FILTER ( ?value > 1.5 * ?uln )
Triglycerides (TG) > 500 mg/dL at screening ?x rdf:type sdtm:Triglycerides .
?x sdtm:hasValue ?value .
?x sdtm:hasUnit sdtm:mgdL .
FILTER ( ?value > 500 )
Chronic or continuous use (daily for more than 7 days) of nonsteroidal anti-inflammatory drugs within the preceding 2 months _:x1 rdf:type sdtm:NSAID .
_:x1 sdtm:startDateTime ?date1 .
...
_:x8 rdf:type sdtm:NSAID .
_:x8 sdtm:startDateTime ?date8 .
FILTER (?date1 > today-2months && ?date8 < today && ?date2 = date1+1day && ... && ?date8 = ?date1+7days)
Use of warfarin (Coumadin), clopidogrel (Plavix) or other anticoagulants ?x rdf:type sdtm:AntiCoagulant .
Use of probenecid (Benemid, Probalan), sulfinpyrazone (Anturane) or other uricosuric agents ?x rdf:type sdtm:UricosuricAgent .
Hemoglobin < 12 g/dL (males), < 10 g/dL (females) at screening | ?value < 10 && ?gender = "female" )