Skip to content

Commit

Permalink
Merge pull request #87 from WorldHealthOrganization/clean-dtp
Browse files Browse the repository at this point in the history
Adding DTP to the cleanup branch
  • Loading branch information
lukeaduncan authored Mar 22, 2024
2 parents ef2858b + 6412ba6 commit 816beae
Show file tree
Hide file tree
Showing 253 changed files with 9,729 additions and 162 deletions.
3 changes: 3 additions & 0 deletions input/cql/IMMZCommon.cql
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ define "History of Anaphylactic Reactions Condition":
define "Severe Allergic Reactions Condition":
[Condition: IMMZc."Severe allergic reactions"]

define "Severe Acute Illness Condition":
[Condition: IMMZc."Severe acute illness" ]

define "Symptomatic HIV Infection Condition":
[Condition: IMMZc."Symptomatic HIV infection"]

Expand Down
309 changes: 309 additions & 0 deletions input/cql/IMMZD2DTDTPDelayed.cql

Large diffs are not rendered by default.

124 changes: 109 additions & 15 deletions input/cql/IMMZD2DTDTPInput.cql
Original file line number Diff line number Diff line change
Expand Up @@ -30,61 +30,77 @@ define "Date of latest DTP Vaccine":
First("DTP Doses Administered to Patient").occurrence as dateTime

/*
@internal: DTP Primary Series Doses Administered to Patient
@internal: Tetanus and Diphtheria containing Doses Administered to Patient
*/
define "DTP Primary Series Doses Administered to Patient":
"DTP Doses Administered to Patient" I where not exists(I.protocolApplied.doseNumber) or ((singleton from I.protocolApplied).doseNumber as string) != 'booster'
define "Tetanus and Diphtheria containing Doses Administered to Patient":
IMMZCom."Doses Administered to Patient" I where I.vaccineCode in IMMZc."Tetanus and Diphtheria Vaccine"

/*
@internal: Tetanus and Diphtheria containing Doses Administered to Patient
@internal: Tetanus and Diphtheria containing Booster Doses Administered to Patient
*/
define "Tetanus and Diphtheria Booster Doses Administered to Patient":
IMMZCom."Doses Administered to Patient" I
where
I.vaccineCode in IMMZc."Tetanus and Diphtheria Vaccine" and ((singleton from I.protocolApplied).doseNumber as string) = 'booster'
Take( "Tetanus and Diphtheria containing Doses Administered to Patient", Count("Tetanus and Diphtheria containing Doses Administered to Patient") - 3 )

/*
@internal: Date of latest Tetanus and Diphtheria Vaccine
*/
define "Date of latest Tetanus and Diphtheria Vaccine":
First("Tetanus and Diphtheria containing Doses Administered to Patient").occurrence as dateTime

/*
@internal: Pertussis containing Doses Administered to Patient
*/
define "Pertussis Doses Administered to Patient":
IMMZCom."Doses Administered to Patient" I where I.vaccineCode in IMMZc."Pertussis Vaccine"

/*
@internal: Pertussis containing Booster Doses Administered to Patient
*/
define "Pertussis Booster Doses Administered to Patient":
IMMZCom."Doses Administered to Patient" I
where
I.vaccineCode in IMMZc."Pertussis Vaccine" and ((singleton from I.protocolApplied).doseNumber as string) = 'booster'
Take( "Pertussis Doses Administered to Patient", Count("Pertussis Doses Administered to Patient") - 3 )

/*
@input: No DTP primary series doses were administered
@pseudocode: Count of vaccines administered (where "Vaccine type" = "'Diphtheria-tetanus-pertussis containing vaccines" and "Type of dose" = "Primary series") = 0
*/
define "No DTP primary series doses were administered":
not exists("DTP Primary Series Doses Administered to Patient")
not exists("DTP Doses Administered to Patient")

/*
@input: One DTP primary series dose was administered
@pseudocode: Count of vaccines administered (where "Vaccine type" = "'Diphtheria-tetanus-pertussis containing vaccines" and "Type of dose" = "Primary series") = 1
*/
define "One DTP primary series dose was administered":
Count("DTP Primary Series Doses Administered to Patient") = 1
Count("DTP Doses Administered to Patient") = 1

/*
@input: Two DTP primary series doses were administered
@pseudocode: Count of vaccines administered (where "Vaccine type" = 'Diphtheria-tetanus-pertussis containing vaccines' and "Type of dose" = 'Primary series') = 2
*/
define "Two DTP primary series doses were administered":
Count("DTP Primary Series Doses Administered to Patient") = 2
Count("DTP Doses Administered to Patient") = 2

/*
@input: Three DTP primary series doses were administered
@pseudocode: Count of vaccines administered (where "Vaccine type" = 'Diphtheria-tetanus-pertussis containing vaccines' and "Type of dose" = 'Primary series') = 3
*/
define "Three DTP primary series doses were administered":
Count("DTP Primary Series Doses Administered to Patient") = 3
Count("DTP Doses Administered to Patient") >= 3

/*
@input: No tetanus and diphtheria booster doses were administered
@pseudocode: Count of vaccines administered (where "Vaccine type" = "Tetanus and diphtheria containing vaccines" and "Type of dose" = "Booster dose") = 0
*/
define "No tetanus and diphtheria booster doses were administered":
not exists( "Tetanus and Diphtheria Booster Doses Administered to Patient" )

/*
@input: No tetanus and diphtheria booster dose was administered
@pseudocode: Count of vaccines administered (where "Vaccine type" = "Tetanus and diphtheria containing vaccines" and "Type of dose" = "Booster dose") = 0
*/
define "No tetanus and diphtheria booster dose was administered":
"No tetanus and diphtheria booster doses were administered"

