Giter Site home page Giter Site logo

star-api's Introduction

Star-API

Category: Toolkit

Presentation URL: Presentation

API Endpoint: API

Dependencies

  1. Rvm, ruby, bundler
  2. Sqlite on development and Postgresql on production
  3. ElasticSearch to store search metadata

Setting up the Rails API

You need to clone repo, run

bundle install
rake db:migrate
rake parsers:milkyway:all
rake search:rebuild

The rake parser:milkyway:all rake task fetches the DU data set from http://research.amnh.org/users/abbott/dudata/ and stores it into Postgres.

The rake search:rebuild builds search index for all these data sets.

Features

  1. Available resources as REST get api: stars, exo_planets, local_groups, open clusters, constellations
  2. Paginated queries
  3. Search endpoint at /api/v1/search?q=<search query> to search for all available names and labels
  4. Filter queries like /api/v1/stars?min[distl]=10&max[distl]=20 finds all stars whose distl values are between 10 and 20. Its applicable to any comparable field available in response data of a particular resource

Examples query filters

  1. Run this query to filter only blue stars:
    http://star-api.herokuapp.com/api/v1/stars?min[colorb_v]=-1&max[colorb_v]=0
  2. To see only red stars: http://star-api.herokuapp.com/api/v1/stars?min[colorb_v]=0&max[colorb_v]=1
  3. To filter stars you can see with the naked yield: http://star-api.herokuapp.com/api/v1/stars?min[appmag]=-2.5&max[appmag]=6.5
  4. To see stars brighter than 7.5 mag: http://star-api.herokuapp.com/api/v1/stars?max[appmag]=7.5
  5. To see only the trig parallax stars: http://star-api.herokuapp.com/api/v1/stars?dcalc=1
  6. To see only the weighted mean stars: http://star-api.herokuapp.com/api/v1/stars?dcalc=2
  7. To see all the intrinsically bright stars: http://star-api.herokuapp.com/api/v1/stars?min[absmag]=10&max[absmag]=-3
  8. To see all the intrinsically faint stars: http://star-api.herokuapp.com/api/v1/stars?min[absmag]=0&max[absmag]=-3
  9. To see all stars within 100 light-years: http://star-api.herokuapp.com/api/v1/stars?max[distly]=100
  10. To see all stars within 500 light-years: http://star-api.herokuapp.com/api/v1/stars?max[distly]=500

star-api's People

Contributors

cmwalla avatar jdmcpeek avatar lskalkos avatar mik3caprio avatar nancyko avatar nicholalexander avatar surenm avatar wallyqs avatar zniazi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

star-api's Issues

Cannot show stars/1

I pushed code near the end of Saturday that fixes this and shows /stars/1 or constellations/1 etc. Please check that push.

Define Variables

Hi there, I am currently building an app that uses this API, and would like some clarification on variables. Surprisingly I cannot find much in the documentation. As far as I can tell:

absmag: "4.85" -------------- ABSOLUTE MAGNITUDE
appmag: "-26.72" ------------ APPARENT MAGNITUDE
colorb_v: "0.65" ------------ COLOUR
created_at: "49:09.3" ------- CREATED AT
dcalc: "0"
distance_light_years: "0" --- DISTANCE
hipnum: "0" ----------------- HIPPARCOS NUMBER
id: "53794" ----------------- UNIQUE ID
label: "Sun" ---------------- NAME
luminosity: "0.8913" -------- LUMINOSITY
plx: "0" -------------------- PARALLAX
plxerr: "0" ----------------- PARALLAX MARGIN OF ERROR
speed: "0" ------------------ SPEED
texnum: "1"
updated_at: "49:09.3" ------- UPDATED AT

Is this the case? Can you explain the dcalc and texnum variables? Also, the example filter section seems to indicate that for colorb_v, 0 is blue, 1 is red, but in reality the stars in the database range from -.63 to 2.057. Is this meant to indicate light being emitted outside the visible spectrum?

Also, I noticed another issue on here had to do with colour in RGB values. I only just saw this, but have already put together a function that receives the star's colorb_v value and interpolates it across a spectrum of possible star colours. I can share that if you'd like. Cheers!

Bad colorb_v data and absmag strangeness

Before I start, I am not an astronomer so the faults may lay on my side.

I tried to create a Hertzsprung–Russell diagram from all the 100,000+ stars you provide. But the data for colorv_b seems to be very unprecise as I get vertical stripes in the plot. Looking into the raw JSON I see that this value only has two digits behind the comma. Is there any chance we get better data?

hr

Second I found out that one particular star seems to have a wrong absmag or lum value (I would expect an exponential law, which would appear to be linear in a logarithmic plot). One point is quite some distance away from the line (absmag≈15.1 lum≈10^-2). Is this a mistake?

absmag

Cannot get all stars at once

Despite the very first example in the documentation implying that it's possible to fetch the entire database, it's not. I believe this is because of Socrata's limit of 1000 requests per hour(?). There's no point of having a database of 100k items if you can't fetch all of them simultaneously to facilitate client-side live searching, even if just on one variable - say "label". Suggestions?

Add support for JSONP

It would be awesome if you could add support for JSONP. Many APIs are starting to serve both JSON and JSONP nowadays. I would like to build an AngularJS app using this API and it would make it heaps easier.

The API appears to be down

The API appears to be down. Got the production general useless error message:

We're sorry, but something went wrong.

If you are the application owner check the logs for more information.

I get it with all the examples and direct links

refactor resources controller

hey guys!

i'd like to make a strong case to refactor the resources controller into individual controllers per resource. @zniazi 's recent pull request is a great example - we're going to be putting model specific logic in the controller and i'm afraid it's going to get crazy up in here, quick.

if we take it out of the context of the hackathon and look at it as an open source project that we want to maintain, i think the railsy way is the way to go. @surenm - can we have a vote or something?

Search is returning 500 Internal Server Error or Null

Hey HacktheUniverse team -- very cool project!

I am getting an interesting response when attempting to use the search endpoint. The documentation, for example, is returning:

$ curl http://star-api.herokuapp.com/api/v1/search?q=%22Sun%22
{"status":"500","error":"Internal Server Error"}

image

On the other hand, when I try a different search, like the star "HIP1 HD224700 Gli", a null response comes back:

$ curl http://star-api.herokuapp.com/api/v1/stars/search?q=%22HIP1%20HD224700%20Gli%22
null

image

Am I incorrectly forming the URL?

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.