-
Notifications
You must be signed in to change notification settings - Fork 4
Improve input to classification functions #112
Copy link
Copy link
Closed
Description
At present inputs to the classification functions are clunky and fickle, as per a couple of points raised by @TomHall2020 in #103
- Lots of string inputs
- Unclear what is expected 'ladies', 'female', 'women' etc.
- Hard to get information on what is expected - not in docs, no useful feedback when wrong, have to examine source.
It would be nice to resolve some of these.
I have been pondering this for a while and will consolidate thoughts here before deciding and tackling the issue.
- Have a 'category' class
- input are strings, but returns a definitive format that is then used as single input to classification functions
- variation in inputs (upper/lower cases etc.) handled here in one definitive piece of code
- But how to handle different systems - e.g. old and new age groups?
- Will break the current API
- Feels clunky - need to construct this class before calling a classification function, and checks still need to be done
- Use a python Enum
- Provide an enum of form
AGB_outdoor_ages.U18 - Perhaps using a
Flagclass of enum we could have all categories listed, but then create subsets as relevant to the different schemes - Use class methods from the enum flag to check things
- Make enum flag available at classification import level - this would provide users with feedback about acceptable inputs at runtime.
- Could access the string and number part from
my_age = AGB_outdoor_ages.U18usingmy_age.nameandmy_age.valuefor purposes of looking up in classification dicts - Will break API
- Number of inputs to the classification functions stay the same, but now rigorously restricted and options can be documented/queried.
- Provide an enum of form
Other thoughts:
- This will likely be API breaking, which means we'd need to move to version 2.0
- Irritating, as prefer to avoid this, but userbase is probably still localised enough (I think...) and this issue serves as first advance warning.
- Moving to
U18,U16would be nicer thanUnder 18- But what to do for "Adult"?
SNR? - could be confused with 50+.A? - bit short.
- But what to do for "Adult"?
- could the above suggestions somehow be combined?
- E.g. option of specifiying age, bowstyle, gender separately to function, or as one "class" item?
- Probably not worth it, and creates overly verbose code.
- E.g. option of specifiying age, bowstyle, gender separately to function, or as one "class" item?
- Similarly, is there a way to make this backwards compatible
- Not fully I think, and again, probably not worth it creating overly verbose spaghetti code
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels