Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Grouping patient data into episodes of care

    Hello,

    I need to run descriptive stats on 'episodes of care' for patients at the hospital I work for. An episode of care is defined as a surgical date and the pre-surgical visits leading up to the surgical date. Any post surgical visits would not be included in the definition of 'episode of care'. The issue I'm running into is a single patient (PatientInternalID) may have received multiple surgeries at our surgery center. For example, PatientInternalId="100583" had surgery on 22330 (Feb 19, 2021). The patient had an office visit piror to surgery on 22312 (Feb 1, 2019). I would like to group these visits as being an 'episode of care'. The same patient then had a second surgery on 22600(Nov 16, 2021), and had four office visits prior to the patient's second surgery (or post first surgery). I would like group these four visits and surgery as an 'episode of care'. The only caveat is the pre-surgical visits for the patient's second surgery can only be part of that (second) episode of care if the visits are 90 days after the patients first surgery (there's a 90 day global period post surgery where we do not bill). So, in my second example, only 2/4 of the visits piror to the patient's second surgery would be included because two of the visits fall in the 90 day window post first surgery (22341 & 22369). Hopefully this isn't too convoluted. I'm hoping to create a variable that would help group episodes of care. When a patient only has a single surgery its quite easy to deal with. I use egen first = min(cond(TotalJoints=="Yes", date, .)), by(PatientInternalId). I get the surgical date across all observations by patient, calculate the difference from the patient's other dates of service, and drop any cases greater than 90 days. However, it becomes much more complicated when a patient has had multiple surgeries.

    Any help would be much appreciated.





    input str8 PatientInternalId float date str25 Department str3 TotalJoints
    "100404" 21102 "X-Ray/Imaging" "No"
    "100404" 21102 "Office Visits - Est" "No"
    "100404" 21220 "X-Ray/Imaging" "No"
    "100404" 21220 "Office Visits - Est" "No"
    "100404" 21244 "Surgery" "Yes"
    "100404" 21244 "Surgery" "Yes"
    "100404" 21244 "Surgery" "No"
    "100404" 21244 "Surgery" "No"
    "100404" 21258 "X-Ray/Imaging" "No"
    "100404" 21258 "Office Visits - Est" "No"
    "100404" 21258 "Miscellaneous" "No"
    "100404" 21283 "X-Ray/Imaging" "No"
    "100404" 21283 "Miscellaneous" "No"
    "100404" 21423 "Office Visits - Est" "No"
    "100404" 21423 "X-Ray/Imaging" "No"
    "100583" 22312 "**No Department" "No"
    "100583" 22312 "Office Visits - Est" "No"
    "100583" 22330 "Surgery" "Yes"
    "100583" 22330 "Surgery" "Yes"
    "100583" 22341 "X-Ray/Imaging" "No"
    "100583" 22341 "Office Visits - Est" "No"
    "100583" 22341 "Medications" "No"
    "100583" 22341 "Medications" "No"
    "100583" 22341 "Injections" "No"
    "100583" 22341 "X-Ray/Imaging" "No"
    "100583" 22369 "X-Ray/Imaging" "No"
    "100583" 22369 "Miscellaneous" "No"
    "100583" 22508 "X-Ray/Imaging" "No"
    "100583" 22508 "Office Visits - Est" "No"
    "100583" 22585 "Office Visits - Est" "No"
    "100583" 22585 "X-Ray/Imaging" "No"
    "100583" 22585 "**No Department" "No"
    "100583" 22600 "Surgery" "Yes"
    "100583" 22600 "Injections" "No"
    "100583" 22613 "Miscellaneous" "No"
    "100583" 22613 "X-Ray/Imaging" "No"
    "100583" 22650 "Miscellaneous" "No"
    "100583" 22650 "**No Department" "No"
    "100583" 22650 "X-Ray/Imaging" "No"
    "100583" 22719 "Office Visits - Est" "No"
    "100583" 22719 "X-Ray/Imaging" "No"
    "100583" 22719 "X-Ray/Imaging" "No"
    "100583" 22964 "X-Ray/Imaging" "No"
    "100583" 22964 "Injections" "No"
    "100583" 22964 "Medications" "No"
    "100583" 22964 "Office Visits - Est" "No"
    "100583" 22964 "Medications" "No"
    "100583" 23190 "X-Ray/Imaging" "No"
    "100583" 23190 "Medications" "No"
    "100583" 23190 "Injections" "No"
    "100583" 23190 "Medications" "No"
    "100583" 23190 "Office Visits - Est" "No"
    "100583" 23288 "**No Department" "No"
    "100583" 23288 "Office Visits - Est" "No"
    "100583" 23310 "Surgery" "Yes"
    "100583" 23310 "Surgery" "Yes"
    "100583" 23323 "X-Ray/Imaging" "No"
    "100583" 23323 "Miscellaneous" "No"
    "100583" 23351 "X-Ray/Imaging" "No"
    "100583" 23351 "Miscellaneous" "No"
    "100583" 23351 "**No Department" "No"
    "100583" 23421 "X-Ray/Imaging" "No"
    "100583" 23421 "Office Visits - Est" "No"
    "100583" 23503 "X-Ray/Imaging" "No"
    "100583" 23503 "Office Visits - Est" "No"
    "101254" 22375 "Office Visits - Est" "No"
    "101254" 22375 "**No Department" "No"
    "101254" 22404 "Surgery" "Yes"
    "101656" 23330 "X-Ray/Imaging" "No"
    "101656" 23330 "Office Visits - Est" "No"
    "101656" 23330 "**No Department" "No"
    "101656" 23330 "X-Ray/Imaging" "No"
    "101656" 23330 "X-Ray/Imaging" "No"
    "101656" 23355 "Miscellaneous" "No"
    "101656" 23356 "Surgery" "Yes"
    "101656" 23399 "X-Ray/Imaging" "No"
    "101656" 23399 "X-Ray/Imaging" "No"
    "101656" 23399 "Miscellaneous" "No"
    "101656" 23427 "Miscellaneous" "No"
    "101656" 23462 "Office Visits - Est" "No"
    "101656" 23462 "X-Ray/Imaging" "No"
    "101656" 23462 "X-Ray/Imaging" "No"
    "101656" 23462 "X-Ray/Imaging" "No"
    "101656" 23553 "X-Ray/Imaging" "No"
    "101656" 23553 "X-Ray/Imaging" "No"
    "101656" 23553 "Office Visits - Est" "No"
    "101656" 23553 "X-Ray/Imaging" "No"
    "101934" 23075 "DME" "No"
    "101934" 23075 "**No Department" "No"
    "101934" 23075 "Office Visits - Est" "No"
    "101934" 23100 "Surgery" "Yes"
    "101934" 23100 "Surgery" "Yes"
    "101934" 23323 "Miscellaneous" "No"
    "101934" 23476 "X-Ray/Imaging" "No"
    "101934" 23476 "Office Visits - Est" "No"
    "102297" 22123 "Office Visits - Est" "No"
    "102297" 22123 "X-Ray/Imaging" "No"
    "102297" 22180 "Surgery" "Yes"
    "102297" 22180 "Surgery" "Yes"
    "102297" 22232 "Miscellaneous" "No"

  • #2
    So first, let me check that I understand correctly how you identify which of these visits are the ones when surgery was carried out. It seems that the criterion for that is TotalJoints == "Yes". Based on that, I think the following code does what you want:
    Code:
    //    IDENTIFY NON-BILLABLE DATES
    gen byte surgical_date = (TotalJoints == "Yes")
    rangestat (sum) non_billable = surgical_date, by(PatientInternalId) ///
        interval(date -90 -1)
    replace non_billable = 0 if missing(non_billable)
    replace non_billable = min(non_billable, 1)
    
    //    DEFINE EPISODES OF CARE STARTING WITH A NON-SURGERY DATE THAT
    //    IS EITHER THE FIRST DATE OR IS THE FIRST FOLLOWING A SURGERY DATE
    by PatientInternalId (date surgical_date), sort: gen int episode = ///
        sum(surgical_date == 0 & surgical_date[_n-1] != 0)
    //    EXCLUDE NON-BILLABLE DATES
    replace episode = . if non_billable
    -rangestat- is written by Robert Picard, Nick Cox, and Roberto Ferrer. It is available from SSC.

    Two unresolved (in my mind) questions. 1. There are some situations where, after a surgery and beyond the 90 day blackout period, there are more visits, but no further surgery. For example, PatientInternalId 100404 has surgery on 1 Mar 2018. There are several subsequent visits in the blackout period. Then we see two visits on 27 Aug 2018, after which the data abruptly ends with no surgery following that. The code above classifies these two visits as a new episode of care even though no subsequent surgery is found. Is that what you want? 2. There are frequent observations in the data that are exact duplicates: same patient, date, department, TotalJoints. Unless this example has elided other variables in the real data set that distinguish them, the presence of such exact duplicates often indicates errors in data management. Are you confident this data set is correct?

    Comment


    • #3
      Hi Clyde,

      I'm ging to try your code now but wanted to quickly respond. To your first question, in the situation of patient 100404, since the patient did not have a second surgery, I would delete any subsequent visits. The main aim of the study is to determine average revenue by surgical episode of care. Since we don't collect revenue in the post 90 period, and the patient did not have a second surgery, any subsequent visits would be dropped.

      To your second question, unfortunately (at least for data cleaning purposes), I use charge-level/billing data. So, there's a CPT Code (used for billing purposes) associated with each row of data. So, although there are duplicates (same patient, date, department), they have varying cpt codes, and all should be included from a revenue perspective.

      Comment


      • #4
        It worked! Thanks, Clyde. Always appreciated.

        Comment

        Working...
        X