jwir3 / arbitrator

A synchronization engine for ArbiterSports to Google Calendar
GNU General Public License v3.0
3 stars 0 forks source link

Make arbitrator better able to parse sport levels #21

Closed jwir3 closed 7 years ago

jwir3 commented 9 years ago

Right now, arbitrator relies on an exact hash map of sport levels in order to parse them and place them in the Game data structure. It would be nice if an heuristic was used instead, so that for example, whether it is a Boys' or Girls' game, level of the sport (e.g. "Squirt", "Mite", etc...), and the sub-level of the sport (e.g. "Varsity", "A", "AA", etc...) were all determined independently.

jwir3 commented 7 years ago

Also, we should add a U15 level, since it looks like the U15 level is not currently being tracked in the scheduled events (the game level appears to just be blank).

jwir3 commented 7 years ago

So, what I'm considering doing for this feature is to have an overarching LevelProfiles object, which is stored in the configuration. This is a set of GameLevel objects. Each GameLevel object is a set of GameAgeLevel objects. The hierarchy looks like:

- LevelProfiles
   - GameAge(age)
    - GameAgeLevel(regex, age, level)

So, we might have something like:

- Level Profiles
  - GameAge('Bantam')
    - GameAgeLevel('...', 'Bantam', 'A')
    - GameAgeLevel('...', 'Bantam', 'B1')
    - GameAgeLevel('...', 'Bantam', 'B2')
    - GameAgeLevel('...', 'Bantam', 'C')

So, now the trick here is that we need to somehow generate the regular expressions for each GameAgeLevel. I suspect what we could do is use the following general algorithm:

Search for the first letter of the name of game age and the full word of the game level, followed by some number of characters, and then the level. If more than one `GameAgeLevel` matches, then separate them by 'OR' in the output string. 
jwir3 commented 7 years ago

Each one is going to probably be slightly different, since, for example, U15 and 15U are, essentially, the same thing. :(

jwir3 commented 7 years ago

This is almost completely done. We have a series of minor bug fixes and tweaks once this lands, though.

Things left to do here: