make user profiles comparable and usable with sets

Description

and I were trying to implement team member comparisons for use in https://github.com/Sage-Bionetworks/challengeutils (intersection, union, set difference). We wanted to use Python's built in set operations. Turns out our internal representation of `DictObject` is not hashable (take any list of Synapse objects and try to put them in a `set`, like `synapseclient.team.UserProfile`s).

I think that all it needs is a `_hash_` class function defined. Proof of concept:

Then, we could do set operations on teams - one need I have right now is to find users that pre-registered for a challenge that haven't yet registered.

The trick would be if it can be added to the high level `DictObject` class, or if each subclass would need it's own local `_hash_` class function.

Environment

None

Activity

Show:
Bruce Hoff
April 22, 2019, 8:35 PM

Removing from Genentech challenge epic, since the challenge is over. Assigning to myself for analysis.

Kenneth Daily
January 30, 2019, 11:19 PM

Correct. But I should be able to compare and use the objects that represent people without having to compare their principal IDs and then filter the objects afterwards.

Meredith Slota
December 8, 2018, 1:01 AM

Based on my understanding from 's explanation, comparing user lists (e.g. teams, etc.) is already possible by using the principal ID. So this is more of a documentation how-to-do issue than a change in the API, yes?

Kimyen Truong
November 21, 2018, 11:02 PM

After discussion with Bruce and Meredith, the use case that I am trying to solve in this ticket* is unrelated to the ticket. (I am trying to reduce complexity in the Python client code base in handling Synapse objects.) So I will create a separate Jira ticket for it, and keeping this one for Genentech Issues. Removing the "DictObject" label.

Meredith Slota
November 21, 2018, 10:07 PM

Yes – and in this case, we would never actually encounter the duplicate team members post-submission since the system doesn't let them submit. I'm proposing that we undo that rule at the submission stage and move validation rules like this to post-submission but pre-scoring.

In the current system, we prioritize the FIRST submitter, rather than invalidating ALL submissions from any team w/ a duplicate member. Only the second team to submit is blocked, rather than both teams being blocked for violating the rules. This needs more discussion, but this doesn't block the related ticket PLFM-5257. Linking these tickets since there's discussion in each.

Your pinned fields
Click on the next to a field label to start pinning.

Assignee

Jordan Kiang

Reporter

Kenneth Daily

Validator

James Eddy