mikelax / spacebot Goto Github PK
View Code? Open in Web Editor NEWspacebot - A Slack Bot for exploring NASA images
Home Page: https://slashspacebot.netlify.app
License: Apache License 2.0
spacebot - A Slack Bot for exploring NASA images
Home Page: https://slashspacebot.netlify.app
License: Apache License 2.0
Add a check to make sure that the given rover name and camera name combination is valid.
If not then a specific error should be returned stating that the rover/camera combination is invalid.
example:
rovers photos curiosity pancam
- should return camera not available error
It appears that some of the photos responses contain images that are basically thumbnails, ie. 63px square.
The function should filter these images out of the response and not include in the API response to slack.
example: /spacebot-dev rovers photos opportunity all 2016-09-17
This image should be removed.
As a user, if I forget to type the rover name and start the first parameter with a valid camera name, then it should assume I want to use the default rover.
valid examples:
rovers photos opportunity navcam
- existing valid use case
rovers photos navcam
- should default to curiosity
rovers photos pancam
- should default to opportunity. camera not available on curiosity
invalid example:
rovers photos foo
- should return an error
Current error stack trace:
Logging Error: [TypeError: Cannot read property 'name' of undefined] TypeError: Cannot read property 'name' of undefined
at rover (/var/task/lib/rovers.js:102:14)
at /var/task/lib/rovers.js:332:19
at tryCatcher (/var/task/node_modules/bluebird/js/release/util.js:16:23)
at Function.Promise.attempt.Promise.try (/var/task/node_modules/bluebird/js/release/method.js:39:29)
As a user, I want to be able to "vote", or indicate that a photo is interesting or not by voting with a message button.
Under each image, two buttons should be displayed: Save to Favorites, Interesting.
Saving to Favorites will store the selected image and associated attribute information. The user would then be able to list and retrieve their favorites in separate commands.
The Interesting button would cast a "vote" for the given image that it is interesting, special, or otherwise stands out among all other images. This would be used later on by an algorithm to select interesting and top images that could be surfaced.
The vote results should be recorded in a dynamodb table.
Attributes to store:
Team, user, timestamp
photo ID, Sol, earth_date, Camera, Rover, img_src
text and command (from slash command payload)
To protect against spam, implement a captcha.
The google reCAPTCHA looks nice and is easy on the user.
It would be great to also add the NASA Image of the Day to spacebot: https://www.nasa.gov/multimedia/imagegallery/iotd.html
reproduction command:
/spacebot apod 1812-06-13
As a user, I should receive a friendly error message instead of JSON response for a valid date format but invalid date value for APOD.
This could be enhanced to add a "valid" date check that all services could implement.
Currently using sls version 0.5, need to get upgraded to the current serverless version.
This will be a big refactor to the folder structure, sls config files, and more.
Just need to research folder structure for multiple functions sharing lib code.
Some dates for the NASA APOD function are videos. Currently the service assumes photos.
It should be refactored to look at the media_type
attribute and if its a value of video
then render a video attachment
Command to test with
/spacebot apod 2016-09-26
Corresponding NASA API: https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY&date=2016-09-26
In #3 initial support was added for interactive messages and the Favorite feature to apod.
As a user, I want to be able to favorite a rovers photos
photo as well.
It should store similar attributes as for apod but with a couple of additional ones specific to rovers:
Attributes to store:
slack user id, Team, user, channel, timestamp, photo ID
Rovers specific - Sol, earth_date, Camera, Rover, img_src
We may just store all the rovers specific attributes in a single json object.
As a user, I don't want to see an error response in slack when I send a slash command that results in no photos found for the given options.
example: /spacebot rovers photos opportunity mast 4332
There were no photos taken from the MAST camera for that given day and rover. Instead of returning an error response in slack, we should inform the user that no photos were found and they should adjust the parameters. It should also print the given command or parameters used.
In a future version it could try to suggest valid options to use.
As a user, I want to be able to get a list of recent news articles about space.
JPL has an RSS feed for the News section of their website. Display recent entries from this feed for the command: /spacebot news
Can also include other news sources to combine together.
As a user, I would like to be able to know the current weather on Mars.
The slash command params would be: /spacebot mars weather
A nice to have feature would be to have the weather report calculated automatically each day by a scheduled lambda function. The output of this function would be a "weather report" image that could then be served in response to above command.
We could look at the past data for ~1484 Sols and calculate some stats like high/low, etc so image could show current values on scale instead of just displaying raw numbers without any real context.
Sources:
https://cab.inta-csic.es/rems/
https://cab.inta-csic.es/rems/wp-content/plugins/marsweather-widget/api.php
http://cab.inta-csic.es/rems/rems_weather.xml
https://weather.com/science/news/check-weather-mars-where-nasas-maven-headed-20131119
Implement a basic NaturalNode classifier to try and understand commands.
Create a sample training set of documents to determine the command to run:
There should be a default response if no action could be gleamed from the input.
(Future) create full conversation to allow follow up actions. ie. After performing apod, handle "Add to my favorites list".
This should be made modular to allow for switching up the library implementation. Another option would be to use wit.ai Intent Parser.
As a user, if I supply the random
parameter to the apod command, I expect a valid response to be returned. We need to handle the use case where the user requests random and it just so happens that an invalid date is selected.
In this case the command should be run again with a new random date until a valid response is returned.
example:
apod random
- generates date of: 1997-09-06
NASA API returns 500 for given date. https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY&date=1997-09-06
As a user, I don't want to see an internal error message when running an apod command, but rather a friendly message of what happened.
example command: /spacebot apod 2009-10-17
This API is returning a 500 error from NASA, this should be caught and return a message to the user that there is a problem returning the image for this specific date, please try a different date.
We should catch errors from NASA for all APIs, not just apod.
It appears that slack will from time to time send "ssl pings" to check and make sure that a given API URL is properly serving SSL requests.
The handlers should consider these a no-op, but must return an HTTP 200 response. It appears the contents of the body does not matter.
Support should be added as a lib function to the following functions:
Example of the event received in lambda function.
{ body: 'ssl_check=1', pathParams: '{}', queryParams: '{}' }
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.