Skip to content

Commit

Permalink
Add logic for controlling dates check for data being aggregated
Browse files Browse the repository at this point in the history
  • Loading branch information
josephatJ committed Dec 13, 2024
1 parent a07309c commit 2b5f562
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/create-queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ async function processMappings(datastoreKeyData) {
}

query += `LEFT JOIN patient_flat pt ON pt.id = en.patient_id \n `;
query += `AND en.period_start >= '${startDate}' AND en.period_start <= '${endDate}' \n`;

query +=
loincOrderCodes.length > 0
? `AND drep.effective_datetime >='${startDate}' AND drep.effective_datetime <='${endDate}' \n`
: `AND en.period_start >= '${startDate}' AND en.period_start <= '${endDate}' \n`;

query += ` GROUP BY `;
query += icdCodes && icdCodes.length > 0 ? `cond.code,` : "";
Expand Down

0 comments on commit 2b5f562

Please sign in to comment.