GithubHelp home page GithubHelp logo

Comments (3)

korlaxxalrok avatar korlaxxalrok commented on August 14, 2024

@krivard Do you have an example of how they are calling the API?

Assuming something like cURL to make requests, this is a cool example of using jq to format responses in CSV.

You'd pretty much pipe into jq with this bit of magic:

jq -r '.epidata | (map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @csv'

An ex. against our API (truncated a wee bit):

❯ curl -s -X GET "https://delphi.cmu.edu/epidata/api.php?source=covidcast&cached=true&data_source=jhu-csse&signal=confirmed_incidence_num&geo_type=county&time_values=20200501&time_type=day&geo_value=*&as_of=20200509" | jq -r '.epidata | (map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @csv'
"direction","geo_value","issue","lag","sample_size","stderr","time_value","value"
0,"01001",20200507,6,,,20200501,-2
0,"01003",20200507,6,,,20200501,1
0,"01005",20200507,6,,,20200501,3
0,"01007",20200507,6,,,20200501,0
0,"01009",20200507,6,,,20200501,2
0,"01011",20200507,6,,,20200501,1
0,"01013",20200507,6,,,20200501,12
0,"01015",20200507,6,,,20200501,-1
0,"01017",20200507,6,,,20200501,-5
0,"01019",20200507,6,,,20200501,0
0,"01021",20200507,6,,,20200501,-1
...

Redirected to a file and viewed in something fancy:
image

from delphi-epidata.

krivard avatar krivard commented on August 14, 2024

from delphi-epidata.

krivard avatar krivard commented on August 14, 2024

Fixed in #210

from delphi-epidata.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.