Opened 9 years ago

Closed 8 years ago

Last modified 7 years ago

#826 closed defect (fixed)

some flowsheet observations are not connected to the relevant encounter

Reported by: rwaitman Owned by: badagarla
Priority: major Milestone: heron-council-grove-update
Component: data-repository Keywords: public-web
Cc: rwaitman, dconnolly Blocked By:
Blocking: #1696 Sensitive: no

Description

Diagnosing a problem with missing flowsheet data (ticket:789#comment:12)
reminded us that we're using a fabricated encounter
when CLARITY.ip_data_store.ept_csn is null (source:heron_load/epic_flowsheets_transform.sql#L55).

Now that i2b2 1.6 lets users query by same-encounter, perhaps
we should use the time of the observation or some such to find
a more relevant encounter.

Dan, reporting for Russ

Change History (10)

comment:1 Changed 9 years ago by rwaitman

Milestone: heron-clinton-updateheron-eldorado-update

comment:2 Changed 9 years ago by rwaitman

Milestone: heron-eldorado-updateheron-bighill-update

comment:3 Changed 9 years ago by rwaitman

Milestone: heron-bighill-updateHERONv.Next

comment:4 Changed 8 years ago by dconnolly

Milestone: HERONv.Nextheron-council-grove-update
Owner: set to badagarla
Status: newassigned

comment:5 Changed 8 years ago by ngraham

Blocking: 1696 added

comment:6 Changed 8 years ago by badagarla

At a glance it looks like I might have fixed this issue when the flowsheets making changes for the Ambulatory flowsheets #1512 Changeset: 41be2556ade7.

Will confirm before closing this ticket.

comment:7 Changed 8 years ago by badagarla

Cc: achoudhary removed
Resolution: fixed
Status: assignedclosed

Currently we have 100% of the flowsheet records linked to a valid encounter.

Following Russ' advice I ran the following query (from epic_flowsheets_transform.sql) on FA to make sure the events align with flowsheets. The query checks if there is any difference between the flowsheet measures dates and encounters dates. All the rows returned had a 0 day difference.

select  round(abs(contact_date-start_date)) as difference, contact_date, start_date from (
select ifr.record_date
     , ifm.recorded_time
     , cpeh.pat_id
     , ifgd.flo_meas_name
     , ifm.meas_value
     , ifgd.unit
     , ifgd.value_type_name
     , ifgd.multi_select_yn
     , ifm.flo_meas_id
     , cpeh.pat_enc_csn_id 
     , ifm.entry_time
     , ifm.fsd_id
     ,  case
           when cpeh.pat_enc_csn_id is not null then to_char(cpeh.pat_enc_csn_id)
           else 'fabricated_for_' || cpeh.pat_id
         end  ENCOUNTER_IDE
     , cpeh.pat_id PATIENT_IDE
     , recorded_time START_DATE
     , ifm.recorded_time END_DATE
     , entry_time UPDATE_DATE
from CLARITY.ip_flwsht_meas ifm
  join CLARITY.ip_flwsht_rec ifr
   on ifr.fsd_id = ifm.fsd_id
  join CLARITY.ip_flo_gp_data ifgd
   on ifm.flo_meas_id= ifgd.flo_meas_id
  join (select min(pat_enc_csn_id) as pat_enc_csn_id, 
      inpatient_data_id, pat_id
      from clarity.pat_enc cpeh
      group by inpatient_data_id, pat_id) cpeh
   on ifr.inpatient_data_id=cpeh.inpatient_data_id
   ) lo
   join clarity.pat_enc lo1
   on lo.pat_enc_csn_id = lo1.pat_enc_csn_id
   and to_char(contact_date, 'yyyy-mm-dd')! =  to_char(start_date, 'yyyy-mm-dd')
   order by difference;

comment:8 Changed 8 years ago by dconnolly

Type: design-issuedefect

I'm reviewing council grove fixes, making sure summaries make sense from a customer perspective. This looks customer-visible to me, so it shouldn't be a design-issue. It looks like a fixed defect, right?

I'm not sure I understand that validation query, but if it's good enough for Russ, that's probably fine. Does that query get automatically re-run every month and fall over if it fails? Or do we need to manually check? Or is the risk that it will fail acceptably low to just assume that it works?

It would be nice to have a test case specific to this fix.

Also, the ... else 'fabricated_for_' || cpeh.pat_id ... code is still in source:heron_load/epic_flowsheets_transform.sql . It's dead code now, right?

comment:9 Changed 7 years ago by ngraham

Keywords: public-web added

comment:10 Changed 7 years ago by kcrane2

Approved for public release.

Note: See TracTickets for help on using tickets.