[MedicationRequest: medication in "Antidiabetic Medications"]
where status = 'active'
การสืบค้น (Query)
ไวยากรณ์เต็ม
[Encounter: "Inpatient"] E
with [Condition: "Diabetes"] D
such that D.onset during E.period
where E.status = 'finished'
return Tuple {
encounterId: E.id,
diagnosis: D.code.text
}
sort by encounterId
ลำดับ Clause
ลำดับ
Clause
คำอธิบาย
1
with/without
เงื่อนไขความสัมพันธ์
2
where
เงื่อนไขการกรอง
3
return
ฟิลด์ที่ส่งคืน
4
sort
การเรียงลำดับ
การกำหนดนิพจน์ (Define)
define "PatientHasDiabetes":
exists([Condition: "Diabetes"] D
where D.clinicalStatus ~ "Active")
define "CurrentMedications":
[MedicationRequest] M
where M.status = 'active'
ฟังก์ชัน (Function)
define function "GetDrugName"(med MedicationRequest):
if med.medication is CodeableConcept then
(med.medication as CodeableConcept).text
else
null
define function "CalculateAge"(birthDate Date):
years between birthDate and Today()
library ThTxGNNDrugRepurposing version '1.0.0'
using FHIR version '4.0.1'
include FHIRHelpers version '4.0.1'
context Patient
// รับยาที่ใช้อยู่ปัจจุบัน
define "ActiveMedications":
[MedicationRequest] M
where M.status = 'active'
and M.intent = 'order'
// รับรายชื่อยา
define "MedicationNames":
"ActiveMedications" M
return FHIRHelpers.ToConcept(M.medication as CodeableConcept).display
การกำหนด: ตรรกะการตรวจสอบ DDI
// ตรวจสอบการใช้ Warfarin + NSAID ร่วมกัน
define "WarfarinPlusNSAID":
exists([MedicationRequest: "Warfarin"] W
where W.status = 'active')
and exists([MedicationRequest: "NSAIDs"] N
where N.status = 'active')
// ข้อความแจ้งเตือน DDI
define "DDIAlertMessage":
if "WarfarinPlusNSAID" then
'WARNING: Concurrent use of Warfarin and NSAIDs increases bleeding risk.'
else
null
การกำหนด: การกรองผู้สมัครข้อบ่งใช้ใหม่
// พารามิเตอร์: เกณฑ์คะแนนการคาดการณ์ ThTxGNN
parameter PredictionScoreThreshold Decimal default 0.9
// การกำหนด: ผู้สมัครที่มีความเชื่อมั่นสูง
define "HighConfidenceCandidates":
"DrugRepurposingPredictions" P
where P.score >= PredictionScoreThreshold
and P.evidenceLevel in {'L1', 'L2', 'L3'}