Visit location - when set?
Submitted by Guest on Fri, 20/03/2015 - 12:54
I am building some practice statistics reports - including one that reports visits by location.
This looks at the act.patientClinicalEvent s (ie the visits) and counts the visits at each location. There are a significant number of cases where the location is null.
I have had a look the raw data using a query like
select a.*, el.name, ep.name, ep.entity_id
from acts a
left join participations pl on pl.act_id = a.act_id and pl.arch_short_name = 'participation.location'
left join entities el on el.entity_id = pl.entity_id
join participations pp on pp.act_id = a.act_id and pp.arch_short_name = 'participation.patient'
left join entities ep on ep.entity_id = pp.entity_id
where a.arch_short_name = 'act.patientClinicalEvent'
and a.activity_start_time between '2014-02-01' and date_add('2014-02-07', INTERVAL "23:59:59" HOUR_SECOND)
order by ep.name;
However I cannot discern any pattern as to when the location is present and when not.
The report output is typically like
The above is for Feb 2014 and I think that it would have been 1.7. I have looked at the Feb 2015 results (running 1.7.1) and that has a similar pattern.
You can see that some 40% of the visits have no location set.
Regards, Tim G
Re: Visit location - when set?
The location is only set if you edit a visit. This is probably an oversight, but hasn't been requested before.
As a workaround, you should be able to get the location by locating invoices linked to the visit:
1. get the invoice items linked to the event via actRelationship.patientClinicalEventChargeItem
2. get the corresponding invoice using the source of actRelationship.customerAccountInvoiceItem
3. get the participation.location from the invoice
Re: Visit location - when set?
Tim A - thanks for this. I added code to get the location from the invoice and this resulted in cutting the '--None--' cases to some 3% - corresponding to those visits where a) there was no location set against the visit; and b) the visit itself contained no chargable items.
I think that this is something we should clean up (ie always set visit location when visit is created) as part of 1.8's 'adding facilities for multi-location practices' effort.
I have jira'ed this - see https://openvpms.atlassian.net/browse/OVPMS-1591
Regards, Tim G