-- ============================================= -- 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: address@hidden -- ============================================= -- 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 $ --