Skip to content

Instantly share code, notes, and snippets.

View rajfal's full-sized avatar

Rafal Jacyna rajfal

View GitHub Profile
@rajfal
rajfal / soil-frequency-across-years.cql
Last active March 2, 2018 06:06
Summarize soil issue frequency across years
UNWIND [2007,2008, 2009, 2010, 2011, 2012, 2013, 2014] as years
MATCH (y:Year {year: years})-[:HAS_MONTH]->(m:Month )-[:HAS_DAY]->(d:Day)<-[r:REPORTED_ON]-()-[*1..2]-(n:Soil_Issue)
WITH y.year as Y, collect( n.type) as Issues
RETURN Y,
size(filter(x IN Issues WHERE x= 'Acidification')) as Acidification,
size(filter(x IN Issues WHERE x= 'Compaction')) as Compaction,
size(filter(x IN Issues WHERE x= 'Erosion')) as Erosion,
size(filter(x IN Issues WHERE x= 'HeavyMetalContamination')) as HeavyMetalContamination,
size(filter(x IN Issues WHERE x= 'HighAlkalinity')) as HighAlkalinity,
size(filter(x IN Issues WHERE x= 'Impermeable')) as Impermeable,