How far back in time does Here Isoline Departure field go? - gis

When calling the Isoline API, how far back in history can we enter for the Departure field?
And is the data static after that date has passed?

Departure field works only if set to now or any future time. You cannot query the API for any past time or history.

Related

Firestore Cloud Function Trigger only when path updates with new entire

I have a firestore database that looks like this
/entries/ ....
/users/{userid}...
a bunch of documents is being sent into ... of entries and userid contains on 8 docs of user profile information.
my problem is that the entries doc contains field hours and no relation to the user doc which contains the field weekly_capacity
I need to aggregate this the two fields hours/weekly capacity setting them to Full-time equivalency variable
But the Full-time equivalency needs to be accurate and this company FTE can change so it would need to calculate the FTE over various date even if the user changed their FTE status x number of times.
And the current app only fetched the entries when the user logins into the app, which can be whenever.
None of the API requests that I am using will give me a json that holds both weekly_capacity and hours on the same fetch. If every time a user logs into the app firestore calls the http to fetch all entries then how can I compare the hours field on the collection's entries to the weekly_capacity field
Just a little context: FTE = Full-time equivalency and is used to measure as a standard to see if an employee compares to there core commit hours they signed up for which is 40. SO if I agreed to work 40 and I work actually work 40 hours then I would be 1 whole FTE. If I worked 20 and I suppose to work 40 I am .5 FTE. The math is really simple it's just that in my situation the variable FTE can change any time and the app will allow the user to enter a range of dates fetching the total actual hours they worked and FTE letting them know how many hours they were supposed to work vs how many hours they actually worked. Since the variable changes, I need some way in firestore to track the change and aggregate correctly against the hours actually worked. To give an error example: let's say I changed my FTE from 1 to .7 on March 20th, I then want to generate a report of March 1 to March 30th stating my hours worked and FTE status meaning did I reach my goal. The kicker is that I can't fetch or merge the entries which hold the var hours and /users/ which hold the var weekly_capacity.
I don't even think a cloud function would solve the problem since entries are only fetched when the user logins in right?
I'm assuming the following for answering your question.
Requirement: To calculate FTE for a user when user's weekly_capacity is updated or user logs in.
Problems:
Some way in firestore to track the change.
Calculate FTE correctly according to the change.
Here's what I think will solve the problems.
Google Cloud Firestore supports listeners for the collections in which you store the data. So you can listen for any change in users collection and entries collection. This is how you can track the change.
To calculate FTE, when a change is made to weekly_capacity of user document or a new entry is made to entries collection you need to query both collections separately to get the records corresponding to the user affected. You can also use a collections-group query for this purpose but that depends on your database design.
Hope that helps.

Logging time zone aware events

I know pages and pages have been written on this topics, however, I need to clarify this issue, and be sure I'm doing what is sensible.
The users of my app can be in any part of the world. I log a number of events/actions a user performs on my app. I want to be able to see what events/actions a user made in it's own time zone, or a timezone of my choosing.
At the moment, my app is sending the date and time of the event in UTC in the format "YYYY-MM-DD HH:MM:SS" and also, in a separate field, the time zone offset in minutes (e.g. -120 or +60).
When I get the events, I store them in MySQL in the following way: I use a DATETIME column to store the date and time of the event as is; I use an INT column to store the offset.
When I want to do a select and get back the event in the user's time zone, I just do:
SELECT cdate + INTERVAL tz_offset MINUTES FROM events WHERE uid=123;
I believe this is the best option for me, and offers versatility.
What do you think?
Thank you!

MySQL time zone

I am new to database development and am currently working in MySQL.
I have a column that contains all the time zones for USA. I want to be able to get the current time (only time, no date) as of right now for each time zone in each row.
The TimeZone data looks like: +05:00, -03:00 etc etc etc
This is how I have attempted it. I have 2 tables, one country, one city. TimeZone is found within "city" table. I have tried to use the function sys date() but it returns the complete date and the current time on my system, not based on the time zone. Can anyone help me out? Thanks a lot
select TimeZone, Country, sysdate() as "Current Time"
from city, country
where Country='USA' and city.CountryId= country.CountryId;
You should be able to use the convert_tz function:
SELECT CONVERT_TZ(NOW(),'-07:00', city.TimeZone) AS Time, city.Name
FROM city, country
WHERE country.Name='USA' and city.CountryId= country.CountryId;
Assuming your server is in -07:00 timezone.

Storing Calendar Data in MySQL

Just a quick architecture question really on storing calendar data.
Basically, I have a database of services for rental. On the front end, there is a calendar to show either "Available" or "Unavailable" for every future date. In the back-end the user can set any date/date range to available or unavailable (1 or 0) on a jQuery calendar.
The question I have is how would you go about storing this data in mysql and retrieving it on the front end?
Possible have all dates available and store the unavailable dates? Then if they are set to available again, remove the record for that date?
Cheers,
RJ
Possible have all dates available and store the unavailable dates? Then if they are set to available again, remove the record for that date?
Yes, I'd go with that, except I would not remove the record when renting expires - you'll easily know a renting expired because it's in the past, so you automatically keep the history of renting as well.
After all, there is infinite number of available dates1, so you'd have to artificially limit the supported range of dates if you went the other way around (and stored free dates).
1 In the future. And, in some sense, in the past as well.
Also, I'm guessing you want some additional information in case a service is rented (e.g. name of the renter) and there would be nowhere to store that if renting were represented by a non-existent row!
Since the granularity of renting is a whole day, I think you are looking at a database structure similar to this:
Note how RENTING_DAY PK naturally prevents overlaps.
Alternatively, you might ditch the RENTING_DAY and have START_DATE and END_DATE directly in RENTING, but this would require explicit range overlap checks, which may not scale ideally.
Decide whether the default is Available or Unavailable.
Possible have all dates available and store the unavailable dates?
So default is Available?
Then you can put unavailable_start and unavailable_end - store it as a date field. For single days, unavailable_start = _end. Then it's easy to query for a month or any date range and return the unavailability periods in that range. Then have jQuery parse it to display the calendar details for those dates.

Retrieving Data into a Table Depending on Time?

I'm building an 'events' table that will show the events for that particular day.
However, since most events start late in the evening and end early in the morning I would like to know as to how I should plot and retrieve the data. Let's say that and event day starts at 6:01 AM and ends at 6:00 AM. Is the time dependent on the server time? Can I change it to some other GMT time? How would the time table look in the mysql database?
Thank you!
I would have a table like this:
Event
======
EventID
Name
StartTime
EndTime
StartTime and EndTime would be stored as UTC dates. With this schema you can query however you like, and present the time for whatever time zone you like, but it keeps things consistent and well performing. You would want to index EventID, StartTime, and EndTime.