Comments (5)
Is this issue intended for adding templates for quirky little sayings? I noticed I got the same "Netflix and Psych" message twice in a row.
from rainjacket.
Yeah exactly. Right now there's about 20 in total but there's six scenarios in total which leaves about three sayings for each type of day/night. I've been slowly adding to the list, but it's difficult to come up with stuff that works universally.
from rainjacket.
Where are these located in the code? Or are they just in your database somewhere? I tried looking through but couldn't find it. I'd love to see how you're deciding which to send and maybe offer up a few contributions for text
from rainjacket.
They're all in the database. I actually forgot to commit them and my table structures (#16). Until I do, you can view them here.
And here's the logic for choosing a template. This is in data/models/Rainjacket_model.php
.
- Function
getForecast()
is called. Latitude, longitude, and a boolean variable representing whether it's day or night gets passed in. The function calls the python scripts with the coordinates as arguments. - The python script returns a bunch of JSON data with a
precipitation
object, alookingAhead
object, and atemp
object. For the templates we only use theprecipitation
andtemp
objects. - We now start building our replacement array with the two keys that will always be there: the temperature (
temp
) and a phrase that describes the day, such as "nice and cozy" or "bloody hot" (tempAdj
). - If the
precipitation
object is not null (that is, there's precipitation of some kind), we add in:topPrecipType
- a phrase that describes the heaviest precipitation in terms of intensity and type, e.g. "downpour" or "heavy snow"topPrecipTime
- when said precipitation will starttopPrecipChance
- how likely this precipitation will occur, e.g. "a chance of", "slight chance of".startPrecipType
,startPrecipTime
,startPrecipChance
- the same as it'stop-
counterparts but instead deals with when the precipitation starts.endPrecipTime
- when the precipitation will stop. If it doesn't stop by midnight, this is null.
- We then call
_getTemplate()
and pass in theisDay
variable from 1), whether it's going to precipitate, and whether it's going to stop by midnight. _getTemplate()
then scours the database looking for templates that match those three parameters and retuns one at random*- We give the template and replacement array to Smarty and receive the finished forecast.
- I'd like to expand this to somehow know if a template has been seen by a person before and favor templates that haven't been.
from rainjacket.
Right so I've finally committed the table structure: rainjacket.sql
from rainjacket.
Related Issues (20)
- Scrum 3 Meta post
- Sprint 4 - Meta post HOT 1
- Add some Smarty goodness to the templates
- Document Rainjacket code
- Stretch Sprint List
- Code cleanup with variable, function conventions HOT 1
- Can't register new users
- Two different conditions
- Add Maintenance mode
- Ensure times given are valid times
- Change email to white background HOT 1
- Commit table structure and templates HOT 1
- Python scripts seem to use timezone of computer, not of location HOT 1
- Move processing of Looking Ahead from forecast.php to Rainjacket_model.php
- [Templates] If customer can expect rain now, say so
- ' instead of ' HOT 1
- Pollen broken HOT 1
- Increase the percentages that determines if we say it'll rain
- CSS rounded corners on new line
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rainjacket.