How to find the date healthkit began receiving input with Swift - swift

I have a function that takes the step data for every day until a point, which is yet to be determined. What I need is a way to determine the day that HealthKit began receiving step count input. I tried to have it repeat until it detects 3 days of zero activity, but that seems too unspecific. Is there an object for the start date?

I don't think that there is an object for the start date readily available, as far as I know.
One solution could be to pull all the data using a HKStatisticsCollectionQuery by day without any predicate ordered by the date, and the first date in the results should be the start date.
Hope this helps.

Related

UiPath Orchestrator Triggers - Cron Expression For specific day of month or next working day if not a working day

I've currently got this Cron expression that I'm using to trigger a process in UiPath Orchestrator:
0 0 15 21W * ? *
Runs on the closest working day to the 21st of each month at 3pm.
However I need it to run on the next working day at 3pm if the 21st is a non working day.
Tried searching for an answer and nothing quite fit the brief.
I used this website to build my expression (which is a great tool) but it only had an option for 'nearest day' and not next working day given a specific day of month: https://www.freeformatter.com/cron-expression-generator-quartz.html
As you don't need the nearest day, you can't use the functionality of Orchestrator cronjob. I would recommend creating a wrapper process as follows:
Create a new process, let's call it StartJobByCheckingDate
Now create a trigger that starts StartJobByCheckingDate each day at 3pm
So that process is now your manager of your desired process
Now we need to check if it is the 21th day
Here you have different ways to solve it
You could create a DataTable or even a file in the StartJobByCheckingDate process, that contains all the different days where your desired process should be fired (but this is very manual, you might not want to update this every year, so this might not be the smartest but the easiest solution)
The other idea is to check if the current day is the 21th day. If so check if it is Saturday/Sunday (non-working day).
If true: you could now create a empty dummy file somewhere that tracks that the 21th was a non-working day, and the next day you check that file existing, if it exists you check the current day to be a working day, and if so you delete the file again and start your desired process
If false: just start your desired process directly
I think 2. idea would be that best. Sure you have 365 jobs runs/year. But when you keep that helper process smart this will just be seconds.
Another idea instead of using the dummy file, would be to use Entities. Smarter but need some more time to get familiar with.
We have (had) the exact same issue. Since UiPath doesn't offer a feasible solution out of the box, we will work around the restriction using the following strategy: We trigger the actual job daily, considering a custom-built, static NonWorkingDay-list that will just suppress the execution of the robot every day we don't want it to run.
These steps are needed:
Get a list with of all known bank holidays, saturdays and sundays until 2053 or so...
Build a the static exclusion-list using a script that does something like this (pseudocode. I will update the answer once we have actually implemented the solution):
1. get all valid execution dates
loop through every 28th of the month until end of 2053
if the date is in the bankHolidayList then
loop until the next bankDay is found
add it to the list of valid ExecutionDates
else
add the date to the validExecutionDate-list
2. build exclusion-list
loop through every day until end of 2053
if the date is not in the validExecutionDate-list
add it to the exclusionDate-list
Format the csv accordingly and upload it to the orchestrator tenant as a NonWorkingDay-List
Update your trigger to run daily at your desired time, using the uploaded NonWorkDay-Calendar
While the accepted answer will surely work as well, we prefered to go with this approach because having a separate robot that does nothing but executing a UiPath trigger just doesn't seem right to me. With this approach we have no additional code that we potentially need to maintain.
In my oppinion not having a solution for this concern out of the box is a lack of feature that UiPath will (hopefully) fix until end of 2053 ;-)
Cheers
You can configure your trigger to launch oftener, then manage dates at init of your process, but you must set up a list of "holydays" or check in some way.
Also you can use the calendar option of orchestrator (+info)

AlphaVantage: Random data in downloaded adjusted time series

I download adjusted time series from AlphaVantage using the following call (you need to insert your own API key):
https://www.alphavantage.co/query?function=TIME_SERIES_daily_adjusted&symbol=^GDAXI&outputsize=full&apikey=yourAPIkey
Next, I look at one particular (and faulty) data point at date 2003-04-18:
"5. adjusted close": "766464.0000"
Then, I reload the exact same API call and check the same data point again. However, this time there is a different value for adjusted close here! Every time I reload, different value (and always wrong, too). Why is this happening and how do I fix this wrong data?
For those who come across the same problem with AlphaVantage data, I try to answer my own question.
The random data problem only occurs on some (not all) non-trading days. For example, the above date is Good Friday in 2003. I have written a function to filter out all non-trading days from the downloaded AlphaVantage data, and that "fixed" the problem of the random-data days.

In Azure devops, how to query task that was not close in the same day it was activated/ when the state was changed?

Im a bit new at azure devops and I am trying to view task that was not close in the same day it was activated/ when its state was changed using query. My point of confusion is that I dont know how compare the state change date with the close date.
the output should be tasks that are still active and task that are closed but not in the same date it state was change
UPDATE
So I was wondering if my approach was wrong so I tried different approach.
here I try using the []<> to compare completed date with activation date, it should have sorted to show only task that the activation date are different from the close date but here I still got shown tasks which have close date and activation date in the same date.
UPDATE 2
Since I cant use the '[]<>', I decided to use the not so smart way to compare the task close date, active date, and create date as seen in the screenshot below, it is ugly but it works. If anyone knows a smarter way to do this, please do tell.
My current solution
I still got shown tasks which have close date and activation date in the same date.
The reason for this problem you met is that when you use the condition “Closed Date <>[Field] Activated Date”, the values of these two fields are actually datetime format which means it contains hours, minutes and seconds like below:
That’s why you can still see the records shown with same date.
As for the requirement you mentioned, there’s no directly available solution you can use in Azure DevOps Query as far as I know.
In addition, please refer to Group clauses where you can see how to set conditions for “not close in the same day it was activated/ when its state was changed”, like below:

Here-Api 7 day forecast changes days mid-day

I'm testing some API calls and was delighted to see that the seven-day forecast was including the current day. Around mid-day my time, the seven-day forecast changed and started returning tomorrow as the first day instead.
https://developer.here.com/documentation/weather/topics/example-seven-day-weather-forecast.html
My theory is that the servers are in California (or similar timezone). I'm in Stockholm. It was probably still "yesterday" in the server's timezone when I started playing with the APIs.
Any suggestions on how to fix this? Ideally, I'd like to see an additional parameter allowing me to specify my timezone, or (even better) automatic timezone detection of the requester.
The requester's timezone is not used in the retrieval of the weather data. The reference time(zone) is the local time of the location of which weather data is requested. For the seven days weather forecast, the next day is chosen as the start day if the local time is after 15:00.
Using forecast_hourly as product parameter will give you hourly weather data starting from the current local day and not the next day.

Why to store date as timestamps?

I am creating a node app with mongo and trying to store createdOn field. I have two options, either go with the ISO date format("YYYY-MMM-DDThh:mm:ss.zzz") or use timestamp. My users will be mostly in India but my server is in Oregon USA, and all computation will be done over there. Just wanted your thoughts on which one to use and why?Could not find a nice blog post searching this. I hope the smart people who have already done this would help a fellow newbie out.
What am I already doing?
I am saving the date in the date time format,using momentTimeZone by Asia/Kolkata time and extracting it out. It's very painful and I have to remember that every time I write anything related to date I have to first convert it into IST and then proceed with any ops. Hence require your suggestion, whether to continue like this or try timestamp approach