Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COM-851 TX_PLVS: Column - Date of Regimen switch (limit only to the current reporting month) #323

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

tmvumbi2
Copy link
Collaborator

tmvumbi2 added 3 commits June 12, 2020 15:42
Adds the above column to the treatment report
Adds the above column to the treatment report
The previous code was comparing single drug orders, instead of regimens
JOIN drug d ON d.drug_id = do.drug_inventory_id AND d.retired = 0
WHERE o.voided = 0
AND o.encounter_id = previousEncounterId
AND o.date_created BETWEEN p_startDate AND p_endDate

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tmvumbi2 Why checking date created for this regimen?

AND o.date_created BETWEEN p_startDate AND p_endDate
AND drugIsARV(d.concept_id)
AND drugOrderIsDispensed(o.patient_id, o.order_id)
AND o.encounter_id <> currentEncounterId

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tmvumbi2 Isn't it better to use o.encounter_id < currentEncounterId and not check the date for this one?

@@ -18,8 +18,8 @@ SELECT getPatientDateOfEnrolmentInProgram(p.patient_id, "HIV_PROGRAM_KEY") AS "E
"N/A" as "Regimen at ART Start/ Régime chez ART Start",
getPatientMostRecentProgramAttributeCodedValue(p.patient_id, "397b7bc7-13ca-4e4e-abc3-bf854904dce3", "en") as "Current Regimen Line/ Ligne de régime actuelle",
getListOfActiveARVDrugs(p.patient_id, '#startDate#', '#endDate#') as "Current ART Regimen/ Régime d'ART actuel",
"N/A" as "Regimen Switch/ Commutateur de régime",
"N/A" as "Date of Regimen switch (limit only to the current reporting month)",
getRegimenSwitch(p.patient_id, "2010-01-01", "#endDate#") as "Regimen Switch/ Commutateur de régime",
Copy link

@lauravignoli lauravignoli Jun 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tmvumbi2 Remember to use 2000 instead of 2010 in case there's data entered for before 2010

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants