|
| 1 | +# Project TODO and Notes |
| 2 | + |
| 3 | +## TODOs: |
| 4 | + |
| 5 | +- be able to set scopes when initializing the client |
| 6 | + |
| 7 | +- security notes |
| 8 | + |
| 9 | +- PyPi deployment |
| 10 | + |
| 11 | +- For all `create_...`methods, add the ID from the response to logs and maybe |
| 12 | + something human readable, like the first n characters of the name??. Right |
| 13 | + now: |
| 14 | + |
| 15 | +```log |
| 16 | +[2025-02-05 06:09:34,828] INFO [fitbit_client.NutritionResource] create_food_log succeeded for foods/log.json (status 201) |
| 17 | +``` |
| 18 | + |
| 19 | +- base.py: reorganize and see what we can move out. |
| 20 | + |
| 21 | + - Rename to `_base`? Files it first, makes it clearer that everything in it is |
| 22 | + private |
| 23 | + |
| 24 | +- client.py: |
| 25 | + |
| 26 | + - Creat and Test that all methods have an alias in `Client` and that the |
| 27 | + signatures match |
| 28 | + |
| 29 | +- CI: |
| 30 | + |
| 31 | +* Read and implement: |
| 32 | + https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/configuring-advanced-setup-for-code-scanning#configuring-advanced-setup-for-code-scanning-with-codeql |
| 33 | + |
| 34 | +- exceptions.py Consider: |
| 35 | + - Add automatic token refresh for ExpiredTokenException |
| 36 | + - Implement backoff and retry for RateLimitExceededException |
| 37 | + - Add retry with exponential backoff for transient errors (5xx) |
| 38 | + |
| 39 | +## Longer term TODOs |
| 40 | + |
| 41 | +- Performance profiling |
| 42 | + |
| 43 | +- Docs! https://www.sphinx-doc.org/en/master/#get-started (put on github pages?) |
| 44 | + |
| 45 | +- Why does this log twice: |
| 46 | + |
| 47 | +```log |
| 48 | +[2025-02-07 16:41:38,471] ERROR [fitbit_client.NutritionResource] ValidationException: Intensity level "MEDIUM" available only if weight objective is to lose weight. [Type: validation, Status: 400], Field: intensity |
| 49 | +[2025-02-07 16:41:38,472] ERROR [fitbit_client.NutritionResource] ValidationException in create_food_goal for foods/log/goal.json: Intensity level "MEDIUM" available only if weight objective is to lose weight. |
| 50 | +
|
| 51 | +``` |
| 52 | + |
| 53 | +- For methods with paging, figure out how to encapsulate it...do they call |
| 54 | + `_make_request` with the URL in the response, or what? Does the response |
| 55 | + return a 2-tuple where the first item is the response and second is a |
| 56 | + pre-baked function that can me called? See: |
| 57 | + https://g.co/gemini/share/ce142f7e323a |
| 58 | + |
| 59 | + - Implement as `(response, page_forward, page_backward)` so that the user can |
| 60 | + use the names `next_page` and `previous_page`, eg. |
| 61 | + `next_page = page_forward()` |
| 62 | + - hopefully we can put this is `utils/page_helper.py` somehow, so that it can |
| 63 | + be reused. |
| 64 | + - We may need a public version of a generic `make_request` method. |
| 65 | + |
| 66 | +- Form to change scopes are part of OAuth flow? Maybe get rid of the cut and |
| 67 | + paste method altogether? It's less to test... |
| 68 | + |
| 69 | +- Extension ideas: |
| 70 | + |
| 71 | + - Make the food download_food_logs method (rename to `get_food_logs`) and food |
| 72 | + log to CSV part of one helper package. It should expand the foods to have |
| 73 | + their complete nutrition (a separate call for each unique food) (put this in |
| 74 | + a `tools` package??) |
| 75 | + - PRIVATE filters on methods that return PUBLIC and PRIVATE stuff (API doesn't |
| 76 | + seem to have this). Would require a sidecar database or pickle - it just |
| 77 | + needs to be a hash with a few elements to facilitate a lookup via the api |
| 78 | + - Consider e.g., a "replace_food_log" extension that does a delete + an add in |
| 79 | + one. (there might be several of these that make sense--just take an ID and |
| 80 | + then the signature of the "create" method). |
| 81 | + |
| 82 | +- Enum for units? (it'll be big, maybe just common ones?) |
0 commit comments