Hi,
I'm working on a hobby project to match people through a matching arrangement of songs. It can be either a group of favourite songs or something that presents a subjective, conceptual whole to users.
The application model
Song groups
A user can create song groups of three, four, or five. A user can deactivate an active group or activate a deactivated group and put them in an active or inactive state respectively.
Song groups are immutable. When a user wants to update a group, a new group instead is created and the "forked" one is archived for historical purposes.
Users can also archive their groups manually.
Archived groups don't participate in matching, so all matches established through them are destroyed.
Matching
Matches can only happen between song groups of the same size, i.e. triads with triads, tetrads with tetrads and pentads with pentads.
By default matches happen irrespective of the song order, but users can change that on the group level.
When matched users can see the match score - 3/3 when both of them put songs in the same order, 2/3 when two songs are in the same order, 1/3 when only one song is in the same order or 'reverse' when the song order is opposite.
Songs are matched by their ISRC property (International Standard Recording Code).
All matches are one-to-one, so if three users A, B and C
have the same triad they form three pairs: AB
, BC
and AB
.
Chatting
Matched users can exchange messages.
All users with the same song group can chat together in a room dedicated to that group. There is only one universal chat room per song group.
Considerations
A song group per user or one universal song group?
There is a tension between keeping a history of song groups for a specific user and matching them through the same group of songs.
So far I'm leaning towards having a universal CanonicalSongSet that a User can relate to.
A single SongGroup
or Triads
, Tetrad
and Petrad
?
Naturally, I would love to not have nullable fields, but the logic for Triads
, Tetrads
and Petrads
will be the same.
I think I can handle that with polymorphism but I'm not sure if it makes sense from the db engine perspective.
How to link Users, their SongGroups and CanonicalSongSets?
I found two options - positional argument and direct linking.
With positional arguments, I'd store the user's order in an array on the SongGroup and then link it to the CanonicalSongSet.
With direct linking, I would link the user's SongGroup to the CanonicalSongSet not with one -BASED_ON->
link but with a link per song to store the user-provided song order in it.
Which one do you think works best?
This is my first attempt to data modelling with graph databases, so please consider me a total newbie.
Best,
Yevhenii