Hour, day, week and month subtotals with Firebase database - firebase

I've been thinking about how I can store counts of big nodes in my database and be able to compare those counts;
for example:
today vs the same day of past week
This month vs last month
This hour vs this hour yesterday
This hour vs this hour last week on the same day
So I came up with this:
The problem is: nested nested nested.
I do not want to get the whole data if I need only the year data.
My question: What would be the right structure for my use case?

You can keep YYYY, YYYY_MM, YYYY_MM_DD and YYYY_MM_DD_HH formatted nodes. That would be less expensive to retrieve data.

Related

Clockify Saved Reports for Half Month

Is there anyway to save reports in Clockify for a half-month period (i.e. 1-15th of the month and 16th-end)? We pay twice monthly and ideally can save off a report that can be used for a half month period.
UPDATE
Choosing a 15 day range 1st-15th and then scrolling does not work as Clockfy maintains the range size (15 days) rather than the concept of half month.
UPDATE2
Perhaps the question can better be phrased as: "does Clockify have any sort of semantic period of time for 'half-month' (aka semimonthly) that will be maintained when advancing time periods?"

Get routes with historical LIVE data

I would like to retrieve historical travel times from HERE API.
Following the API documentation for 'Calculate Route', I requested travel times for a fixed route at a fixed departure time for different days in the past, using mode=fastest;car;traffic:enabled.
The result is the same route every day and a weekday pattern (i.e., same travel time each Monday) for travel times. This obviously does not include actual traffic conditions on the specified day.
From the documentation, I would have expected to get specific travel times for each day in the past (up to one year).
Did I miss something or is this just not possible?
Thanks a lot for any help!
It is not possible to get the exact route for a past date. For any date other than NOW(current time), the route is calculated with the accumulated historical data taking into consideration the week day, time of the day, any construction work etc.

Pentaho: Get System info - get previous month

As the title suggest, I would like to get the previous month using the given month from Get System Info. I used Get System Info step to get todays month and year, and from there I would like to get the previous month. This is so it would be dynamic and I can ran this any day and still get the correct filter rather than making a hard coded year and month. Is this possible? If so, how do I do that?
Here is how I did it. This is the overview
Here is the calculator:
And concatenate fields:
There is still a few loop hole on getting the previous month during January. But, that is how I did it.

How to represent days in timeline tree for Neo4j/graphDB

In reading this blog, this reference, and reviewing the answer to this question, I'm confused as to how one can represent distinct days in a timeline tree. In both cases they show a limited number of days on the example database and my thought is that this model cannot hold if you wanted to model an entire year or an unbounded temporal calendar period.
I am reading these examples such that the 'day' nodes are merely just the number of the day '1', '2', .. '31'. As every month has a day labeled '1', '2', etc, how do you traverse the path when you connect all days to months?
For example, in the attached modified drawing, month 12 and month 1 BOTH have days 1, 2 and 31 in them. When I look at event 2, how do I know if this took place on 12/31 or 1/31? I'd like to model all days for all months and using the template (as I understand it) creates ambiguous paths on the graph that do not allow for discrete temporal queries.
Or should a 'days' entity be a more unique number that represents the number of the day for that YEAR where the attribute for that number is the number of the day in the month?
As it stands I do not understand how you can create a complete timeline tree for an entire year as it is modeled in the above links.
The modified drawing shares the day nodes between months and that's why it's difficult to know whether event 2 took place on 12/31/2010 or 1/1/2011
The timetree for a single year, with a resolution of Day, will have 365/366 day nodes. So the Day node with value 31 is not shared by both January and December, but January and December have their own Day 31 nodes. In other words a day node relates to exactly one month, and a month node relates to exactly one year.
Then you can follow the path from the event back up to the root without having it diverge at month.
Peter's blog post referenced above shows the crossing of December into January but does not share the Day node 31- you can see that he's able to answer all your queries above.
To create the timeline, GraphAware has a module that maintains the timeline for you and helps you attach events as well- http://graphaware.com/neo4j/2014/08/20/graphaware-neo4j-timetree.html
Disclaimer: I work at GraphAware

Week number and ISO 8601 for Pageview counters

I need to store page view for specific products by week, day and year. I thought about using the following tables:
Weekly
List item
id
product_id
week_number
year
total_page_views (counter)
Daily
product_id
total_page_views
[for the day I won't keep archive data and yearly will be calculated based on the weekly table]
My question is actually about the week numerical value. I am wondering which week number I should use, I've read that ISO 8601 is one option and using .NET DataTime function to get the week is another one. I need your help to know which one should I use and whether there is a better way to optimize the table.
At the end, I want to show the top viewed products for the previous week, this week, previous year, etc.
I target my app towards the US and Europe crowd, where the week start at Monday. I'm developing my application in C#/ASP.NET/MySQL/Entity Framework. THANKS.

Resources