Skip to content

Add group functionality to the API and CLI. - #71

Open
unsynchronized wants to merge 17 commits into
mainfrom
group-functions
Open

Add group functionality to the API and CLI.#71
unsynchronized wants to merge 17 commits into
mainfrom
group-functions

Conversation

@unsynchronized

Copy link
Copy Markdown
Contributor

No description provided.

@unsynchronized
unsynchronized marked this pull request as ready for review July 30, 2026 04:36
- update CLI group commands to warn about specific properties
@unsynchronized
unsynchronized requested a review from kaiju July 30, 2026 19:43

@lancelets lancelets left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread fulcra_api/cli/groups.py Outdated
raise click.ClickException(
f"Invalid {option_name} format: {value}. Use ISO8601 format."
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering whether these are general enough to put in utils.py.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, doing it

Comment thread fulcra_api/cli/groups.py Outdated
@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)")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Comment thread fulcra_api/cli/groups.py Outdated
Comment thread fulcra_api/cli/groups.py
--description "A month-long step challenge." \\
--data-type StepCount --url https://example.com/challenge
"""
# Validate data types against catalog

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

https://github.com/fulcradynamics/fulcra-api-python/pull/72/changes#diff-1e87d9b275bfac4b4f914ce86ff38ea6d499b33a84398596e37816c0c4511a90

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooh okay, yeah, let's use that instead once that merges. (Actually we should fix the catalog too, adding that to the list)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread fulcra_api/cli/groups.py
lancelets
lancelets previously approved these changes Jul 31, 2026

@lancelets lancelets left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM—Thank you!

…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)

@gklei gklei left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Had one question about the --view-description option in the update command that Leif and I noticed. Looks great overall!

Comment thread fulcra_api/cli/groups.py
)
@click.option(
"--view-description", help="New description of the group's view (JSON object)"
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread fulcra_api/cli/groups.py
gklei

This comment was marked as duplicate.

gklei

This comment was marked as duplicate.

gklei

This comment was marked as duplicate.

@lancelets lancelets left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM—Awesome!

Comment thread fulcra_api/cli/commands.py
Comment thread fulcra_api/cli/utils.py
return f


def resolve_data_source(fulcra_api: FulcraAPI, group_id, participant_id):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread fulcra_api/cli/groups.py
--description "A month-long step challenge." \\
--data-type StepCount --url https://example.com/challenge
"""
# Validate data types against catalog

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread fulcra_api/credentials.py
Comment thread README.md
Comment thread fulcra_api/cli/groups.py
from .utils import parse_iso_time, parse_json_object, pass_fulcra_api, requires_auth


@click.group(help="Data group management sub-commands")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should put some high level overview description of the functionality in the help text for the group subcommand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants