C.R. 8.5: Background: The Diagnosis History table contains three record types reflecting data at the time of Admission, Update, or Discharge. A patient may be admitted with a substance abuse (SA) diagnosis that may remain or be lost upon Update or Discharge. Or he may acquire an SA diagnosis after the initial Admission. There may be multiple records of any of the three types, including Admission records. Update or Discharge records may or may not exist.
<b>I select only Admission type records from the Diagnosis History table, then Left Outer Join to the Alias of the same table to select Update and Discharge type records.</b>
Several formulas evaluate Diagnosis Changes between the time of Admission and the LAST History record. For each patient with a specific Diagnosis Change, I get a DISTINCT COUNT of the Patient; and calculate the number of DAYS the patient is in the hospital. The number of PATIENTs and DAYS are reported at the patient level, and Sub-totaled at three Groups using Running Totals. This gets tricky because of multiple History records.
<u>A formula looks for lost SA Diagnosis.</u> In one case, a patient starts out with an SA diagnosis. In the next record, the SA diagnosis is removed. The final record for that patient again shows an SA diagnosis. My current results show a change from SA to No SA because of that middle record. In reality, the formula should only reflect the difference between the initial (Admission) History record and the Last History record.
<b>What code can I use in my Running Total formulas to only evaluate the LAST History record?</b>
Selection formula:
{ history.diagnosis_type} = "A" and
{ history _1.diagnosis_type } <> "A" and
{ history. diagnosis_date} <>history_1. diagnosis_date}
Your kind assistance will be much appreciated.
<b>I select only Admission type records from the Diagnosis History table, then Left Outer Join to the Alias of the same table to select Update and Discharge type records.</b>
Several formulas evaluate Diagnosis Changes between the time of Admission and the LAST History record. For each patient with a specific Diagnosis Change, I get a DISTINCT COUNT of the Patient; and calculate the number of DAYS the patient is in the hospital. The number of PATIENTs and DAYS are reported at the patient level, and Sub-totaled at three Groups using Running Totals. This gets tricky because of multiple History records.
<u>A formula looks for lost SA Diagnosis.</u> In one case, a patient starts out with an SA diagnosis. In the next record, the SA diagnosis is removed. The final record for that patient again shows an SA diagnosis. My current results show a change from SA to No SA because of that middle record. In reality, the formula should only reflect the difference between the initial (Admission) History record and the Last History record.
<b>What code can I use in my Running Total formulas to only evaluate the LAST History record?</b>
Selection formula:
{ history.diagnosis_type} = "A" and
{ history _1.diagnosis_type } <> "A" and
{ history. diagnosis_date} <>history_1. diagnosis_date}
Your kind assistance will be much appreciated.