Saving Total Time in a Data Warehouse - data-warehouse

I am building a data warehouse and I'm new to some of its concepts. I need to record the total amount of time a body of work is spent in a particular state. An example would be a process starting and taking 10 minutes (10 minutes in 'doing' state) before moving to a 'pending' state where it sits for 60 hours until someone picks it up to progress it. It is picked up by another user after those 60 hours who adds 15 minutes onto the 'doing' state before completing it.
If I am cataloguing this process in a data warehouse once each night, how am I best to store the accumulated time? Would recording the data each night not create double counting of the time in each state?

Related

Problem with data processing time in google spreadsheets

The data is entered in another part of this worksheet during the last night and with the data entered the worksheet begins to perform calculations and processing. However, every time we access the worksheet, it is as if the processing is "redone" and we have to wait minutes, sometimes hours, for the worksheet to process all the data again.
I would like to know if there is any way that these processings were not "redone" where the entered data would only be processed again with the insertion of new data in the other part of the worksheet.
Problem images:
First access to the worksheet: after opening the worksheet, data starts to be processed at 10:48
10 minutes after opening the spreadsheet and processing is still active...
Approximately 15 minutes after the first access is where all processing ends and the data is displayed with correct values
When accessing the spreadsheet again, it starts all over again... where the data will be processed again
Could anyone help me in this case?

What is the time unit for "datadelay" attribute on GoogleFinance?

I'm using the GoogleFinance() functions on a Google spreadsheet to keep track of my stocks. With the "datadelay" attribute I can check how long ago the data has been updated for the last time. But it only returns a raw number, like "54000" for one ticker and "15" for another. What time unit is that supposed to be? minutes? seconds? milliseconds?
When I check the documentation for the Google Finance I saw that there is a page explains there might be delay up to 20 minutes. They also mentioned that they are using different exchanges to retrieve market data and all this different exchanges might have different data delay. It can explain the differences in the "datadelay" column.
For the unit of this column, my assumption is it should be shorter than seconds since 54000 seconds = 900 min, which is far higher than the maximum delay defined in the help page. But I am not sure what would be value for this column when you query in the not-trading days.
The page shows delays for each exchange.
GoogleFinance() function updates every minute (if it is set so), but keep in mind that results may be delayed up to 20 minutes. so the answer is between 1-20 minutes

How to query health kit for total activity minutes by day?

I am familiar with HKStatisticsCollectionQuery in HealthKit, but I am not clear how to run a query for the total number of minutes of activity in a specified time frame, rather than the total number of some QuantityType units. Is this covered somewhere in the documentation?
Perform an HKStatisticsQuery specifying the HKQuantityTypeIdentifierAppleExerciseTime quantity type to get the total number of exercise minutes for a given time period.

How can I measure the total time a user spends online with InfluxDB?

I'm measuring how long users are logged into a service. Every minute, for each user, their new total online time is sent to InfluxDB. I'd like to graph, in Grafana, the cumulative online time for all users.
What kind of query would I need to do that? I initially thought that I'd want sum(onlineTime) and group by time(1m), but I realized that's summing the values within that timeframe, not summing the totals of all users, so when a user wasn't logged in, the total would drop, because there were not data points for them.
I'm a bit confused about what I'm doing now. If I'm sending the wrong data, I can change that too.
So this depends on the time data you send back to InfluxDB
The time data is equal to the total time spent till that instant of time
In this case you would have to take the "last" value and add it up for all the users
The time is equal to the small increments
In this case you would have to add this multiple incremental value for a period of time.

Time of the day dimension

How can I build a time-of-the-day dimension table which holds granular information for hours, minutes, seconds and such information
got it from here - http://wiki.postgresql.org/wiki/Date_and_Time_dimensions
I'm curious why you would want a TIME dimension when this information can easily be extracted from the TIME portion of a TIMESTAMP or TIME data type itself. Having said that you could create a table DIM_TIME (Time, Hour, Minute, Seconds). You would then have to populate it with 86400 values containing a record for each second within a 24 hour period.

Resources