1 2 Previous Next 15 Replies Latest reply on Jul 30, 2017 1:14 AM by hannah.rhrbein

# To identify patients with at least once the same diagnosis as recorded on Cause of Death

Hi everybody,

I've got a problem to create a new variable again. Maybe you can help me.

An example of the dataset (hospital):

Patientnumber
Casenumber
Discharge date
Cause of Discharge
Diagnosis
11113.03.2014treatment regularly endsR57.9
11220.02.2016deathR57.9
22111.01.2013treatment regularly endsM54.5
22223.05.2014treatment regularly endsI50.00
22302.12.2014death

I50.00

I'd like to identify the patients, who were admitted to hospital within the last 12 months of life at least once for the same diagnosis as recorded on Cause of Death (Cause of Discharge: death). In the example Patient number 2.

If "within the last 12 months of life" is a problem, it would be also great to know how to identify patients, who were admitted to hospital at least once for the same diagnosis as recorded on Cause of Death (in the example both patients)

I hope it's possible.

• ###### 1. Re: To identify patients with at least once the same diagnosis as recorded on Cause of Death

Hi Hanna

See the attached

There are several calculated fields

first just ID the records with COD= Death as           If [Cause of discharge]='death' then 'yes' end

Next Number of days to the last visit as

abs(IFNULL((DATEDIFF('day',ATTR([Date of discharge]),LOOKUP(ATTR([Date of discharge]),-1))),0))

Then the final calculation ID's records that meet both criteria

if attr([Cause of discharge])='death' and ([Number of days to last visit])<365 then 'yes' else 'no' end

It will result in this

Let me know if this helps

Jim

• ###### 2. Re: To identify patients with at least once the same diagnosis as recorded on Cause of Death

Hi Jim,

Is it also possible to include the diagnosis? So I can answer the question if the patient was there with the same diagnosis?

Thanks

• ###### 3. Re: To identify patients with at least once the same diagnosis as recorded on Cause of Death

Of course - my bad - I overlooked the diagnosis

the day count now becomes for days between visits with the same diagnosis

abs(if attr([Diagnosis])=lookup(ATTR([Diagnosis]),-1) then IFNULL((DATEDIFF('day',ATTR([Date of discharge]),

LOOKUP(ATTR([Date of discharge]),-1))),0)  end)

and the screen looks like this

Let me know if this is it

Jim

If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

1 of 1 people found this helpful
• ###### 4. Re: To identify patients with at least once the same diagnosis as recorded on Cause of Death

Yes that's it. Thank you very much!

Hannah

• ###### 5. Re: To identify patients with at least once the same diagnosis as recorded on Cause of Death

Hi,

I'm sorry but there's still one problem...

When there's an other diagnosis between, it doesn't work. Maybe you have an idea.

• ###### 6. Re: To identify patients with at least once the same diagnosis as recorded on Cause of Death

OK this got a little tricky - had to result to brute force

First I added calculations for the fixed cause of death and data of death

{ FIXED [Patient Number], [Cause of discharge]='Death': min([Diagnosis])}

and

{ FIXED [Patient Number]: Min({ INCLUDE [Cause of discharge]='death' :max( [Date of discharge])}  ) }  - this min/max combination is needed because we are working with dates and an LOD - can't use Attr()

Then the days between death and the diagnosis becomes

if [Diagnosis]=[fixed COD] then DATEDIFF('day',[fixed date of death],[Date of discharge]) end

and the check becomes

IF [Date of discharge]<>[fixed date of death] THEN

{ FIXED [Date of discharge]:MAX(if [calculate the days with same diagnosis]<365

Then "Yes-same Diagnosis and < 1 year" else "" end )} ELSE "" END

The first part just says don't include the date of death record

The rest checks for the 365 day year

Hope this works for you

Jim

• ###### 7. Re: To identify patients with at least once the same diagnosis as recorded on Cause of Death

Hi,

I've tried it with the right dataset and there's still a problem. I'm sorry, I wouldn't ask so many times if it wasn't important for my thesis :/

There's at least a problem with the FIXED COD. When there's a diagnosis that's before the diagnosis of death in the alphabet it's the FIXED COD. And then the whole thing doesn't work.

I hope it's possible anyway.

Unfortunately I can't send the original data (I think it wouldn't help anyway it's in german), but I add the excel sheet.

Thanks

Hannah

• ###### 8. Re: To identify patients with at least once the same diagnosis as recorded on Cause of Death

Hanna

This is tough to figure the logic - but I think this worked at least for the data you sent - check it against the rest and let me know

here is the result

the formulas have changed - the logic did not hold up

Fix dod = { FIXED [Patient Number]:Min (if [Cause of discharge]='death' then [Date of discharge] end )  }

Then the fixed cause of death = { FIXED [Patient Number]:Min (if [Cause of discharge]='death' then [Diagnosis] end )  }

Then the days difference became =if [Diagnosis]=[fixed COD] then DATEDIFF('day',[fixed date of death],[Date of discharge]) end

and the indicator became = IF [Date of discharge]<>[fixed date of death] and

abs([days with same diagnosis])<365 then "yes died of same diagnosis" Else "" end

Let me know

Jim

