{"action":"created","issue":{"url":"https://api.github.com/repos/Data-Jamming/Music-Genre-Predictor/issues/1","repository_url":"https://api.github.com/repos/Data-Jamming/Music-Genre-Predictor","labels_url":"https://api.github.com/repos/Data-Jamming/Music-Genre-Predictor/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/Data-Jamming/Music-Genre-Predictor/issues/1/comments","events_url":"https://api.github.com/repos/Data-Jamming/Music-Genre-Predictor/issues/1/events","html_url":"https://github.com/Data-Jamming/Music-Genre-Predictor/issues/1","id":299513652,"number":1,"title":"Cache Processed Data Locally","user":{"login":"jcgallegdup","id":13096220,"avatar_url":"https://avatars0.githubusercontent.com/u/13096220?v=4","gravatar_id":"","url":"https://api.github.com/users/jcgallegdup","html_url":"https://github.com/jcgallegdup","followers_url":"https://api.github.com/users/jcgallegdup/followers","following_url":"https://api.github.com/users/jcgallegdup/following{/other_user}","gists_url":"https://api.github.com/users/jcgallegdup/gists{/gist_id}","starred_url":"https://api.github.com/users/jcgallegdup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcgallegdup/subscriptions","organizations_url":"https://api.github.com/users/jcgallegdup/orgs","repos_url":"https://api.github.com/users/jcgallegdup/repos","events_url":"https://api.github.com/users/jcgallegdup/events{/privacy}","received_events_url":"https://api.github.com/users/jcgallegdup/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-22T21:25:13Z","updated_at":"2018-02-23T02:20:21Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"### Motivation\r\nTo make our programs run faster, we want to avoid processing the data from scratch every time.\r\n\r\n### Use Case\r\nAt different steps of the data processing pipeline, we'll have the option to load already-processed data from a cache file; similarly, we'll write to cache files when we add a new data processing phase.\r\n\r\nFor example, one of the first things that we will do with our data is remove data entries with bad `Genre` entries (e.g. \"Other\", \"\"). We can store the resulting dataset in a cache file so that next time we run our program, we can just load it from the cache file instead of processing the data again.\r\n\r\n### Acceptance Criteria\r\n- [ ] new module in `utils` e.g. `cache.py`\r\n- [ ] `cache.py` has separate methods to save and load data\r\n  - e.g. `def save(path_to_file, data)`\r\n  - e.g. `def load(path_to_file)`\r\n- [ ] add to `.gitignore`: we do **not** track cache files; they are for local dev convenience only\r\n  - [ ] choose an arbitrary extension for the cache files\r\n\r\n### Reference\r\n- See [pickle module docs](https://docs.python.org/3/library/pickle.html)"},"comment":{"url":"https://api.github.com/repos/Data-Jamming/Music-Genre-Predictor/issues/comments/367889436","html_url":"https://github.com/Data-Jamming/Music-Genre-Predictor/issues/1#issuecomment-367889436","issue_url":"https://api.github.com/repos/Data-Jamming/Music-Genre-Predictor/issues/1","id":367889436,"user":{"login":"jcgallegdup","id":13096220,"avatar_url":"https://avatars0.githubusercontent.com/u/13096220?v=4","gravatar_id":"","url":"https://api.github.com/users/jcgallegdup","html_url":"https://github.com/jcgallegdup","followers_url":"https://api.github.com/users/jcgallegdup/followers","following_url":"https://api.github.com/users/jcgallegdup/following{/other_user}","gists_url":"https://api.github.com/users/jcgallegdup/gists{/gist_id}","starred_url":"https://api.github.com/users/jcgallegdup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcgallegdup/subscriptions","organizations_url":"https://api.github.com/users/jcgallegdup/orgs","repos_url":"https://api.github.com/users/jcgallegdup/repos","events_url":"https://api.github.com/users/jcgallegdup/events{/privacy}","received_events_url":"https://api.github.com/users/jcgallegdup/received_events","type":"User","site_admin":false},"created_at":"2018-02-23T02:20:21Z","updated_at":"2018-02-23T02:20:21Z","author_association":"CONTRIBUTOR","body":"Something like:\r\n\r\n```python\r\ndef load(filename):\r\n    try:\r\n        with open(filename, 'r') as f:\r\n            return pickle.load(f)\r\n    except FileNotFoundError as e:\r\n        print(\"{} file was not found\".format(filename))\r\n    return None\r\n\r\ndef save(filename, obj):\r\n    try:\r\n        with open(filename, 'w') as f:\r\n            pickle.dump(obj, f)\r\n    except FileNotFoundError as e:\r\n        print(\"{} file was not found\".format(cache_file))\r\n```"}}
{"actor":{"display_login":"jcgallegdup"}}