Commit dc35d6f8 authored by abuddenberg's avatar abuddenberg
Browse files

It's too bad she won't live, but then again who does?

parent f37eca43
name = "Webform Data Server"
description = "Provides RESTful endpoint for serving out Webform submissions"
core = "6.x"
version = "6.x-1.0"
dependencies[] = "tokenauth"
\ No newline at end of file
<?php
/**
* Created by IntelliJ IDEA.
* User: abuddenberg
* Date: 8/22/13
* Time: 11:58 AM
* To change this template use File | Settings | File Templates.
*/
/**
* Implementation of hook_help().
*/
function formsrv_help($path, $arg) {
$output = '';
switch ($path) {
case "admin/help#formsrv":
$output = '<p>'. t("Provides RESTful endpoint for serving out Webform submissions") .'</p>';
break;
}
return $output;
}
/**
* Implementation of hook_menu().
*/
function formsrv_menu() {
// $items['metadata/figures/all'] = array(
// 'page callback' => 'formsrv_figure_metadata_json',
// 'type' => MENU_CALLBACK,
// 'access arguments' => array('access content'),
// );
$items['metadata/figures'] = array(
'page callback' => 'formsrv_figure_metadata_json',
'type' => MENU_CALLBACK,
'access arguments' => array('access content'),
);
$items['metadata/list'] = array(
'page callback' => 'formsrv_figure_list_json',
'type' => MENU_CALLBACK,
'access arguments' => array('access content'),
);
return $items;
}
/**
* Renders a list of figure node IDs with a basic descriptions in JSON.
*/
function formsrv_figure_list_json(){
$q = <<<END
#Query to give brief listing and description of figures in Drupal
select
trim(figures.chapter_image_nid) as chapter_image_nid,
max(
case c.form_key
when 'what_is_the_figure_id' then trim(d.data) else NULL
end
) as figure_id,
max(
case c.form_key
when 'what_is_the_chapter_and_figure_number' then trim(d.data) else NULL
end
) as figure_num,
max(
case c.form_key
when 'what_is_the_name_of_the_figure_as_listed_in_the_report' then trim(d.data) else NULL
end
) as figure_name
from {webform_submitted_data} d
join {webform_component} c on d.nid = c.nid and d.cid = c.cid
join (
select
d.nid,
d.sid,
d.data as chapter_image_nid
from {webform_submitted_data} d
join {webform_component} c on d.nid = c.nid and d.cid = c.cid
where d.nid = (select nid from {node} where title = 'Figure Metadata')
and c.form_key ='nid'
) figures on d.nid = figures.nid and d.sid = figures.sid
where c.form_key in ('what_is_the_figure_id', 'what_is_the_name_of_the_figure_as_listed_in_the_report', 'what_is_the_chapter_and_figure_number')
group by figures.chapter_image_nid
order by figures.chapter_image_nid
END;
$list = array();
$result = db_query($q);
while($row = $result->fetch_assoc()){
$list[] = array(
'chapter_image_nid' => $row['chapter_image_nid'],
'figure_id' => $row['figure_id'],
'figure_num' => $row['figure_num'],
'figure_name' => $row['figure_name'],
'url' => url('metadata/figures/'.$row['chapter_image_nid'])
);
}
drupal_set_header('Content-Type: application/json');
echo json_encode($list);
// drupal_json($list);
}
/**
* Creates and populates a tree-like data structure of figures and images with their related datasources.
* If the node ID of the figure from trh
* Renders this data structure as JSON.
*/
function formsrv_figure_metadata_json($image_nid_query = 'all'){
// drupal_json(node_load(1314));
$map = formsrv_get_chapter_image_map();
//Filter out figures we don't care about
if($image_nid_query != 'all'){
$map = array_intersect_key($map, array($image_nid_query => 1));
}
foreach($map as $chapter_image_nid => $figure){
foreach($figure as $section => $list_ids){
foreach($list_ids as $index => $ids){
$form_node_id = $ids['nid'];
$submission_id = $ids['sid'];
$map[$chapter_image_nid][$section][$index] = formsrv_get_form_data($form_node_id , $submission_id);
//So much for a functional design...
//Grab the path to the figure in Drupal from its node ID
if($section == 'figure'){
$chapter_image = node_load($chapter_image_nid);
$map[$chapter_image_nid][$section][$index]['path'] = url('system/files/'.$chapter_image->field_chapter_image_image[0]['filename']);
}
//Add datasource section to images; might need to expand this to figures as well
if($section == 'images'){
$map[$chapter_image_nid][$section][$index]['datasources'] = formsrv_get_datasources_for_image($submission_id);
}
}
}
}
drupal_set_header('Content-Type: application/json');
echo json_encode($map);
// drupal_json($map);
}
/**
* Create a basic tree-like structure of figures and images with their identifiers.
* We'll replace the identifiers with actual data from the database in another function.
*/
function formsrv_get_chapter_image_map(){
$q = <<<END
select
n.nid as form_nid,
n.title as section,
d.sid as form_submission_id,
trim(d.data) as chapter_image_nid
from (
select
nid,
case title
when 'Image Metadata' then 'images'
when 'Figure Metadata' then 'figure'
end as title
from {node}
where title in ('Image Metadata', 'Figure Metadata')
) n
join {webform_submitted_data} d on n.nid = d.nid
join {webform_component} c on n.nid = c.nid and d.cid = c.cid
where c.form_key = 'nid'
order by chapter_image_nid, d.sid
END;
$map = array();
$result = db_query($q);
while($row = $result->fetch_assoc()){
$map[$row['chapter_image_nid']][$row['section']][] = array('nid' => $row['form_nid'], 'sid' => $row['form_submission_id']);
}
return $map;
}
/**
* Returns a populated list of datasources for the given image.
*/
function formsrv_get_datasources_for_image($image_sid){
$q = <<<END
#Query to get datasource information for an image
select
d.nid,
d.sid
from webform_submitted_data d
join webform_component c on d.nid = c.nid and d.cid = c.cid
where d.nid = (select nid from node where title = 'Data Source Metadata')
and c.form_key = 'image_metadata_sid'
and d.data = %d;
END;
$datasources = array();
$result = db_query($q, $image_sid);
while($row = $result->fetch_assoc()){
$datasources[] = formsrv_get_form_data($row['nid'], $row['sid']);
}
return $datasources;
}
/**
* Returns a map of field-value pairs of webform submission data.
* Parameters:
* $form_node_id: the node ID of the webform
* $submission_id: the submission ID within the given webform to get
*/
function formsrv_get_form_data($form_node_id, $submission_id) {
$q = <<<END
select
# d.sid,
trim(c.form_key) as k,
# c.name,
trim(d.data) as v
from {webform_submitted_data} d
join {webform_component} c on d.nid = c.nid and d.cid = c.cid
where d.nid = %d
and d.sid = %d
order by c.pid, c.weight
END;
$form_data = array();
$result = db_query($q, $form_node_id, $submission_id);
while($row = $result->fetch_assoc()){
$form_data[$row['k']] = $row['v'];
}
return $form_data;
}
......@@ -2,379 +2,379 @@ from collections import OrderedDict
sync_metadata_tree = {
'noaa-led-state-summaries-2017': OrderedDict([
('alabama', [
('/metadata/figures/3819', 'al-observed-and-projected-temperature-change', '1'),
('/metadata/figures/3817', 'al-observed-number-of-very-hot-days', '2a'),
('/metadata/figures/3818', 'al-observed-number-of-very-warm-nights', '2b'),
('/metadata/figures/3815', 'al-observed-annual-precipitation', '2c'),
('/metadata/figures/4036', 'al-total-hurricane-events-in-alabama-1900-2013', '2d'),
('/metadata/figures/3816', 'al-observed-number-of-extreme-precipitation-events', '3'),
('/metadata/figures/3820', 'al-projected-change-in-spring-precipitation', '4'),
('/metadata/figures/3821', 'al-past-and-projected-changes-in-global-sea-level', '5')
]),
('alaska', [
('', 'ak-observed-and-projected-temperature-change', '1'),
('', 'ak-observed-summer-temperature', '2'),
('', 'ak-observed-winter-temperature', '3a'),
('', 'ak-observed-number-of-warm-days', '3b'),
('', 'ak-observed-summer-precipitation', '3c'),
('', 'ak-observed-number-of-extreme-precipitation-events', '3d'),
('', 'ak-observed-number-of-very-cold-nights', '4'),
('', 'ak-observed-annual-precipitation', '5'),
('', 'march-and-september-arctic-sea-ice-extent', '6'),
('', 'ak-past-and-projected-changes-in-global-sea-level', '7'),
('', 'ak-projected-change-in-annual-precipitation', '8')
]),
('arizona', [
('/metadata/figures/3676', 'az-observed-and-projected-temperature-change', '1'),
('/metadata/figures/3672', 'az-observed-number-of-extremely-hot-days', '2a'),
('/metadata/figures/3670', 'az-observed-maximum-summer-temperature', '2b-1'),
('/metadata/figures/4083', 'az-observed-minimum-summer-temperature', '2b-2'),
('/metadata/figures/3668', 'az-observed-annual-precipitation', '2c'),
('/metadata/figures/3673', 'az-observed-number-of-extreme-precipitation-events', '2d'),
('/metadata/figures/3674', 'az-observed-number-of-extremely-warm-nights', '3'),
('/metadata/figures/3675', 'az-observed-number-of-very-cold-nights', '4'),
('/metadata/figures/3671', 'az-observed-monsoon-season-precipitation', '5'),
('/metadata/figures/3903', 'arizona-palmer-drought-severity-index', '6'),
('/metadata/figures/3890', 'az-lake-mead-water-level-at-hoover-dam', '7'),
('/metadata/figures/3677', 'az-projected-change-in-spring-precipitation', '8')
]),
('arkansas', [
('/metadata/figures/3954', 'ar-observed-and-projected-temperature-change', '1'),
('/metadata/figures/3840', 'ar-observed-number-of-extremely-hot-days', '2a'),
('/metadata/figures/3842', 'ar-observed-number-of-very-cold-nights', '2b'),
('/metadata/figures/3839', 'ar-observed-annual-precipitation', '2c'),
('/metadata/figures/3844', 'ar-observed-summer-precipitation', '2d'),
('/metadata/figures/3843', 'ar-observed-number-of-very-warm-nights', '3'),
('/metadata/figures/3845', 'ar-observed-summer-temperature', '4'),
('/metadata/figures/3841', 'ar-observed-number-of-extreme-precipitation-events', '5'),
('/metadata/figures/3846', 'ar-projected-change-in-winter-precipitation', '6')
]),
('california', [
('/metadata/figures/4086', 'ca-observed-and-projected-temperature-change', '1'),
('/metadata/figures/4090', 'ca-observed-number-of-extremely-hot-days', '2a'),
('/metadata/figures/4094', 'ca-observed-annual-precipitation', '2b'),
('/metadata/figures/4089', 'ca-observed-number-of-extreme-precipitation-events', '2c'),
('/metadata/figures/4095', 'ca-observed-winter-precipitation', '2d'),
('/metadata/figures/4092', 'ca-observed-number-of-very-warm-nights', '3'),
('', 'ca-observed-number-of-cold-nights', '4'),
('', 'april-1-snow-water-equivalent-at-donner-summit', '5'),
('/metadata/figures/4088', 'ca-storage-levels-in-the-shasta-dam-reservoir', '6'),
('/metadata/figures/4096', 'california-palmer-drought-severity-index', '7'),
('/metadata/figures/4093', 'ca-projected-change-in-winter-precipitation', '8'),
('/metadata/figures/4084', 'ca-past-and-projected-changes-in-global-sea-level', '9'),
('', 'observed-and-projected-annual-number-of-tidal-floods-for-la-jolla-and-san-francisco-ca', '10')
]),
('colorado', [
('/metadata/figures/3695', 'co-observed-and-projected-temperature-change', '1'),
('/metadata/figures/3697', 'co-observed-spring-temperature', '2a'),
('/metadata/figures/3698', 'co-observed-summer-temperature', '2b'),
('/metadata/figures/3693', 'co-observed-number-of-very-hot-days', '3'),
('/metadata/figures/3691', 'co-observed-number-of-very-cold-nights', '4'),
('/metadata/figures/3694', 'co-observed-number-of-warm-nights', '5a'),
('/metadata/figures/3689', 'co-observed-annual-precipitation', '5b'),
('/metadata/figures/3690', 'co-observed-fall-precipitation', '5c-1'),
('/metadata/figures/3696', 'co-observed-spring-precipitation', '5c-2'),
('/metadata/figures/3692', 'co-observed-number-of-extreme-precipitation-events', '5d'),
('/metadata/figures/3893', 'co-end-of-season-snow-water-equivalent-depth-at-tower', '6'),
('/metadata/figures/3699', 'co-projected-change-in-winter-precipitation', '7'),
('/metadata/figures/3902', 'colorado-palmer-drought-severity-index', '8')
]),
('connecticut', [
('/metadata/figures/4060', 'ct-observed-and-projected-temperature-change', '1'),
('/metadata/figures/4082', 'ct-observed-number-of-very-hot-days', '2a'),
('/metadata/figures/3848', 'ct-observed-number-of-extreme-precipitation-events', '2b'),
('/metadata/figures/3847', 'ct-observed-annual-precipitation', '2c'),
('/metadata/figures/3852', 'ct-observed-summer-precipitation', '2d'),
('/metadata/figures/3851', 'ct-observed-number-of-warm-nights', '3'),
('/metadata/figures/3849', 'ct-observed-number-of-very-cold-nights', '4'),
('/metadata/figures/3853', 'ct-projected-change-in-spring-precipitation', '5'),
('', 'observed-and-projected-annual-number-of-tidal-floods-new-london-ct', '6'),
('/metadata/figures/3876', 'ct-past-and-projected-changes-in-global-sea-level', '7')
]),
('delaware', [
('/metadata/figures/3761', 'de-observed-and-projected-temperature-change', '1'),
('/metadata/figures/3759', 'de-observed-number-of-very-hot-days', '2a'),
('/metadata/figures/3757', 'de-observed-number-of-days-below-freezing', '2b'),
('/metadata/figures/3756', 'de-observed-annual-precipitation', '2c'),
('/metadata/figures/3758', 'de-observed-number-of-extreme-precipitation-events', '2d'),
('/metadata/figures/3760', 'de-observed-number-of-very-warm-nights', '3'),
('', 'de-change-in-annual-precipitation', '4'),
('', 'observed-and-projected-annual-number-of-tidal-floods-lewes-de', '5'),
('/metadata/figures/3830', 'de-past-and-projected-changes-in-global-sea-level', '6')
]),
('florida', [
('/metadata/figures/3767', 'fl-observed-and-projected-temperature-change', '1'),
('/metadata/figures/3765', 'fl-observed-number-of-very-hot-days', '2a'),
('/metadata/figures/3951', 'fl-observed-number-of-nights-below-freezing', '2b'),
('/metadata/figures/3763', 'fl-observed-annual-precipitation', '2c'),
('', 'total-hurricane-events-in-florida', '2d'),
('/metadata/figures/3766', 'fl-observed-number-of-very-warm-nights', '3'),
('', 'average-annual-number-of-days-with-a-minimum-temperature-less-than-or-equal-to-32', '4'),
('/metadata/figures/3764', 'fl-observed-number-of-extreme-precipitation-events', '5'),
('/metadata/figures/3768', 'fl-projected-change-in-summer-precipitation', '6'),
('', 'observed-and-projected-annual-number-of-tidal-floods-key-west-fl', '7'),
('', 'fl-past-and-projected-changes-in-global-sea-level', '8')
]),
('georgia', [
('/metadata/figures/3774', 'ga-observed-and-projected-temperature-change', '1'),
('/metadata/figures/3771', 'ga-observed-number-of-extremely-hot-days', '2a'),
('/metadata/figures/3770', 'ga-observed-number-of-days-below-freezing', '2b'),
('/metadata/figures/3775', 'ga-observed-summer-precipitation', '2c'),
('/metadata/figures/3772', 'ga-observed-number-of-extreme-precipitation-events', '2d'),
('/metadata/figures/3773', 'ga-observed-number-of-very-warm-nights', '3'),
('/metadata/figures/3769', 'ga-observed-annual-precipitation', '4'),
('', 'ga-projected-change-in-annual-precipitation', '5'),
('/metadata/figures/3825', 'ga-past-and-projected-changes-in-global-sea-level', '6'),
('', 'observed-and-projected-annual-number-of-tidal-floods-fort-pulaski-ga', '7')
]),
('hawaii', [
('', 'hi-observed-and-projected-temperature-change', '1'),
('', 'hi-observed-temperature-change', '2'),
('', 'hi-observed-number-of-hot-days', '3'),
('', 'hi-observed-number-of-very-warm-nights', '4'),
('', 'time-series-of-hri-anomalies', '5'),
('', 'hi-observed-precipitation-change', '6'),
('', 'hi-observed-number-of-extreme-precipitation-events', '7'),
('', 'hi-projected-change-in-annual-precipitation', '8'),
('/metadata/figures/4108', 'hi-past-and-projected-changes-in-global-sea-level', '9'),
('', 'observed-and-projected-annual-number-of-tidal-floods-honolulu-hi', '10')
]),
('idaho', [
('/metadata/figures/3645', 'id-observed-and-projected-temperature-change', '1'),
('/metadata/figures/3647', 'id-observed-number-of-very-hot-days', '2'),
('/metadata/figures/3649', 'id-observed-number-of-warm-nights', '3'),
('/metadata/figures/3648', 'id-observed-number-of-very-cold-nights', '4'),
('/metadata/figures/3646', 'id-observed-annual-precipitation', '5'),
('/metadata/figures/3650', 'id-observed-number-of-extreme-precipitation-events', '6'),
('', 'april-1-snow-water-equivalent-at-camp-creek-id', '7'),
('/metadata/figures/3651', 'id-projected-change-in-spring-precipitation', '8')
# ('/metadata/figures/3906', 'end-of-season-snow-water-equivalent-depth-at-bear-mountain', '9') #Not used?
]),
('illinois', [
('/metadata/figures/3663', 'il-observed-and-projected-temperature-change', '1'),
('/metadata/figures/3664', 'il-observed-spring-temperature', '2a'),
('/metadata/figures/3666', 'il-observed-summer-temperature', '2b'),
('/metadata/figures/3661', 'il-observed-number-of-very-hot-days', '3a'),
('/metadata/figures/3662', 'il-observed-number-of-very-warm-nights', '3b'),
('/metadata/figures/3660', 'il-observed-number-of-very-cold-nights', '3c'),
('/metadata/figures/3832', 'il-observed-annual-precipitation', '3d'),
('/metadata/figures/3946', 'il-observed-spring-precipitation', '4a'),
('/metadata/figures/3665', 'il-observed-summer-precipitation', '4b'),
('/metadata/figures/3659', 'il-observed-number-of-extreme-precipitation-events', '5'),
('/metadata/figures/3947', 'il-annual-lake-wide-average-water-levels-for-lake-michigan-huron', '6'),
('', 'il-hours-of-heat-index-over-threshold-values', '7'),
('/metadata/figures/3667', 'il-projected-change-in-spring-precipitation', '8')
]),
('indiana', [
('/metadata/figures/3683', 'in-observed-and-projected-temperature-change', '1'),
('/metadata/figures/3685', 'in-observed-spring-temperature', '2a-1'),
('/metadata/figures/3687', 'in-observed-summer-temperature', '2a-2'),
('/metadata/figures/3681', 'in-observed-number-of-very-hot-days', '2b'),
('/metadata/figures/3682', 'in-observed-number-of-very-warm-nights', '2c'),
('/metadata/figures/3684', 'in-observed-spring-precipitation', '2d-1'),
('/metadata/figures/3686', 'in-observed-summer-precipitation', '2d-2'),
('/metadata/figures/3680', 'in-observed-number-of-very-cold-nights', '3'),
('/metadata/figures/3678', 'in-observed-annual-precipitation', '4'),
('/metadata/figures/3679', 'in-observed-number-of-extreme-precipitation-events', '5'),
('', 'in-annual-lake-wide-average-water-levels-for-lake-michigan-huron', '6'),
('/metadata/figures/3688', 'in-projected-change-in-spring-precipitation', '7')
]),
('iowa', [
('/metadata/figures/3700', 'ia-observed-and-projected-temperature-change', '1'),
('/metadata/figures/3706', 'ia-observed-summer-temperature', '2a'),
('/metadata/figures/3703', 'ia-observed-number-of-very-hot-days', '2b'),
('/metadata/figures/3704', 'ia-observed-number-of-very-warm-nights', '2c'),
('/metadata/figures/3702', 'ia-observed-number-of-very-cold-nights', '2d'),
('/metadata/figures/3705', 'ia-observed-spring-precipitation', '3a'),
('/metadata/figures/3814', 'ia-observed-summer-precipitation', '3b'),
('/metadata/figures/3708', 'ia-observed-annual-precipitation', '4'),
('/metadata/figures/3701', 'ia-observed-number-of-extreme-precipitation-events', '5'),
('/metadata/figures/3707', 'ia-projected-change-in-spring-precipitation', '6')
]),
('kansas', [
('/metadata/figures/3601', 'ks-observed-and-projected-temperature-change', '1'),
('/metadata/figures/3607', 'ks-observed-spring-temperature', '2a'),
('/metadata/figures/3609', 'ks-observed-summer-temperature', '2b'),
('/metadata/figures/3604', 'ks-observed-number-of-very-warm-nights', '3a'),
('/metadata/figures/3603', 'ks-observed-number-of-extremely-hot-days', '3b'),
('/metadata/figures/3627', 'ks-observed-annual-precipitation', '3c'),
('/metadata/figures/3606', 'ks-observed-spring-precipitation', '3d-1'),
('/metadata/figures/3608', 'ks-observed-summer-precipitation', '3d-2'),
('/metadata/figures/3602', 'ks-observed-number-of-very-cold-nights', '4'),
('/metadata/figures/3605', 'ks-observed-number-of-extreme-precipitation-events', '5'),
('/metadata/figures/3904', 'kansas-palmer-drought-severity-index', '6'),
('/metadata/figures/3610', 'ks-projected-change-in-summer-precipitation', '7')
]),
('kentucky', [
('/metadata/figures/3782', 'ky-observed-and-projected-temperature-change', '1'),
('/metadata/figures/3778', 'ky-observed-number-of-extremely-hot-days', '2a'),
('/metadata/figures/3785', 'ky-observed-winter-temperature', '2b-a'),
('/metadata/figures/3784', 'ky-observed-summer-temperature', '2b-b'),
('/metadata/figures/3777', 'ky-observed-annual-precipitation', '2c'),
('/metadata/figures/3783', 'ky-observed-summer-precipitation', '2d'),
('/metadata/figures/3780', 'ky-observed-number-of-very-cold-nights', '3'),
('/metadata/figures/3781', 'ky-observed-number-of-very-warm-nights', '4'),
('/metadata/figures/3779', 'ky-observed-number-of-extreme-precipitation-events', '5'),
('/metadata/figures/3786', 'ky-projected-change-in-spring-precipitation', '6')
]),
('louisiana', [
('/metadata/figures/3793', 'la-observed-and-projected-temperature-change', '1'),
('/metadata/figures/3791', 'la-observed-number-of-very-hot-days', '2a'),
('/metadata/figures/3790', 'la-observed-number-of-days-below-freezing', '2b'),
('/metadata/figures/3794', 'la-observed-spring-precipitation', '2c-1'),
('/metadata/figures/3788', 'la-observed-fall-precipitation', '2c-2'),
('/metadata/figures/3789', 'la-observed-number-of-extreme-precipitation-events', '2d'),
('/metadata/figures/3792', 'la-observed-number-of-very-warm-nights', '3'),
('/metadata/figures/3787', 'la-observed-annual-precipitation', '4'),
('', 'total-hurricane-events-in-louisiana', '5'),
('', 'storm-surge-heights-in-louisiana', '6'),
('/metadata/figures/3795', 'la-projected-change-in-summer-precipitation', '7'),
('/metadata/figures/3833', 'la-past-and-projected-changes-in-global-sea-level', '8')
]),
('maine', [
('/metadata/figures/3961', 'me-observed-and-projected-temperature-change', '1'),
('/metadata/figures/3969', 'me-observed-winter-temperature', '2a-1'),
('/metadata/figures/3968', 'me-observed-summer-temperature', '2a-2'),
('/metadata/figures/3966', 'me-observed-number-of-hot-days', '2b'),
('/metadata/figures/3964', 'me-observed-annual-precipitation', '2c'),
('', 'me-change-in-precipitation-by-county', '2d'),
('/metadata/figures/3967', 'me-observed-number-of-very-cold-nights', '3'),
('/metadata/figures/3965', 'me-observed-number-of-extreme-precipitation-events', '4'),
('/metadata/figures/3962', 'me-projected-change-in-winter-precipitation', '5'),
('/metadata/figures/4112', 'me-past-and-projected-changes-in-global-sea-level', '6')
]),
('maryland', [
('/metadata/figures/3801', 'md-observed-and-projected-temperature-change', '1'),
('/metadata/figures/3799', 'md-observed-number-of-very-hot-days', '2a'),
('/metadata/figures/3800', 'md-observed-number-of-very-warm-nights', '2b'),
('/metadata/figures/3798', 'md-observed-number-of-very-cold-nights', '2c'),
('/metadata/figures/3796', 'md-observed-annual-precipitation', '2d'),
('', 'very-warm-and-extremely-hot-days-in-washington-dc', '3'),
('/metadata/figures/3797', 'md-observed-number-of-extreme-precipitation-events', '4'),
('', 'md-projected-change-in-annual-precipitation', '5'),
('', 'observed-and-projected-annual-number-of-tidal-floods-baltimore-md', '6'),
('/metadata/figures/4059', 'md-past-and-projected-changes-in-global-sea-level', '7')
]),
('massachusetts', [
('/metadata/figures/4010', 'ma-observed-and-projected-temperature-change', '1'),
('/metadata/figures/4051', 'ma-observed-number-of-hot-days', '2a'),
('/metadata/figures/4054', 'ma-observed-number-of-extreme-precipitation-events', '2b'),
('/metadata/figures/4056', 'ma-observed-annual-precipitation', '2c'),
('/metadata/figures/4057', 'ma-observed-summer-precipitation', '2d'),
('/metadata/figures/4052', 'ma-observed-number-of-warm-nights', '3'),
('/metadata/figures/4055', 'ma-observed-number-of-very-cold-nights', '4'),
('/metadata/figures/4011', 'ma-projected-change-in-spring-precipitation', '5'),
('', 'observed-and-projected-annual-number-of-tidal-floods-boston-ma', '6'),
('/metadata/figures/4058', 'ma-past-and-projected-changes-in-global-sea-level', '7')
]),
('michigan', [
('/metadata/figures/3709', 'mi-observed-and-projected-temperature-change', '1'),
('/metadata/figures/3712', 'mi-observed-number-of-hot-days', '2a'),
('/metadata/figures/3714', 'mi-observed-number-of-warm-nights', '2b'),
('/metadata/figures/3713', 'mi-observed-number-of-very-cold-nights', '2c'),
('/metadata/figures/3710', 'mi-observed-annual-precipitation', '2d'),
('/metadata/figures/3711', 'mi-observed-number-of-extreme-precipitation-events', '3'),
('/metadata/figures/3955', 'mi-annual-lake-wide-average-water-levels-for-lake-michigan-huron', '4'),
('/metadata/figures/3715', 'mi-projected-change-in-winter-precipitation', '5')
]),
('minnesota', [
('/metadata/figures/3611', 'mn-observed-and-projected-temperature-change', '1'),
('/metadata/figures/3613', 'mn-observed-number-of-hot-days', '2a'),
('/metadata/figures/3615', 'mn-observed-number-of-very-warm-nights', '2b'),
('/metadata/figures/3952', 'mn-observed-number-of-very-cold-days', '2c'),
('/metadata/figures/3616', 'mn-observed-number-of-extreme-precipitation-events', '2d'),
('', 'ice-out-dates-on-lake-osakis', '3'),
('/metadata/figures/3612', 'mn-observed-annual-precipitation', '4'),#DUPE
# ('/metadata/figures/3614', 'mn-observed-annual-precipitation', '4'),#DUPE
('', 'number-of-extreme-heat-events-by-county', '5'),
('/metadata/figures/3617', 'mn-projected-change-in-spring-precipitation', '6')
]),
('mississippi', [
('/metadata/figures/3948', 'ms-observed-and-projected-temperature-change', '1'),
('/metadata/figures/3856', 'ms-observed-number-of-extremely-hot-days', '2a'),
('/metadata/figures/3858', 'ms-observed-number-of-days-below-freezing', '2b'),
('/metadata/figures/3855', 'ms-observed-annual-precipitation', '2c'),
('/metadata/figures/3860', 'ms-observed-summer-precipitation', '2d'),
('/metadata/figures/3859', 'ms-observed-number-of-very-warm-nights', '3'),
('/metadata/figures/3861', 'ms-observed-summer-temperature', '4'),
('/metadata/figures/3857', 'ms-observed-number-of-extreme-precipitation-events', '5'),
('', 'storm-surge-heights-at-pass-christian', '6'),
('/metadata/figures/3862', 'ms-projected-change-in-summer-precipitation', '7'),
('/metadata/figures/3877', 'ms-past-and-projected-changes-in-global-sea-level', '8')
]),
('missouri', [
('/metadata/figures/3810', 'mo-observed-and-projected-temperature-change', '1'),
('/metadata/figures/3812', 'mo-observed-summer-temperature', '2a'),
('/metadata/figures/3804', 'mo-observed-maximum-summer-temperature', '2b'),
('/metadata/figures/3805', 'mo-observed-minimum-summer-temperature', '2c'),
('/metadata/figures/3806', 'mo-observed-number-of-extremely-hot-days', '3a'),
('/metadata/figures/3808', 'mo-observed-number-of-very-cold-nights', '3b'),
('/metadata/figures/3803', 'mo-observed-annual-precipitation', '3c'),
('/metadata/figures/3811', 'mo-observed-summer-precipitation', '3d'),
('/metadata/figures/3809', 'mo-observed-number-of-very-warm-nights', '4'),
('/metadata/figures/3807', 'mo-observed-number-of-extreme-precipitation-events', '5'),
('/metadata/figures/3813', 'mo-projected-change-in-spring-precipitation', '6')
]),
('montana', [
('/metadata/figures/3723', 'mt-observed-and-projected-temperature-change', '1'),
('/metadata/figures/3726', 'mt-observed-number-of-very-hot-days', '2a'),
('/metadata/figures/3727', 'mt-observed-number-of-warm-nights', '2b'),
('/metadata/figures/3724', 'mt-observed-annual-precipitation', '2c'),
('/metadata/figures/3731', 'mt-observed-number-of-extreme-precipitation-events', '2d'),
('/metadata/figures/3725', 'mt-observed-number-of-very-cold-days', '3'),
('/metadata/figures/3729', 'mt-observed-winter-temperature', '4a'),
('/metadata/figures/3728', 'mt-observed-summer-temperature', '4b'),
('/metadata/figures/3907', 'end-of-season-snow-water-equivalent-depth-at-noisy-basin', '5'),
('/metadata/figures/3730', 'mt-projected-change-in-spring-precipitation', '6'),
]),
('nebraska', [
('/metadata/figures/4024', 'ne-observed-and-projected-temperature-change', '1'),
('/metadata/figures/3870', 'ne-observed-winter-temperature', '2a'),
('/metadata/figures/3869', 'ne-observed-summer-temperature', '2b'),
('/metadata/figures/3864', 'ne-observed-number-of-extremely-hot-days', '3a'),
('/metadata/figures/3867', 'ne-observed-number-or-warm-nights', '3b'),
('/metadata/figures/3863', 'ne-observed-annual-precipitation', '3c'),
('/metadata/figures/3868', 'ne-observed-summer-precipitation', '3d'),
('/metadata/figures/3866', 'ne-observed-number-of-very-cold-nights', '4'),
('/metadata/figures/3865', 'ne-observed-number-of-extreme-precipitation-events', '5'),
('/metadata/figures/3871', 'ne-projected-change-in-winter-precipitation', '6'),
]),
('nevada', [
('/metadata/figures/3949', 'nv-observed-and-projected-temperature-change', '1'),
('/metadata/figures/3873', 'nv-observed-number-of-very-hot-days', '2'),
('/metadata/figures/3874', 'nv-observed-number-of-warm-nights', '3'),
('/metadata/figures/3872', 'nv-observed-annual-precipitation', '4'),
('/metadata/figures/3905', 'nevada-palmer-drought-severity-index', '5'),
('/metadata/figures/3891', 'nv-lake-mead-elevation-at-hoover-dam', '6'),
('', 'april-1-snow-water-equivalent-at-mt-rose-nv', '7'),
('', 'lake-tahoe-water-levels', '8'),
('', 'nv-projected-change-in-annual-precipitation', '9')
# ('/metadata/figures/3892', 'nv-end-of-season-snow-water-equivalent-depth-at-big-creek-summit', '7'), #Not used?
]),