Habit History provides a CSV file with Habits and Dailies activity from the last week and a sampling of history from previous months. The date of each row is in Coordinated Universal Time (UTC). This data is designed to help you examine how your progress changes over time, and so To Do items are not included (since progress over time is not relevant for To Do's).
Limitations on Data StoredEdit
To improve performance of the website and mobile apps and to reduce database storage costs, Habitica does not keep all historical data for all tasks. Instead, older data is averaged and only the average is included in the data exports. The further back in time the data goes, the more data is combined together into a single average. In addition, completed To Do's are automatically deleted at a certain time after they have been completed.
Because older task history is severely limited, players who want to keep a full history of tasks should export their data regularly.
How to Open the Exported FilesEdit
The CSV file is best opened with a spreadsheet program such as Microsoft Excel or LibreOffice Calc. The program will probably automatically make the file look just like a spreadsheet; if it does not, search through the program's documentation for "importing" or "converting" CSV files, for "splitting" data at commas, or for a "text to column" feature.
The JSON file can be viewed in a JSON viewer such as the online JSON Viewer from Code Beautify or in a text editor (see below).
XML files can usually be viewed in a browser, but the Habitica XML file uses a non-standard format for element names, which prevents most or all browsers from displaying it correctly. It can be viewed in an XML viewer such as the online XML Viewer from Code Beautify or in a text editor.
If a text editor is used for viewing JSON or XML files, it should be one that is optimized for source code, such as Notepad++ for Windows, TextMate for MacOS, or vi or emacs for Unix/Linux. Using a mono-spaced font will make the files easier to read. Advanced word processors such as Microsoft Word are not recommended.
How to Understand the DataEdit
If you have questions about the data that are not answered here, use the "Start a Discussion" button below to ask them. You will probably receive an answer within a day.
- The value for a Habit or Daily is the numerical value used to calculate rewards and damage. Task Value gives you more information about this.
- The date is sometimes in an integer format that represents the number of milliseconds since 1/1/1970 (e.g., 1388602586109 is 2014-01-02 04:56:26 and 109 milliseconds). This is a common date format for programming and data storage. There are converters available such as www.epochconverter.com. Note that another common date format is seconds since 1970 (not milliseconds); if the converter you use can take seconds but not milliseconds, then divide the date by 1000 (e.g., enter 1388602586 instead of 1388602586109).
- Task ID or id is a random string of letters and numbers that uniquely identifies the task (e.g., 2a4f24dd-29bd-463f-a899-e6740e478686).
- If you're having trouble understanding the data, try the Data Display Tool (direct link) for an easier-to-understand breakdown of your data. You will need your User ID and API token.
Extracting Habits, Tasks, and To Do's from JSON Edit
If you are using a computer that has the command-line grep program installed, you can use the sample code below to parse the contents of your exported JSON file resulting in a readable list of your Habits, Tasks, and To Do's. Specifically, the command will do the following:
- Extract lines beginning with "text" from the JSON file (called "userdata.json" here)
- Convert all instances of "text" to "-"
- Convert all checklist items from "-" to "*" and indent them
- Move the reformatted text to a new JSON file (called "usernewdata.json" here)
grep "text" userdata.json | sed s/\"text\"\:/*/ | sed "s/^......\*/ -/" >> usernewdata.json
Note: that is six (6) consecutive periods, and six (6) consecutive spaces in the above code sample.
Further discussion and context can be found at How to view exported data? (.CSV, .XML, .JSON files)