-
Notifications
You must be signed in to change notification settings - Fork 444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create monthly charts #685
Comments
Hello! Which version of CareKit are you using, and are you building out your view in SwiftUI or UIKit? If you're interested in trying out the 3.0 beta release, we've introduced some new SwiftUI APIs that will make it really easy to map event data to a chart - struct MonthlyChartView: View {
private static var query: OCKEventQuery {
let monthInterval = Calendar.current.dateInterval(of: .month, for: Date())!
let query = OCKEventQuery(dateInterval: monthInterval)
}
@CareStoreFetchRequest(query: Self.query)
private var events
var body: some View {
buildChartView(using: events)
}
} Alongside that, you can also make use of the |
Hi Gavi,
I've started to review the 3.0 updates and look forward to testing. I also
plan to graph a variety of outcome values, not limited to ResearchKit. My
question is whether I could obtain the same
result using @CareStoreFetchRequest with an OCKOutcomeQuery over a date
range instead of an event query? What are pros and cons of querying events
vs outcomes for this use case? If querying for events, I assume that I'd
just need to map the events to a collection of outcome.values anyway.
Thanks,
Dave
…On Tue, Apr 25, 2023 at 10:17 AM Gavi Rawson ***@***.***> wrote:
Hello! Which version of CareKit are you using, and are you building out
your view in SwiftUI or UIKit? If you're interested in trying out the 3.0
beta release, we've introduced some new SwiftUI APIs that will make it
really easy to map event data to a chart -
struct MonthlyChartView: View {
private static var query: OCKEventQuery {
let monthInterval = Calendar.current.dateInterval(of: .month, for: Date())!
let query = OCKEventQuery(dateInterval: monthInterval)
}
@CareStoreFetchRequest(query: Self.query)
private var events
var body: some View {
buildChartView(using: events)
}
}
Alongside that, you can also make use of the CareTaskProgress API to
aggregate the progress for multiple events and display the resulting value
in the chart.
—
Reply to this email directly, view it on GitHub
<#685 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKEBNHP5EBTHPCNFS6FJD4DXC72JVANCNFSM6AAAAAAWKMBZBI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Hey Dave apologies for the late response here. You can also stream outcomes over a date range. The @CareStoreFetchRequest(query: OCKOutcomeQuery(dateInterval: someInterval))
private var outcomes The decision between querying for outcomes or events will depend on what you plan to do with the data. Querying for just outcomes is probably a little bit faster, but is missing some perhaps useful information (task, event start, event end, etc.). You also won't have access to the progress computation methods available on an event. Though, it might be useful for us to provide that progress method on the outcome level as well one day. Does that help clear up the differences? |
Hi,
I want to create a charts that shows the results of a researchkit task for a whole month instead of a single week. I've already managed to modify the view of the charts, but I'm having some problems in figuring out how to fetch the results of the events of the whole month. I hope someone can help me.
The text was updated successfully, but these errors were encountered: