Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backend restructuring issue tracker #25

Open
1 of 4 tasks
aaron-schroeder opened this issue Feb 21, 2023 · 0 comments
Open
1 of 4 tasks

Backend restructuring issue tracker #25

aaron-schroeder opened this issue Feb 21, 2023 · 0 comments
Labels
Feature Ideas Refactor Internal refactoring of code
Milestone

Comments

@aaron-schroeder
Copy link
Owner

aaron-schroeder commented Feb 21, 2023

Realized "Activity" isn't the center of the package - the ability to create file-specific dataframe formats is.

Notes and musings

  • I originally thought of arranging the backend like SQLAlchemy, but then realized that a general standalone package would be called for. Package structure issue tracker XPathletics#1
  • *Factory API -> top-level Activity-like classes
    • GpxTrk/GpxRte/TcxActivity/...
      1. Create manually with XMLSchemaFactory (name pending - might describe wrong thing)
      2. Create XsdSchemaParser to automatically build such a structure from a schema file.
    • FitActivity
      1. io.fit uses fitparse to make a df structured like a fit file (index is msg number)
      2. (someday, maybe) create FitProfileParser if fitparse presents a limitation in the future
    • StravaActivity
      1. Create manually with JsonSchemaFactory
      2. Create a json schema parser, if such a standard schema is defined.
    • Other top-level classes I hadn't even thought of:
      • Race
        • Based on the structure of athlinks results
        • Column level 1: Fields.
          - split name (row index?)
          - cumulative distance (dtype='pint[m]')
        • Column level 2: athlete name (validator: any str)
        • Column level 3: age group (validator: 2-elem tuple with (bound_lo, bound_hi))
        • Column level 4: gender (validator: must belong to a list of str, eg ['M', 'F', 'NB'])
        • (Column level 5: inbound/outbound (validator: 1 of 2 choices))
        • place = rank(timestamp, filter_by=['gender', 'age_group'], start=1) -> race.place(athlete_nm, filters=['gender'], split='Halfmoon')
        • split_time = value(time_offset, index_by='Lap')
  • ActivityMixin
    • Migrate most existing Activity functionality here
    • Modify still-relevant Activity tests to look for FitActivity, TcxActivity, GpxTrk classes which are themselves built using other parts of the public API.
  • Row and column index classes: either IndexLabel or {RowLabel, ColLabel}
    • ColLabel(name='source', options=['strava', 'file']) (isn't this really a multiindex level descriptor though?)
    • ColLabel(name='timestamp', dtype=tzdtype)
      • tzdtype = pd.DatetimeTZDtype(tz='UTC')) or pd.DatetimeTZDtype(tz='dateutil/US/Central'))
    • ColLabel(name='DistanceMeters', dtype='pint[m]', restrictions=['flat_or_increasing', '>0'])
      • restrictions kwarg is just a sketch of a catch-all functionality. Inspired by something else that escapes me rn.
    • RowLabel(name='Lap', restrictions=['start_at_0', 'flat_or_plus_1'])
@aaron-schroeder aaron-schroeder added Refactor Internal refactoring of code Feature Ideas labels Feb 21, 2023
@aaron-schroeder aaron-schroeder added this to the 0.1 milestone Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Ideas Refactor Internal refactoring of code
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant