gnumed-devel
[Top][All Lists]
Advanced

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

[Gnumed-devel] re: create identity ( yet again).


From: syan tan
Subject: [Gnumed-devel] re: create identity ( yet again).
Date: Thu, 20 Nov 2003 23:36:31 +1100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030313

There seems to be a problem with the create_identity as it is:


>>> Here a nameless identity is created, given the concept that a named identity is a person:

gnumed=# insert into identity ( dob, gender) values( now(), '?');
INSERT 29184 1
gnumed=# select currval('identity_id_seq');
currval
---------
     14
(1 row)

gnumed=# update
Display all 198 possibilities? (y or n)

>>> Here setActiveName is called, and updates v_basic_person with lastname and firstname only, which doesn't work.

gnumed=# update v_basic_person set firstnames = 'jim' , lastnames = 'bloggs' where i_id = 14;
UPDATE 0
gnumed=# select * from v_basic_person;
id | i_id | n_id | title | firstnames | lastnames | dob | cob | gender
----+------+------+-------+------------+-----------+-------------------------------+-----+--------
1 | 1 | 1 | Mr | Bill | Brown | 1980-02-01 00:00:00+11 | | m 2 | 2 | 2 | mr | david | smith | 1980-01-01 00:00:00+11 | | m 8 | 8 | 6 | Mrs | Morticia | Adams | 1980-01-01 00:00:00+11 | | f 10 | 10 | 7 | | charles | atlas | 2003-11-20 23:11:37.005271+11 | |
(4 rows)

>>> However, given the 2 parameters of setActiveName , you can insert into the names table directly , AND
it also appears in v_basic_person.

gnumed=#
gnumed=# insert into names ( firstnames, lastnames, id_identity) values( 'bloggs', 'jim', 14);
INSERT 29185 1
gnumed=# select * from v_basic_person;
id | i_id | n_id | title | firstnames | lastnames | dob | cob | gender
----+------+------+-------+------------+-----------+-------------------------------+-----+--------
1 | 1 | 1 | Mr | Bill | Brown | 1980-02-01 00:00:00+11 | | m 2 | 2 | 2 | mr | david | smith | 1980-01-01 00:00:00+11 | | m 8 | 8 | 6 | Mrs | Morticia | Adams | 1980-01-01 00:00:00+11 | | f 10 | 10 | 7 | | charles | atlas | 2003-11-20 23:11:37.005271+11 | | 14 | 14 | 8 | | bloggs | jim | 2003-11-20 23:17:01.007407+11 | | ?
(5 rows)


>>> Next, a separate call to setTitle calls update v_basic_person, says the update happened,


gnumed=# update v_basic_person set title = 'Mr' where i_id = 14;
UPDATE 1

>>>  But viewing the v_basic_person, the title doesn't appear in view.

gnumed=# select * from v_basic_person;
id | i_id | n_id | title | firstnames | lastnames | dob | cob | gender
----+------+------+-------+------------+-----------+-------------------------------+-----+--------
1 | 1 | 1 | Mr | Bill | Brown | 1980-02-01 00:00:00+11 | | m 2 | 2 | 2 | mr | david | smith | 1980-01-01 00:00:00+11 | | m 8 | 8 | 6 | Mrs | Morticia | Adams | 1980-01-01 00:00:00+11 | | f 10 | 10 | 7 | | charles | atlas | 2003-11-20 23:11:37.005271+11 | | 14 | 14 | 8 | | bloggs | jim | 2003-11-20 23:17:01.007407+11 | | ?
(5 rows)

>>>> Nor is it in names table.

gnumed=# select * from names;
id | id_identity | active | lastnames | firstnames | preferred | title
----+-------------+--------+-----------+------------+-----------+-------
 1 |           1 | t      | Brown     | Bill       |           | Mr
 2 |           2 | t      | smith     | david      |           | mr
 3 |           8 | f      | Adam      | Amanda     |           | Miss
 5 |           8 | f      | Adams     | Morticia   |           | Miss
 6 |           8 | t      | Adams     | Morticia   |           | Mrs
 7 |          10 | t      | atlas     | charles    |           |
 8 |          14 | t      | jim       | bloggs     |           |
(7 rows)


On the other hand, if you use insert into v_basic_person, providing a simultaneous insert of non-null values to all the fields concerned, you don' t have a problem of separating the update of lastnames and firstnames, and the update of Title: which is the model for the calls to setActiveName and setTitle on the gmDemographicRecord object.

gnumed=#gnumed=# insert into v_basic_person( title, firstnames, lastnames, dob, gender) values ('Mr', '?', '?', now(), '?');
INSERT 29188 1
gnumed=# select * from v_basic_person;
id | i_id | n_id | title | firstnames | lastnames | dob | cob | gender
----+------+------+-------+------------+-----------+-------------------------------+-----+--------
1 | 1 | 1 | Mr | Bill | Brown | 1980-02-01 00:00:00+11 | | m 2 | 2 | 2 | mr | david | smith | 1980-01-01 00:00:00+11 | | m 8 | 8 | 6 | Mrs | Morticia | Adams | 1980-01-01 00:00:00+11 | | f 10 | 10 | 7 | | charles | atlas | 2003-11-20 23:11:37.005271+11 | | 14 | 14 | 8 | | bloggs | jim | 2003-11-20 23:17:01.007407+11 | | ? 15 | 15 | 9 | Mr | ? | ? | 2003-11-20 23:27:09.129555+11 | | ?
(6 rows)

gnumed=# update v_basic_person set firstnames = 'jane' , lastnames = 'doe' where i_id = 15;
UPDATE 1
gnumed=# select * from v_basic_person;
id | i_id | n_id | title | firstnames | lastnames | dob | cob | gender
----+------+------+-------+------------+-----------+-------------------------------+-----+--------
1 | 1 | 1 | Mr | Bill | Brown | 1980-02-01 00:00:00+11 | | m 2 | 2 | 2 | mr | david | smith | 1980-01-01 00:00:00+11 | | m 8 | 8 | 6 | Mrs | Morticia | Adams | 1980-01-01 00:00:00+11 | | f 10 | 10 | 7 | | charles | atlas | 2003-11-20 23:11:37.005271+11 | | 14 | 14 | 8 | | bloggs | jim | 2003-11-20 23:17:01.007407+11 | | ? 15 | 15 | 10 | Mr | jane | doe | 2003-11-20 23:27:09.129555+11 | | ?
(6 rows)

gnumed=# update v_basic_person set title = 'Miss' where i_id = 15;
UPDATE 1
gnumed=# select * from v_basic_person;
id | i_id | n_id | title | firstnames | lastnames | dob | cob | gender
----+------+------+-------+------------+-----------+-------------------------------+-----+--------
1 | 1 | 1 | Mr | Bill | Brown | 1980-02-01 00:00:00+11 | | m 2 | 2 | 2 | mr | david | smith | 1980-01-01 00:00:00+11 | | m 8 | 8 | 6 | Mrs | Morticia | Adams | 1980-01-01 00:00:00+11 | | f 10 | 10 | 7 | | charles | atlas | 2003-11-20 23:11:37.005271+11 | | 14 | 14 | 8 | | bloggs | jim | 2003-11-20 23:17:01.007407+11 | | ? 15 | 15 | 11 | Miss | jane | doe | 2003-11-20 23:27:09.129555+11 | | ?
(6 rows)

gnumed=#

That's why I'm saying there is a processing dependency between an insert into the v_basic_person
and an update into it.






reply via email to

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