Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • R raven
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 18
    • Issues 18
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • eea-tools
  • raven
  • Issues
  • #21

Closed
Open
Created Nov 12, 2019 by Christoffer Stoll@cstOwner

Historical data - Add unit and timestep to timeseries selection

Add unit and timestep in the sql label output.
The example makes the query too slow so do after issue #20 is done.

select 
					aa.value, 
					CONCAT(aa.networkname, ', ', aa.name,', ', aa.pollutant, ', ', oo.unit, ', ', oo.timestep) as label, 
					to_char(oo.fromtime, 'YYYY-MM-DD"T"HH24:MI:SS') as fromtime, 
					to_char(oo.totime, 'YYYY-MM-DD"T"HH24:MI:SS') as totime,unit, timestep
from 
			(
					select sp.id as sp, oc.id as value, s.name, po.notation pollutant, n.name networkname
					from stations s, 
					sampling_points sp, 
					observing_capabilities oc, 
					eea_pollutants po,
					networks n

					where 1=1
					and s.id = sp.station_id
					and n.id = s.network_id
					and sp.id = oc.sampling_point_id
					and reverse(split_part(reverse(oc.pollutant), '/', 1)) = po.id
					group by s.name, sp.id, oc.pollutant, n.name, oc.id, po.notation

) aa
inner join 
			(
					select o.sampling_point_id, MIN (o.from_time) as fromtime, MAX(o.from_time) as totime, reverse(split_part(reverse(o.concentration), '/', 1)) unit, reverse(split_part(reverse(o.timestep), '/', 1)) timestep
					from observations o
					group by o.sampling_point_id, reverse(split_part(reverse(o.concentration), '/', 1)), reverse(split_part(reverse(o.timestep), '/', 1))
			) oo
on aa.sp = oo.sampling_point_id
order by label
Assignee
Assign to
Time tracking