gnumed-devel
[Top][All Lists]
Advanced

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

Re: [Gnumed-devel] need assessment from fellow clinicians


From: Karsten Hilbert
Subject: Re: [Gnumed-devel] need assessment from fellow clinicians
Date: Wed, 21 Jul 2004 08:08:48 +0200
User-agent: Mutt/1.3.22.1i

> Please correct any misuse of database terms here.
> 
> When a new clin_narrative row is created, does it require that
> - a "parent"  encounter record was already created
Yes. This is a not-null foreign key. An encounter will be
created or attached to by cClinicalRecord automatically.

> - - > from this, fk_encounter is obtained
Yes.

> - a "parent"  episode record was already created
Yes. This is a not-null foreign key. An episode will be
created or attached to by cClinicalRecord automatically.

> - - > from this, fk_episode is obtained
Yes.

> but the episode record required a "parent" clin_health_issue to already 
> exist?
Yes. This is a not-null foreign key. It can be the
auto-created xxxDEFAULTxxx, however.

> Therefore, for a secretary to be able to improve the doctor's workflow, 
> by creating a row to hold the patient's RFE (say, sore throat), the 
> secretary would first have to choose a health issue to relate the RFE 
Yes.

> (do we want them doing this)
I am OK with that.

> or would themselves have to create a 
> "new" health issue (do we want them to doing this)?
Usually not. Use the xxxDEFAULT health issue if unsure.

> Also, how do new records get created in the table clin_root_item?
> 
> Does this happen automatically when a person creates a new row in 
> clin_narrative, causing creation of clin_root_item, which is 
> automatically assigned an incremental pk_item value, and this is right 
> away inherited by clin_narrative?
Yes. Like that. Reason being that clin_narrative inherits from
clin_root_item. In fact, inserting into any table inheriting
from clin_root_item (there are quite a few) creates rows in
clin_root_item. It is very desirable to NOT muck with data in
clin_root_item directly (except reads) or else inheritance
will break down the way PostgreSQL supports it currently.

> I am trying to understand in the schema for clin_narrative what means 
> nextval('public.clin_root_item_pk_item_seq'::text) since there is no
When you create a table with a SERIAL datatype column PostgreSQL
will auto-create a SEQUENCE (clin_root_item_pk_seq) and set the
default for the column (clin_root_item.pk_item) to be the next
value in the sequence (this is lock-freely transaction safe but
may contain gaps, just for the record). We use SERIAL
datatypes for all primary keys like so:

create table something (
    pk serial primary key
);

> field in clin_root_item having name pk_item_seq (only pk_item, so what 
> meaning or function has the "_seq").
It signifies that it is a sequence object name.

> Post to the list if you think it could be useful to others.
Did.

Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346




reply via email to

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