Add group functionality to the API and CLI. - #71
Conversation
- update CLI group commands to warn about specific properties
lancelets
left a comment
There was a problem hiding this comment.
Awesome! I know the existing query command work is in progress; just took a look at the pool commands and made some comments, mostly for my own curiosity.
| raise click.ClickException( | ||
| f"Invalid {option_name} format: {value}. Use ISO8601 format." | ||
| ) | ||
|
|
There was a problem hiding this comment.
Just wondering whether these are general enough to put in utils.py.
There was a problem hiding this comment.
Good call, doing it
| @click.option("--header-image-url", help="URL of the group's header image") | ||
| @click.option("--preview-image-url", help="URL of the group's preview image") | ||
| @click.option("--annotations", help="Additional group annotations (JSON object)") | ||
| @click.option("--view-description", help="Description of the group's view (JSON object)") |
There was a problem hiding this comment.
I know we'll want to add more help about how to define the report view, but there's definitely more infrastructure to set up to generate reports for custom pools first.
There was a problem hiding this comment.
Yeah, definitely - I'm working on adding it to the docs too, but we'll want these in there eventually, so I added them now.
Worst case is someone tries it and it doesn't work, in which case we can fix it and get a new group user!
| --description "A month-long step challenge." \\ | ||
| --data-type StepCount --url https://example.com/challenge | ||
| """ | ||
| # Validate data types against catalog |
There was a problem hiding this comment.
I drafted a valid_shared_types utility function in the open file sharing PR, and this made me wonder about using that here in future, and whether we want to support file sharing to groups.
There was a problem hiding this comment.
Oooh okay, yeah, let's use that instead once that merges. (Actually we should fix the catalog too, adding that to the list)
There was a problem hiding this comment.
The valid_shared_types is now merged, though I think we'd need to add apple_workouts to it's list of temporary_allowed_types (and perhaps remove calendars and calendar_events since they are now in the catalog). I'm not sure if that is worth doing in this PR, though.
…ill using an alternate accessor, but we explicitly use a call to a new function `resolve_data_source` to look at the `group_id` and `participant_id` parameters. If those are present, it uses a group accessor; otherwise it uses the non-group one. - Add CLI errors to make it clear that you can't use `--user-id` and `--group-id` / `--participant-id` at the same time - Simplify query paths a bit in get_records - Bake in `apple_workouts`, `calendars`, and `calendar_events` for now but eventually this goes in the catalog (it's on my list)
…sed, probably through v1
gklei
left a comment
There was a problem hiding this comment.
Nice! Had one question about the --view-description option in the update command that Leif and I noticed. Looks great overall!
| ) | ||
| @click.option( | ||
| "--view-description", help="New description of the group's view (JSON object)" | ||
| ) |
There was a problem hiding this comment.
Wondering if the --view-description options option should be removed from the update command if we are leaving it out of the create command in this first pass. Definitely seems fine either way; I like the idea of being able to set it somehow, just wasn't sure if this was still intended in this pass.
| return f | ||
|
|
||
|
|
||
| def resolve_data_source(fulcra_api: FulcraAPI, group_id, participant_id): |
There was a problem hiding this comment.
Greg and I talked about how Zed seems to understand the return type of this function without a type hint; just wondering if we want to add -> FulcraAPI | FulcraGroupParticipant for clarity.
| --description "A month-long step challenge." \\ | ||
| --data-type StepCount --url https://example.com/challenge | ||
| """ | ||
| # Validate data types against catalog |
There was a problem hiding this comment.
The valid_shared_types is now merged, though I think we'd need to add apple_workouts to it's list of temporary_allowed_types (and perhaps remove calendars and calendar_events since they are now in the catalog). I'm not sure if that is worth doing in this PR, though.
| from .utils import parse_iso_time, parse_json_object, pass_fulcra_api, requires_auth | ||
|
|
||
|
|
||
| @click.group(help="Data group management sub-commands") |
There was a problem hiding this comment.
Maybe we should put some high level overview description of the functionality in the help text for the group subcommand
No description provided.