/*
@input: One tetanus and diphtheria booster dose was administered
@pseudocode: Count of vaccines administered where "Vaccine type" = "Tetanus and diphtheria containing vaccines" and "Type of dose" = "Booster dose" ) = 1
Expand All @@ -104,7 +120,7 @@ define "Two tetanus and diphtheria booster doses were administered":
@pseudocode: Count of vaccines administered where "Vaccine type" = "Tetanus and diphtheria containing vaccines" and "Type of dose" = "Booster dose" ) = 3
*/
define "Three tetanus and diphtheria booster doses were administered":
Count("Tetanus and Diphtheria Booster Doses Administered to Patient") = 3
Count("Tetanus and Diphtheria Booster Doses Administered to Patient") >= 3

/*
@input: No pertussis booster doses were administered
Expand Down Expand Up @@ -183,12 +199,27 @@ define "Client's age is more than or equal to 9 years":
define "Client's age is less than 1 year":
IMMZCom."Current Patient Age In Years" < 1

/*
@input: Client's age is more than 1 year
@pseudocode: Today's date - "Date of birth" > 1 year
*/
define "Client's age is more than 1 year":
not( "Client's age is less than 1 year" )

/*
@input: Client's age is between 1 year and 6 years
@pseudocode: 1 'year' ≤ Today's date - "Date of birth" ≤ 6 'year'
*/
define "Client's age is between 1 year and 6 years":
not("Client's age is less than 1 year") and not("Client's age is more than 6 years")

/*
@input: Client's age is between 1 year and 6 years old
@pseudocode: 1 year ≤ Today's date - "Date of birth" ≤ 6 years
*/
define "Client's age is between 1 year and 6 years old":
"Client's age is between 1 year and 6 years"

/*
@input: Client's age is more than 6 years
@pseudocode: Today's date - "Date of birth" > 6 'year'
Expand Down Expand Up @@ -222,3 +253,66 @@ define "The latest DTP dose was administered less than 6 months ago":
*/
define "The latest DTP dose was administered more than 6 months ago":
not("The latest DTP dose was administered less than 6 months ago")

/*
@input: The latest DTP dose was administered less than 1 year ago
@pseudocode: Today's date - latest "Date and time of vaccination" (where "Vaccine type" = "Diphtheria-tetanus-pertussis containing vaccines") < 1 year
*/
define "The latest DTP dose was administered less than 1 year ago":
"Date of latest DTP Vaccine" is not null and duration in years between "Date of latest DTP Vaccine" and Now() < 1

/*
@input: The latest DTP dose was administered more than 1 year ago
@pseudocode: Today's date - latest "Date and time of vaccination" (where "Vaccine type" = "Diphtheria-tetanus-pertussis containing vaccines") ≥ 1 year
*/
define "The latest DTP dose was administered more than 1 year ago":
not("The latest DTP dose was administered less than 1 year ago")

/*
@input: The latest tetanus and diphtheria dose was administered less than 4 weeks ago
@pseudocode: Today's date - Latest "Date and time of vaccination" (where "Vaccine type" = "Tetanus and diphtheria containing vaccines") < 4 weeks
*/
define "The latest tetanus and diphtheria dose was administered less than 4 weeks ago":
"Date of latest Tetanus and Diphtheria Vaccine" is not null and duration in weeks between "Date of latest Tetanus and Diphtheria Vaccine" and Now() < 4

/*
@input: The latest tetanus and diphtheria dose was administered more than 4 weeks ago
@pseudocode: Today's date - Latest "Date and time of vaccination" (where "Vaccine type" = "Tetanus and diphtheria containing vaccines") > 4 weeks
*/
define "The latest tetanus and diphtheria dose was administered more than 4 weeks ago":
not("The latest tetanus and diphtheria dose was administered less than 4 weeks ago")

/*
@input: The latest tetanus and diphtheria dose was administered less than 1 year ago
@pseudocode: Today's date - Latest "Date and time of vaccination" (where "Vaccine type" = "Tetanus and diphtheria containing vaccines") < 1 year
*/
define "The latest tetanus and diphtheria dose was administered less than 1 year ago":
"Date of latest Tetanus and Diphtheria Vaccine" is not null and duration in years between "Date of latest Tetanus and Diphtheria Vaccine" and Now() < 1

/*
@input: The latest tetanus and diphtheria dose was administered more than 1 year ago
@pseudocode: Today's date - Latest "Date and time of vaccination" (where "Vaccine type" = "Tetanus and diphtheria containing vaccines") ≥ 1 year
*/
define "The latest tetanus and diphtheria dose was administered more than 1 year ago":
not("The latest tetanus and diphtheria dose was administered less than 1 year ago")

/*
@input: Client is currently pregnant
@pseudocode: "Currently pregnant" = TRUE
*/
define "Client is currently pregnant":
IMMZCom."Pregnant"

/*
@input: The client has a history of anaphylactic reactions
@pseudocode: "Potential contraindications" = "History of anaphylactic reactions"
*/
define "The client has a history of anaphylactic reactions":
exists(IMMZCom."History of Anaphylactic Reactions Condition")

/*
@input: The client currently has a severe acute illness
@pseudocode: "Potential contraindications" = "Severe acute illness"
*/
define "The client currently has a severe acute illness":
exists(IMMZCom."Severe Acute Illness Condition")
Loading

0 comments on commit 816beae

Please sign in to comment.