Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
fetched_api_nasa_gov = await soFetch('https://api.gsa.gov/analytics/dap/v1.1/domain/'+f1+'/reports/site/data?after='+date_last_month+'&api_key='+thing)
Insert cell
fetched_api_nasa_gov_json = fetched_api_nasa_gov.json()
Insert cell
Insert cell
function deDuplication(json_input){
var deplupicated_json = []
for (var i=0;i < json_input.length;i++){
if (json_input[i]['report_agency'] == "national-aeronautics-space-administration"){
deplupicated_json.push(json_input[i])
}
}
return deplupicated_json
}
Insert cell
fetched_api_nasa_gov_json_NoDups = deDuplication(fetched_api_nasa_gov_json)
Insert cell
Insert cell
md `## How About Total Visits Over That Period?`
Insert cell
total_visits = getTotalVisits(fetched_api_nasa_gov_json_NoDups,"visits")
Insert cell
function getTotalVisits(data,key){
var visits = 0
Array.prototype.sum = function (prop) {
var total = 0
for ( var i = 0, _len = this.length; i < _len; i++ ) {
total += this[i][prop]
}
return total
}
return data.sum(key)
}
Insert cell
Insert cell
Insert cell
Insert cell
d3 = require("d3@5")
Insert cell
import { soFetch } from '@alecglassford/so-fetch'
Insert cell
import {text} from "@jashkenas/inputs"
Insert cell
vegalite = require("@observablehq/vega-lite@0.1")
Insert cell
Inputs = require("@observablehq/inputs@0.7")
Insert cell
moment = require('moment')
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more