{"id":23991219,"url":"https://github.com/zaataylor/time-tracking","last_synced_at":"2026-06-13T02:01:59.796Z","repository":{"id":196729714,"uuid":"317063163","full_name":"zaataylor/time-tracking","owner":"zaataylor","description":"Extract and preprocess time tracking data from the Clockify API.","archived":false,"fork":false,"pushed_at":"2020-11-30T12:12:56.000Z","size":44,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-01-07T19:30:02.570Z","etag":null,"topics":["clockify","python","python3","time-tracking"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zaataylor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-11-29T23:25:38.000Z","updated_at":"2023-09-29T12:58:18.000Z","dependencies_parsed_at":"2023-09-27T06:18:01.842Z","dependency_job_id":null,"html_url":"https://github.com/zaataylor/time-tracking","commit_stats":null,"previous_names":["zaataylor/time-tracking"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaataylor%2Ftime-tracking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaataylor%2Ftime-tracking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaataylor%2Ftime-tracking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaataylor%2Ftime-tracking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zaataylor","download_url":"https://codeload.github.com/zaataylor/time-tracking/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240605711,"owners_count":19827981,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clockify","python","python3","time-tracking"],"created_at":"2025-01-07T19:30:03.126Z","updated_at":"2026-06-13T02:01:54.773Z","avatar_url":"https://github.com/zaataylor.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Time Tracking Experiment (Fall 2020)\n\n## Description\n\nThis is the code for the time tracking experiment that I did during the Fall 2020 semester.\nYou can use the code to get JSON-formatted data of all of your Clockify time entries in your\nactive workspace.\n\nA writeup of my findings will be posted soon, and this README will be updated with its location.\n\nThis is really just something I did for fun, so I'm not planning on making any major updates\nto the code for the project after this, aside from possibly adding some visualization-related code. \n\nOne of the known limitations of the code is that it chooses whatever is designated as your active\nworkspace by default. Since I am a first-time Clockify user and only have one active workspace,\nthis was not an issue for me, but you may have to rework the code if you have more workspaces\nand this causes problems for you.\n\n## Getting Started\n\n### Prerequisites\n- Python 3.7+.\n- [`Pipenv`](https://pipenv.pypa.io/en/latest/) tool. This tool makes installing the\ndependencies for this project and handling virtual environments straightforward. So, if you\nhaven't installed that, do so using the steps detailed [here](https://pipenv.pypa.io/en/latest/install/#installing-pipenv).\n- You're currently logged into Clockify and have an active workspace.\n\n### Steps\n1. Generate an API key by going to your user [settings](https://clockify.me/user/settings) page and scrolling down to the **API** heading. Then click _Generate_ to generate a personal API key. Store this API key in an environment variable named `CLOCKIFY_API_KEY`. Alternatively, you can add the \nAPI key as a command-line argument using the `-a` or `--api-key` options.\n\n2. Clone the project repo and enter it:\n```bash\ngit clone https://github.com/zaataylor/time-tracking.git\ncd time-tracking\n```\n\n3. Install the required project dependencies included in the `Pipfile` and activate the created\nvirtual environment using:\n```bash\npipenv install\npipenv shell\n```\n\n4. Get time tracking data by invoking `python get_time_data.py` with the proper command line parameters. The simplest invocation to get started is:\n```bash\npython get_time_data.py -a {API_KEY} --num-entries {NUM_ENTRIES}\n```\nwhere `API_KEY` is the value of the key obtained from step 1 and `NUM_ENTRIES` is a \npositive integer representing some number of entries made in Clockify. Here is the full \nusage information:\n```bash\nusage: get_time_data.py [-h] [-a API_KEY]\n                        (--num-pages NUM_PAGES | --num-entries NUM_ENTRIES)\n                        [-p PROJ_FILE] [-t TASKS_FILE] [-e ENTRIES_FILE]\n                        [-d DELAY]\n\nGet Clockify projects, tasks, and time entry data and write it to files.\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -a API_KEY, --api-key API_KEY\n                        Your personal Clockify API key. If not specified here,\n                        then you must have the CLOCKIFY_API_KEY environment\n                        variable set on your system.\n  --num-pages NUM_PAGES\n                        The number of (contiguous) pages to request from the\n                        Clockify API.\n  --num-entries NUM_ENTRIES\n                        Lower bound on the number of entries to grab from the\n                        Clockify API. If specified, this value will be used to\n                        calculate how many pages to grab from the Clockify\n                        API.\n  -p PROJ_FILE, --projects-file PROJ_FILE\n                        The name of the file to write projects information to.\n                        Defaults to 'projects.json' if not specified.\n  -t TASKS_FILE, --tasks-file TASKS_FILE\n                        The name of the file to write tasks information to.\n                        Defaults to 'tasks.json' if not specified.\n  -e ENTRIES_FILE, --entries-file ENTRIES_FILE\n                        The name of the file to write time entry data to.\n                        Defaults to 'entries.json' if not specified.\n  -d DELAY, --delay DELAY\n                        Delay between subsequent calls to the Clockify API, in\n                        seconds. Default value is 0.2. Using a value less than\n                        this may cause the program to fail due to Clockify API\n                        rate limiting.\n\nHave fun tracking! :)\n```\n\n5. (Optional) Invoke the `preprocess_data.py` script to process the time entry data\nretrieved from the Clockify API in an opinionated fashion. The simplest invocation\nto get started (assuming no file name parameters were specified in step 4) is:\n```bash\npython preprocess_data.py\n```\nHere's an example of what the preprocessor script does to a time entry:\n\nRaw Clockify API data:\n```JSON\n{\n        \"id\": \"5fb02c5f94454c3d296af408\",\n        \"description\": \"Read PRIMES is in P\",\n        \"tagIds\": null,\n        \"userId\": \"some-user-id-here\",\n        \"billable\": true,\n        \"taskId\": \"5f30780549070a418a96891b\",\n        \"projectId\": \"5f306f4649070a418a968435\",\n        \"timeInterval\": {\n            \"start\": \"2020-11-14T19:13:35Z\",\n            \"end\": \"2020-11-14T19:20:31Z\",\n            \"duration\": \"PT6M56S\"\n        },\n        \"workspaceId\": \"some-workspace-id-here\",\n        \"isLocked\": false,\n        \"customFieldValues\": null\n    }\n```\nPreprocessed Data:\n```JSON\n{\n        \"task_id\": \"5f30780549070a418a96891b\",\n        \"task_name\": \"MA 522\",\n        \"project_id\": \"5f306f4649070a418a968435\",\n        \"project_name\": \"Classes\",\n        \"description\": \"read primes is in p\",\n        \"start_time_utc\": \"2020-11-14T19:13:35Z\",\n        \"start_date_utc\": \"2020-11-14\",\n        \"end_time_utc\": \"2020-11-14T19:20:31Z\",\n        \"end_date_utc\": \"2020-11-14\",\n        \"duration_seconds\": 416\n    }\n```\n\nYou can see more detailed usage information here:\n```bash\nusage: preprocess_data.py [-h] [-p PROJ_FILE] [-t TASKS_FILE]\n                          [-e ENTRIES_FILE] [-d PROC_DATA_FILE] [--csv]\n\nPreprocess Clockify API data from files in an opinionated fashion.\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -p PROJ_FILE, --projects-file PROJ_FILE\n                        The name of the file to get projects information from.\n                        Defaults to 'projects.json' if not specified.\n  -t TASKS_FILE, --tasks-file TASKS_FILE\n                        The name of the file to get tasks information from.\n                        Defaults to 'tasks.json' if not specified.\n  -e ENTRIES_FILE, --entries-file ENTRIES_FILE\n                        The name of the file to get time entry data from.\n                        Defaults to 'entries.json' if not specified.\n  -d PROC_DATA_FILE, --data-file PROC_DATA_FILE\n                        The name of the file that will hold the preprocessed\n                        data. Defaults to 'preprocessed_data.json'.\n  --csv                 Specify this flag to indicate that the data should\n                        also be exported to CSV format. The CSV file will have\n                        the same name as the file specified by the -d/--data-\n                        file argument, or be named 'preprocessed_data.csv' if\n                        that argument is not given.\n\nHave fun preprocessing! :)\n```\nThe processing logic in `preprocess_data.py` is fairly extensible, so feel free to add logic that\nmakes more sense for your use case. :)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaataylor%2Ftime-tracking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzaataylor%2Ftime-tracking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaataylor%2Ftime-tracking/lists"}