File: v9-ref-v_coded_terms.sql

package info (click to toggle)
gnumed-server 22.19-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 45,148 kB
  • sloc: sql: 1,217,279; python: 15,659; sh: 1,582; makefile: 20
file content (53 lines) | stat: -rw-r--r-- 1,469 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
-- ==============================================================
-- GNUmed database schema change script
--
-- License: GPL v2 or later
-- Author: Karsten Hilbert
-- 
-- ==============================================================
-- $Id: v9-ref-v_coded_terms.sql,v 1.1 2008-01-27 21:06:30 ncq Exp $
-- $Revision: 1.1 $

-- --------------------------------------------------------------
\set ON_ERROR_STOP 1
\set check_function_bodies 1

-- --------------------------------------------------------------
\unset ON_ERROR_STOP
drop view ref.v_coded_terms cascade;
\set ON_ERROR_STOP 1


create view ref.v_coded_terms as
select
	code,
	description as term,
	(select name_short from ref.data_source rds where rds.pk = fk_data_source) as coding_system
from
	ref.atc_group

	union

select
	code,
	description as term,
	(select name_short from ref.data_source rds where rds.pk = fk_data_source) as coding_system
from
	ref.atc_substance
;

grant select on ref.v_coded_terms to group "gm-doctors";

comment on view ref.v_coded_terms is
	'This view aggregates all official (reference) terms
	 for which a corresponding code is known to the system.';

-- --------------------------------------------------------------
select gm.log_script_insertion('$RCSfile: v9-ref-v_coded_terms.sql,v $', '$Revision: 1.1 $');

-- ==============================================================
-- $Log: v9-ref-v_coded_terms.sql,v $
-- Revision 1.1  2008-01-27 21:06:30  ncq
-- - add new
--
--