Skip to content

Commit

Permalink
some minor changes before I migrate this project to typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
HeyParkerJ committed Oct 25, 2024
1 parent 24e2e85 commit 5fa3093
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-to-lambda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
installer-parallel: true
- name: Build Project
run: |
poetry install --only main --sync --no-interaction
# poetry install --only main --sync --no-interaction
poetry shell
poetry build
poetry run pip install --upgrade -t package dist/*.whl
Expand Down
33 changes: 26 additions & 7 deletions sleeper_data_pypline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,21 @@

load_dotenv()

# TODO - can I create an effective 'scores' csv export that lets me crunch data faster?
# TODO - given a season and a roster id, figure out the display_name
# Can/should I just add a mapping of roster_id::display_name::owner_id/etc to the 'league' collection?
# TODO - Calculate high scores of the week
# TODO - How many (and which) players were both drafted and started by the championship team in the championship week?
def init():
def lambda_handler(event, context):
# Extract arguments from the event (assume they're passed as a dictionary)
command = event.get('command', '')
season = event.get('season', '')

# Call the main function with these arguments
# init()

# Return a response
return {
'statusCode': 200,
'body': 'Function executed successfully'
}

def parseArgs():
parser = argparse.ArgumentParser(description="Sleeper pipeline ETL scripts and data utilities")

subparsers = parser.add_subparsers(dest="command", help="Sub-command help")
Expand All @@ -39,7 +48,15 @@ def init():
parser_query.add_argument("season", type=str, help="The season (ex: 2022)")

args = parser.parse_args()
return args


# TODO - can I create an effective 'scores' csv export that lets me crunch data faster?
# TODO - given a season and a roster id, figure out the display_name
# Can/should I just add a mapping of roster_id::display_name::owner_id/etc to the 'league' collection?
# TODO - Calculate high scores of the week
# TODO - How many (and which) players were both drafted and started by the championship team in the championship week?
def init(args):
valid_actions = [
"identify",
"etl",
Expand Down Expand Up @@ -115,4 +132,6 @@ def init():
print('Query action: {} is not a valid action'.format(args.action))
raise

init()
if __name__ == "__main__":
args = parseArgs()
init(args)

0 comments on commit 5fa3093

Please sign in to comment.