Attached is a first cut at "reviewed" objects.
Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346
-- =============================================
-- GNUmed - tracking of reviewed status of incoming data
-- =============================================
-- $Source: /cvsroot/gnumed/gnumed/gnumed/server/sql/gmSchemaRevision.sql,v $
-- $Id: gmSchemaRevision.sql,v 1.15 2005/09/19 16:22:12 ncq Exp $
-- license: GPL
-- author: [EMAIL PROTECTED]
-- =============================================
-- force terminate + exit(3) on errors if non-interactive
\set ON_ERROR_STOP 1
-- ---------------------------------------------
create table reviewed_status (
pk serial primary key,
table_oid oid
not null,
fk_reviewed_pk integer
not null,
fk_reviewer integer
not null
references public.xlnk_identity(xfk_identity),
is_technically_abnormal boolean
not null,
clinically_relevant boolean
not null
) inherits (audit_fields);
-- =============================================
-- do simple schema revision tracking
select log_script_insertion('$RCSfile: gmWaitingList.sql,v $', '$Revision: 1.1
$');
-- =============================================
-- $Log: gmWaitingList.sql,v $
--
-- =============================================
-- GNUmed - tracking of reviewed status of incoming data
-- =============================================
-- $Source: /cvsroot/gnumed/gnumed/gnumed/server/sql/gmSchemaRevision.sql,v $
-- $Id: gmSchemaRevision.sql,v 1.15 2005/09/19 16:22:12 ncq Exp $
-- license: GPL
-- author: [EMAIL PROTECTED]
-- =============================================
-- force terminate + exit(3) on errors if non-interactive
\set ON_ERROR_STOP 1
-- ---------------------------------------------
-- table reviewed_status
select add_table_for_auditing('public', 'reviewed_status');
comment on table reviewed_status is
'this table tracks whether a particular clinical item
was reviewed by a clinician or not';
comment on column reviewed_status.table_oid is
'the oid of the table this status row relates to';
comment on column reviewed_status.fk_reviewed_pk is
'the row of which the status is tracked';
comment on column reviewed_status.fk_reviewer is
'who reviewed this row';
comment on column reviewed_status.is_technically_abnormal is
'whether test provider flagged this result as abnormal,
*not* a clinical assessment but rather a technical one
LDT: exist(8422)';
comment on column reviewed_status.fk_reviewer is
'who has reviewed the item';
comment on column reviewed_status.clinically_relevant is
'whether this result is considered relevant clinically,
need not correspond to the value of "techically_abnormal"
since abnormal values may be irrelevant while normal
ones can be of significance';
-- ---------------------------------------------
\unset ON_ERROR_STOP
drop view v_reviewed_status cascade;
\set ON_ERROR_STOP 1
create view v_reviewed_status as
select
rs.pk as pk_reviewed_status,
rs.table_oid as src_table_oid,
rs.fk_reviewed_pk as pk_reviewed_row,
rs.fk_reviewer as pk_reviewer,
rs.is_technically_abnormal as is_technically_abnormal,
rs.clinically_relevant as clinically_relevant,
case when ((select 1 from v_staff where pk_identity = rs.fk_reviewer)
is null)
then '<' || rs.fk_reviewer || '>'
else (select sign from v_staff where pk_identity =
rs.fk_reviewer)
end as reviewer,
(select relname
from pg_class
where pg_class.oid = rs.table_oid
) as src_table
from
reviewed_status rs
;
-- =============================================
grant SELECT, UPDATE, INSERT, DELETE on
"reviewed_status"
, "reviewed_status_pk_seq"
to group "gm-doctors";
grant select on
"v_reviewed_status"
to group "gm-doctors";
-- =============================================
-- do simple schema revision tracking
select log_script_insertion('$RCSfile: gmWaitingList.sql,v $', '$Revision: 1.1
$');
-- =============================================
-- $Log: gmWaitingList.sql,v $
--
_______________________________________________
Gnumed-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnumed-devel