gnumed-bugs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-bugs] a query problem when bootstrapping bundle [v18-v19-dyn


From: Karsten Hilbert
Subject: Re: [Gnumed-bugs] a query problem when bootstrapping bundle [v18-v19-dynamic]
Date: Tue, 19 Nov 2013 13:42:18 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Sun, Nov 17, 2013 at 08:53:38PM +0000, Jim Busser wrote:

> insert into dem.org_unit (fk_org, description)
> select
> (select pk from dem.org where dem.org.description = c_hs.narrative),
> 'unit of ' || c_hs.narrative
> from
> clin.hospital_stay c_hs
> where
> not exists (
> select 1 from dem.org_unit
> where
> dem.org_unit.description = 'unit of ' || c_hs.narrative
> and
> fk_org = (select pk from dem.org where dem.org.description = c_hs.narrative)
> )
> 
> which on my v18 yields
> 
>  ?column? |                 ?column?
> ----------+------------------------------------------
>           | unit of Enterprise Healthcare Unit
>           | unit of VGH
>           | unit of Vancouver General - Med Day Care
>           | unit of Vancouver General - Med Day Care
>           | unit of Vancouver General Hospital
>           | unit of Vanc
> (6 rows)
> 
> I now suspect this query was trying to ensure that every
> org which was not yet characterized by one or more units
> becomes, at minimum, a unit of itself

No. It attempts to ensure that every hospital having been
created from what had been stored in clin.hospital_stay.narrative
has got at least one unit named "unit of <whatever hospital_stay said>".

> but  If that is the case, why is it constrained to
> organizations which had been referenced from hospital stays,

Because that particular query only takes care of
formerly non-normalized hospital units.

> and why is it populating the org unit description from
> 
> 'unit of ' || c_hs.narrative
> 
> when clin.hospital_stay.narrative is 'a comment on the hospital stay' ?

Not in v18.

> It would seem to me that the description of an org unit as a 'unit of' 
> something should be acquired from
> 
> 'unit of ' || dem.org.narrative

dem.org.narrative has been populated from
clin.hospital_stay.narrative exactly ONE
SQL command prior to what you cited above.

Karsten
-- 
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346



reply via email to

[Prev in Thread] Current Thread [Next in Thread]