1 of 1 people found this helpful
• ###### 9. Re: To identify patients with at least once the same diagnosis as recorded on Cause of Death

Hi Jim,

now it works. Thank you very much!

Hannah

• ###### 10. Re: To identify patients with at least once the same diagnosis as recorded on Cause of Death

Jim

• ###### 11. Re: To identify patients with at least once the same diagnosis as recorded on Cause of Death

Hi,

I've got an other question to the dataset again, I hope it's the last question because everythig other works. Maybe you can help me, otherwise I will start a new discussion.

I'd like to identify the patients, who were admitted to hospital within 12 months caused of the same diagnosis (Not necessarily the diagnosis recorded on Death). And I'd like to know when that happend for the first time.

For example:

 Patientnumber Casenumber Discharge date Cause of discharge Diagnosis 1 11 2014.03.13 treatment regularly ends R57.9 1 12 2016.02.20 death R57.9 2 21 2013.01.11 treatment regularly ends M54.5 2 22 2014.05.23 treatment regularly ends I50.00 2 23 2014.12.02 death I50.00 3 31 2012.04.24 treatment regularly ends R57.9 3 32 2013.01.22 treatment regularly ends R57.9 3 33 2013.05.06 treatment regularly ends R57.9

Patient 2 and 3 in the example were admitted to hospital within 12 months caused of the same diagnosis. Patient 2 the first time on 02.12.2014, patient 3 on 22.01.2013. Do you have an idea how to get a variable that shows that a patient were admitted to hospital within 12 months caused of same diagnosis and a variable that shows when for the first time?

Thanks a lot

Hannah

• ###### 12. Re: To identify patients with at least once the same diagnosis as recorded on Cause of Death

Hi Hanna

Yes what you want is doable - probably more elegantly than the attached - but I think this works - first we want to determine 3 thing"

1 -   the First date that a patient came in with a diagnosis -      fixed patient diaig 1st date     { FIXED [Patientnumber],[Diagnosis]: Min([Discharge date])}

2- the reason the patient was discharged on their first visit -      fixed patient reason for discharge     { FIXED [fixed patient diaig 1st date]: max([Cause of discharge])}

3-   if the patient had been in with the same diagnosis in the past 12 months ( note - i used 365 days so that I could check 1 year but exclude the 0 days in a single formula - if that is an issue the formula can be re-written)

The calculation is used a s a filter and can be placed on the chart also

same diag w/in 12 month      IF DATEDIFF('day',[fixed patient diaig 1st date],[Discharge date])<=365 and DATEDIFF('day',[fixed patient diaig 1st date],[Discharge date])<> 0 then 'yes' else 'no' end

If you throw all the data onto a single chart so you can see each time a patient visited the results look like

in summary form it looks like this

Note - you could have patient that visited different hospitals - this approach looks at the patient level - ie across all hospitals - If you have an situation with multiple hospitals and you want to look at them individually you would change the fixed formulas to include the hospital - example           { FIXED [Patientnumber],[Diagnosis],[hospital]: Min([Discharge date])}

Let me know if this helps

Jim

• ###### 13. Re: To identify patients with at least once the same diagnosis as recorded on Cause of Death

Thanks so much, but unfortunately there's one problem. There are patients, in the new example patient 3, who had at least once the same diagnosis, but not one year later than the first time the diagnosis is recorded:

 Patientnumber Casenumber Discharge date Cause of discharge Diagnosis 1 11 2014.03.13 treatment regularly ends R57.9 1 12 2016.02.20 death R57.9 2 21 2013.01.11 treatment regularly ends M54.5 2 22 2014.05.23 treatment regularly ends I50.00 2 23 2014.12.02 death I50.00 3 31 2011.04.24 treatment regularly ends R57.9 3 32 2013.01.22 treatment regularly ends R57.9 3 33 2013.05.06 treatment regularly ends R57.9

I'd like to identify these patients, too. Maybe you've got an idea.

Hannah

• ###### 14. Re: To identify patients with at least once the same diagnosis as recorded on Cause of Death

Hanna -

Let me see if I have this correctly - there are 2 separate conditions that you are interested in

1 - you want to know for those patients who have died - were they admitted into the hospital within the prior 365 days (based on discharge date) with the same diagnosis

Separately

2 you want to see patients  who did NOT die but - were they admitted into the hospital within the prior 365 days (based on discharge date) with the same diagnosis

This is the approach on the firs issue

Calculate fixed date of death as

{ FIXED [Patientnumber] : Min(if [Cause of discharge]="death" then [Discharge date] end)}

Then Determine if they are in the group that died of the same diagnosis within 365 days as

IF DATEDIFF('day',[Discharge date],[fixed date of death])<=365 and DATEDIFF('day',[Discharge date],[fixed date of death])<> 0 then 'yes' else 'no' end

It will produce this

The second scenario - first determine that last date of discharge as by patient by diagnosis

{ FIXED [Patientnumber],[Diagnosis] : MAX([Discharge date])    }

Then check the date range as

IF ISNULL([fixed date of death]) and DATEDIFF('day',[Discharge date],[ date of last discharge])

<=365 and DATEDIFF('day',[Discharge date],[ date of last discharge])<> 0

then 'yes' else 'no' end

will produce this

I hope this helped

Jim

1 2 Previous Next