View source with raw comments or as raw
    1:- module(pas_patient,
    2          [ patient_data/1,
    3
    4            case_measurement/2,
    5            case_history/1,
    6            case_diagnosis/1,
    7            case_evidence/1,
    8            case_contraindication/1,
    9            '-case_contraindication'/1
   10          ]).   11:- use_module(library(scasp)).   12
   13:- scasp_dynamic((
   14    case_measurement/2,
   15    case_history/1,
   16    case_diagnosis/1,
   17    case_evidence/1,
   18    case_contraindication/1)).   19
   20%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   21%% Patient Interface
   22%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   25:- pred case_evidence(accf_stage_c) ::
   26        'the patient is in ACCF stage C [case data]'.   27:- pred case_evidence(pregnancy) ::
   28        'the patient is pregnant or planning to get pregnant [case data]'.   29:- pred case_evidence('E') ::
   30        'the patient is/has @(E) [case data]'.
   33:- pred case_diagnosis('D') ::
   34        'the patient is diagnosed with @(D) [case data]'.
   37:- pred case_history('H') ::
   38        'the patient has a history of @(H) [case data]'.
   41:- pred case_measurement('M','V') ::
   42        'there is a measurement of @(M) of @(V) [case data]'.   43
   44patient_data(Data) :-
   45    clean,
   46    maplist(finding, Data).
   47
   48finding(Term) :-
   49    predicate_property(Term, dynamic),
   50    !,
   51    scasp_assert(Term).
   52finding(Term) :-
   53    domain_error(patient_data, Term).
   54
   55clean :-
   56    scasp_abolish(case_measurement/2),
   57    scasp_abolish(case_history/1),
   58    scasp_abolish(case_diagnosis/1),
   59    scasp_abolish(case_evidence/1),
   60    scasp_abolish(case_contraindication/1)