Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

Digital Analytics Program

digital-analytics-program.livemd

Digital Analytics Program

Mix.install([
  {:httpoison, "~> 2.2"},
  {:jason, "~> 1.4"},
  {:kino_explorer, "~> 0.1.15"}
])

Section

# Enter your open.data.gov API Key as a Livebook Secret named "API_DATA_GOV_KEY"
# For reference on Livebook secrets - https://www.youtube.com/watch?v=laG04lxagZI
{:ok, api_key} = System.fetch_env("LB_API_DATA_GOV_KEY")
# Specify which DAP environment to fetch data from

# environment = "develop"
# environment = "staging"
# production has a blank path
environment = ""
url =
  "https://api.gsa.gov/analytics/dap/#{environment}/v1.1/reports/language/data?api_key=#{api_key}"
%{body: body} = HTTPoison.get!(url)
json = Jason.decode!(body)
require Explorer.DataFrame
json |> Explorer.DataFrame.new(lazy: true) |> Explorer.DataFrame.group_by("language")