inaturalist / inaturalistapi Goto Github PK
View Code? Open in Web Editor NEWNode.js API for iNaturalist.org
Home Page: https://api.inaturalist.org/
Node.js API for iNaturalist.org
Home Page: https://api.inaturalist.org/
Compare the created_at value for Identification 5624697 in http://www.inaturalist.org/observations/2882743.json (2016-04-04T19:56:15.679-07:00) with http://api.inaturalist.org/v1/observations/2882743 (2016-04-05T09:56:15+00:00). The node API seems to be showing a created at date a few hours in the future of the real date.
like the "X-Deleted-Observations" header from rails
Requested in uber ticket #23
{"error":"[search_parse_exception] No mapping found for [created_at] in order to sort on","status":400}
from @loarie
"probably only represents .00001% of obs so prob not worth fixing, but for the record looks like 'unknown' 'obscured' markers aren't transparent"
We'll need more info for the new taxon page, namely:
http://api.inaturalist.org/v1/observations?taxon_id=120720&per_page=1&return_bounds=true
returns:
total_bounds: {
swlat: 0,
swlng: 0,
nelat: 48.29173003323376,
nelng: -114.05738635919988
}
and http://api.inaturalist.org/v1/observations?taxon_id=42220&per_page=1&return_bounds=true
returns:
total_bounds: {
swlat: 0,
swlng: -135.98853785544634,
nelat: 62.13262579869479,
nelng: 0
}
At least test it. The query to load this count to put it into the index is slow, and we might be able to do it at query time reasonably fast and save the indexing overhead. Alternatively, refactor how we fetch the count so there's minimal cost at index time
something like -- https://api.inaturalist.org/v1/observations/species_counts?page=2
API doesn't seem to get the page param -- other params are working... just not "page"
for projects that are attached to places that have bounding boxes, it would be great to know the bounding box. if we had this, when a user searched in the explore tab for a project, we could zoom the map to show the project boundaries. as the api currently exists, we can only zoom the user to the center of the project, since all we have now is latitude/longitude.
something like this would be required to fully satisfy this iOS issue: inaturalist/INaturalistIOS#149
Or equivalent.
role
param that can be be curator
to return all curators, managers, and the owner (all have curator privileges) and manager
to return just the managers and the owner`Right now, when we fetch a project directly, such as http://api.inaturalist.org/v1/projects/642, we get the location information as latitude
and longitude
fields. However, when we get a project as part of an observation, such as http://api.inaturalist.org/v1/observations/7223196, we get the location information as a comma separated location
field.
It would be great if these could be the same, so every time we get a project from the API, we can use the same mapping to parse it.
E.g. responses to /v1/taxa/12345 should include
so we can display this on the taxon page. Note that provider stuff are present as columns in the taxa table, while Sources are in another table.
Patrick recommends stuffing these things in the ES index since it doesn't change much and configure ES not to index those attributes, just return them.
Some more notes from Patrick:
what I've tended to do for some user stuff is add a simple representation of the user to the index (just ID and login, usually for search), then use methods like
ESModel.fetchBelongsTo
to fetch full users from the ES index using the IDs at query time (edited)it's all a little hacky right now, but generally I try to lookup models once. For example in https://github.com/inaturalist/iNaturalistAPI/blob/master/lib/models/observation.js#L82 it's loading users for many different instances so it all happens in a single query. We're making those User calls anyway for most requests (not sure about taxon show though)
I'm thinking something like without_term_id=12
to return all observations that have not been annotated with Plant Phenology
, and without_term_value_id=13
to get all observations that have not been annotated with Plant Phenology=Flowering
.
- need a way to know what's new in for this user on the my observations tab
- the red chatboxes on the Me tab
and "nice to have"
- directly presentable information
- i.e. "@kueda commented: 'get the fuck out!' on your observation"
or "@loarie identified your observation as a stupid human"
- this would allow us to show these updates in the news tab
Requested in uber ticket #23
As part of my work to replace Reskit/CoreData with Mantle/Realm, I'd like to use the node API for pretty much everything in the app, so the transition sorta becomes RestKit/CoreData/Rails -> Mantle/Realm/Node.
Really Kinda Need It
Nice to have
Recent taxa mostly works, e.g.
place_id=2319
url = "http://api.inaturalist.org/v1/identifications/recent_taxa?place_id=#{place_id}&category=improving,leading&hrank=species"
uri = URI(url)
response = Net::HTTP.get(uri); nil
dat = JSON.parse(response); nil
dat["results"].map{|a| a["identification"]["observation"]["id"]}.uniq[0..10]
=> [6909037, 6908870, 6842626, 6842589, 6842401, 6122400, 365437, 6066024, 6066124, 6012523, 6048083]
but occasionally returns identifications that seem to be of commonly observed species (rather than 'firsts'), for example those IDs on these obs:
http://www.inaturalist.org/observations/6842626
http://www.inaturalist.org/observations/6842589
http://www.inaturalist.org/observations/6842401
Any idea why this is happening?
I'd like an api / obs_search_url param for not equal to a term_value_id (e.g. term_value_id is NULL or != the term_value_id) - something like
http://www.inaturalist.org/observations?place_id=any&subview=grid&term_id=9&term_value_id_not=11&order_by=votes
which would return all observations except those with term_value_id = 11
Currently we just have a user_id
in that response. Since we have a full user in the ofvs
, let's have one in project_observations
too so we can show who added the obs to what projects.
In response to http://api.inaturalist.org/v1/observations we'd get something like
{
total_results: 4131950,
page: 1,
per_page: 30,
bounding_box: {
nelng: 1,
nelat: 1,
swlng: 0,
swlat: 0
},
results: [
...
]
}
This would let us do some thing things like zoom the map appropriately on the taxon page.
Kind of surprised we don't have them already! Should be included in /v1/observations
and /v1/observations/:id
http://apibeta.inaturalist.org/taxa/autocomplete?q=%E5%8B%95%E7%89%A9%E7%95%8C
Seems like it might only be Kanji characters, b/c the following all work
Iconic taxon IDs are specific to individual instances of the database, while names should be universal. This makes it awkward to use iconic taxa from endpoints in our API because a client has to hardcode mappings from IDs to names in code (e.g. {1: "Animalia"}
) which will break when connecting to a different database (e.g. a local development database), or it has to make another request to get more info about those IDs. Including the names would allow clients to use those categories without having to figure out what the numbers mean.
So my proposal is to always include the iconic taxon name every time we show an iconic taxon ID. Maybe this is more of an issue for the Rails app where the ES index gets populated, but I imagine some change will have to be made here too.
This is something @budowski requested in inaturalist/iNaturalistAndroid#134, but I feel like I've also run into it while working on obs search and the identify section.
to avoid re-fetching the observation for details view
Requested in uber ticket #23
At https://github.com/inaturalist/iNaturalistAPI/blob/master/lib/controllers/v1/observations_controller.js#L547 we don't pass dateRangeFilter()
a date field like we do when interpreting d1
, which means requests like http://api.inaturalist.org/v1/observations?created_d1=2017-06-01 don't quite work the way you might think. Was this intentional, and if so, why? I can change this, but I want to make sure I'm not breaking something.
in /observations/:id
, it would be helpful to the iOS app to have:
I forgot to mention when we were talking, that in the iOS we're also identification.current
, which I think is just shorthand for "is this the most recent observation by this user?" so we could probably calculate it on the client side if need be.
Thanks!
needed to query user for # of obs & IDs for Me tab header
Requested in uber ticket #23
In order to show a feed of updates in the iOS app, we'll need to start being able to request all updates on my content, not just new updates. It would be great to see:
/observations/updates
returns all updates on my content/observations/updates
accepts some kind of created_after
(either a date or another update id) parameter/observations/updates
returns a viewed
boolean indicating whether the user has seen this update or not (useful for making notifications and other UI stuff)To show rarities within search params.
I've included this link to observations within a taxon/place not represented in a complete set
https://github.com/inaturalist/inaturalist/blob/master/app/views/complete_sets/show.html.haml#L10
is there a way to remedy this? I believe we had this problem with project search params that we solved by replacing with a smaller URL param
Currently it just returns an error if you ask for scores on an observation that has a non-JPEG first photo. There aren't many of those, but there are some, which makes the CV identification tools like the iOS taxon chooser behave a bit inconsistently.
IMO, not an enormous priority since most photos are JPEGs.
E.g. http://www.inaturalist.org/observations/339073 and its display at http://www.inaturalist.org/observations?utf8=%E2%9C%93&q=&search_on=&quality_grade=any&reviewed=&identifications=any&captive=&place_id=&swlat=36.74864635797473&swlng=-122.33892225585942&nelat=37.02324629220921&nelng=-121.89946913085942&taxon_name=&taxon_id=&day=&month=&year=&order_by=observations.id&order=desc&rank=&hrank=&lrank=&site=&tdate=&d1=&d2=&filters_open=false&view=map
I was able to fix this by changing https://github.com/inaturalist/iNaturalistAPI/blob/master/lib/inaturalist_map_styles.js#L105 to something like [private_location > 0]
and including private_location
in the fields retrieved from ES, but I couldn't figure out how to strip private_location out of the .grid.json
responses.
In order for a client to know if the current user has marked an observation as captive, the client needs to know whether the current user has created a QualityMetric record for the wild
metric. If it's too much data to load, then something analogous to the reviewed_by
attribute would suffice, but wouldn't be ideal since the client couldn't distinguish between yes, no, and no vote. I don't think I need this in GET /observations
, just GET /observations/[ids]
It looks like when I fave something via the rails api, it takes a minute to show up in the node api.
This is problematic for the iOS app if we're displaying an observation from the node api, want to add a fave to that observation by making a request to rails, and then expect to refresh from the node api and populate our UI showing the user that the fave has happened.
I haven't looked to see if this same behavior is exhibited to other interactive actions on observations, like adding a comment or an identification or etc.
observations object needs a primary key
Requested in uber ticket #23
it would be great to get the wikipedia summary in taxon objects returned by the API.
if possible, it would be great to get the summaries whenever ?details=all
is passed into the observations API, so that when I fetch observations I don't need to re-fetch the taxon objects when i display the taxon screen in the app, since this part of the app typically functions when the app is offline.
Requested in uber ticket #23
on
filters by datetime observed specified by a date string, e.g. /observations?on=2014-05-01
. created_on
is the same except it filters by datetime created.
needed to populate the News tab
Requested in uber ticket #23
- instead of just a list of Project IDs
- to avoid having to make separate calls to get Project details
Requested in uber ticket #23
needed to show private coordinates
Requested in uber ticket #23
E.g. so API consumers can know the photo was taken by Joelle, and that she has released it under a CC-BY-NC license.
Include dimensions for at least one photo in the /v1/observations
response so clients can perform layouts without actually loading the photo to check it (e.g. flickr-style photo layouts, masonry, etc).
endpoint that takes taxon_id and place_id array (as well as other obs search params, e.g.
api.inaturalist.org/v1/observations/choropleth?places=14,12&taxon_id=2041&verifiable=true…
and returns observation counts by places in the array. All I need at the moment is place_id, obs_count, e.g.:
{
"total_results": 357,
"page": 1,
"per_page": 357,
"results": {
"places": {
"13": 7,
"15": 30,
"16": 41,
"18": 52,
"31": 97,
"54": 90,
...
}
}
}
but it might be wise to include the place object in the response if we wanted to anticipate other uses, e.g.:
{
"total_results": 494,
"page": 1,
"per_page": 494,
"results": [
{
"place": {
name: "California",
id: 14,
...
},
"observations_count": 10,
},
...
]
}
Currently /observations/updates
returns updates on all observations the authenticated user is subscribed to. It would help to filter these to show only updates on the authenticated user's own content.
observartions_by
parameter to /observations/updates
that adds a filter that only shows updates on the authenticated user's observations@alexshepard was trying to include the true coordinates of observations in the iOS explore tab for your own observation (see inaturalist/INaturalistIOS#137 (comment)) and ran into this problem: if you use the API to make an authenticated request for obs in a bounding box and you have an obs with private coordinates inside the bounding box but public coordinates outside of it, you don't get that observation back in the response, b/c we use public coordinates for bounding box queries: https://github.com/inaturalist/iNaturalistAPI/blob/master/lib/controllers/v1/observations_controller.js#L504
Here's an example request on the website: http://www.inaturalist.org/observations?nelat=37.782408483538376&nelng=-122.46629903639223&place_id=any&swlat=37.78124254829675&swlng=-122.46964911545183&verifiable=any
That doesn't include http://www.inaturalist.org/observations/6093011 for alex when he's authenticated as himself.
Not entirely sure this is a bug, but it seems like you should at least be able to include your own observations. Alex pointed out that we could theoretically overselect by using the private_geojson
and removing all the obs the authenticated user doesn't have permission to see, but that may or may not be performative.
Not really sure yet what this will look like, or what we can do with the existing index. Some things I think could be useful
Currently we can only provide leaf or species counts of observations, or counts of obs at the taxon they are ID'd to (i.e. count all obs ID'd to family), but can't get the family counts of obs ID'd to species.
Part of the way at https://github.com/inaturalist/iNaturalistAPI/commits/histograms. Requirements are:
Would be nice to specify the kind of grouping for both of these. Though Patrick's current approach of showing numerous groupings at once could also work.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.