Project

General

Profile

« Previous | Next » 

Revision 1191

Moved verify.sql to mappings since it's mapping-related

View differences:

schemas/verify.sql
1
SELECT '# projects' AS ___;
2
SELECT count(*) AS count
3
FROM project
4
JOIN party ON party_id = datasource_id AND organizationname = :datasource
5
;
6

  
7
SELECT 'projects' AS ___;
8
SELECT projectname AS project
9
FROM project
10
JOIN party ON party_id = datasource_id AND organizationname = :datasource
11
ORDER BY project
12
;
13

  
14
SELECT E'each project\'s # locations' AS ___;
15
SELECT projectname AS project, count(*) AS locations_count
16
FROM project
17
JOIN party ON party_id = datasource_id AND organizationname = :datasource
18
JOIN locationevent USING (project_id)
19
GROUP BY project
20
ORDER BY project
21
;
22

  
23
SELECT '# locations' AS ___;
24
SELECT count(DISTINCT location_id) AS count
25
FROM locationevent
26
JOIN party ON party_id = datasource_id AND organizationname = :datasource
27
WHERE parent_id IS NULL -- no subplots
28
;
29

  
30
SELECT '# location events' AS ___;
31
SELECT count(*) AS count
32
FROM locationevent
33
JOIN party ON party_id = datasource_id AND organizationname = :datasource
34
AND parent_id IS NULL -- no subplots
35
;
36

  
37
SELECT '1st methods' AS ___;
38
SELECT DISTINCT
39
    projectname AS project
40
    , method.name AS method
41
FROM project
42
JOIN party ON party_id = datasource_id AND organizationname = :datasource
43
JOIN locationevent USING (project_id)
44
JOIN method USING (method_id)
45
ORDER BY project, method
46
LIMIT 10;
47

  
48
SELECT '1st observation measures' AS ___;
49
SELECT DISTINCT
50
    projectname AS project
51
    , method.observationmeasure AS observationmeasure
52
FROM project
53
JOIN party ON party_id = datasource_id AND organizationname = :datasource
54
JOIN locationevent USING (project_id)
55
JOIN method USING (method_id)
56
ORDER BY project, observationmeasure
57
LIMIT 10;
inputs/input.Makefile
35 35
# Paths
36 36
root := $(selfDir_uZPPqC)..
37 37
mappings := $(root)/mappings
38
schemas := $(root)/schemas
39 38
psqlOpts := --set ON_ERROR_STOP=1 --quiet
40 39
psqlAsBien := $(root)/bin/psql_vegbien $(psqlOpts)
41 40

  
......
163 162

  
164 163
all += verify.out
165 164

  
166
verify.out: $(schemas)/verify.sql _always
165
verify.out: $(mappings)/verify.sql _always
167 166
	$(out_cmd)
168 167
.PRECIOUS: %.out
169 168
out_cmd = $(psqlAsBien) --set=datasource="'$(db)'" --no-align\
mappings/verify.sql
1
SELECT '# projects' AS ___;
2
SELECT count(*) AS count
3
FROM project
4
JOIN party ON party_id = datasource_id AND organizationname = :datasource
5
;
6

  
7
SELECT 'projects' AS ___;
8
SELECT projectname AS project
9
FROM project
10
JOIN party ON party_id = datasource_id AND organizationname = :datasource
11
ORDER BY project
12
;
13

  
14
SELECT E'each project\'s # locations' AS ___;
15
SELECT projectname AS project, count(*) AS locations_count
16
FROM project
17
JOIN party ON party_id = datasource_id AND organizationname = :datasource
18
JOIN locationevent USING (project_id)
19
GROUP BY project
20
ORDER BY project
21
;
22

  
23
SELECT '# locations' AS ___;
24
SELECT count(DISTINCT location_id) AS count
25
FROM locationevent
26
JOIN party ON party_id = datasource_id AND organizationname = :datasource
27
WHERE parent_id IS NULL -- no subplots
28
;
29

  
30
SELECT '# location events' AS ___;
31
SELECT count(*) AS count
32
FROM locationevent
33
JOIN party ON party_id = datasource_id AND organizationname = :datasource
34
AND parent_id IS NULL -- no subplots
35
;
36

  
37
SELECT '1st methods' AS ___;
38
SELECT DISTINCT
39
    projectname AS project
40
    , method.name AS method
41
FROM project
42
JOIN party ON party_id = datasource_id AND organizationname = :datasource
43
JOIN locationevent USING (project_id)
44
JOIN method USING (method_id)
45
ORDER BY project, method
46
LIMIT 10;
47

  
48
SELECT '1st observation measures' AS ___;
49
SELECT DISTINCT
50
    projectname AS project
51
    , method.observationmeasure AS observationmeasure
52
FROM project
53
JOIN party ON party_id = datasource_id AND organizationname = :datasource
54
JOIN locationevent USING (project_id)
55
JOIN method USING (method_id)
56
ORDER BY project, observationmeasure
57
LIMIT 10;

Also available in: Unified diff