Created
January 29, 2021 20:24
-
-
Save kirkshoop/a6c7c29d1a8cce06b85a33b56280e082 to your computer and use it in GitHub Desktop.
Executive Orders by presidential term
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://vega.github.io/schema/vega-lite/v4.json", | |
"data": { "url": "https://www.federalregister.gov/api/v1/documents.json?conditions%5Bcorrection%5D=0&conditions%5Bpresidential_document_type%5D=executive_order&conditions%5Btype%5D%5B%5D=PRESDOCU&fields%5B%5D=citation&fields%5B%5D=document_number&fields%5B%5D=president&fields%5B%5D=type&fields%5B%5D=subtype&fields%5B%5D=publication_date&fields%5B%5D=signing_date&fields%5B%5D=title&fields%5B%5D=effective_on&fields%5B%5D=executive_order_number&per_page=1200", "format": { "type": "json", "property": "results"}}, | |
"transform": [ | |
{ "filter": "year(datum.publication_date) > 1996"}, | |
{ | |
"joinaggregate": [{ | |
"op": "min", | |
"field": "publication_date", | |
"as": "firstYear" | |
}], | |
"groupby": [ | |
"president.name" | |
] | |
}, | |
{ | |
"calculate": "year(datum.publication_date)-year(datum.firstYear) + 1", | |
"as": "yearInOffice" | |
}, | |
{ | |
"calculate": "ceil(datum.yearInOffice/4) + (month(datum.publication_date) == 0 && datum.yearInOffice > 4 ? -1 : 0)", | |
"as": "term" | |
}, | |
{ | |
"calculate": "((datum.term - 1) * 4) + year(datum.firstYear)", | |
"as": "firstYearInTerm" | |
}, | |
{ | |
"calculate": "datum.president.name + ' (' + datum.firstYearInTerm + '-' + (datum.firstYearInTerm + 3) + ')'", | |
"as": "president_term" | |
}], | |
"width": {"step": 20}, | |
"mark": "bar", | |
"encoding": { | |
"x": { | |
"aggregate": "count", "field": "subtype", | |
"title": "executive orders published", | |
"axis": {"grid": false} | |
}, | |
"y": { | |
"sort": {"field": "firstYear"}, | |
"field": "president_term", | |
"axis": {"title": ""} | |
}, | |
"color": { | |
"field": "president.name", | |
"title": "" | |
} | |
}, | |
"config": { | |
"view": {"stroke": "transparent"}, | |
"axis": {"domainWidth": 1} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment