 ----------------------------------
 -- VIEWS AND MATERIALIZED VIEWS --
 ----------------------------------
+
 CREATE MATERIALIZED VIEW gn_profiles.vm_valid_profiles AS
 SELECT DISTINCT
 	t.cd_ref AS cd_ref,

	WHERE name='id_valid_status_for_profiles'
	)
GROUP BY t.cd_ref;

CREATE MATERIALIZED VIEW gn_profiles.vm_cor_taxon_phenology AS 
WITH classified_data AS (

from classified_data
;

CREATE UNIQUE INDEX ON gn_profiles.vm_cor_taxon_phenology (cd_ref, period);

CREATE VIEW gn_profiles.v_consistancy_data AS
SELECT 
