Migrate your habits from Nomie to Loop Habit Tracker.
Find a file
2021-08-31 18:05:59 +02:00
loop Refactor habit list collection in repetition migration 2021-08-31 18:05:59 +02:00
.gitignore Add gitignore for data and outputs 2021-08-27 10:13:22 +02:00
CHANGELOG.md Bump version number 2021-08-30 23:40:04 +02:00
migrate.py Add habit duplicate checking 2021-08-28 10:35:29 +02:00
poetry.lock initial commit 2021-08-26 21:57:49 +02:00
pyproject.toml Bump version number 2021-08-30 23:40:04 +02:00
README.md Add database merging to README 2021-08-28 23:07:30 +02:00

Nomie Habit Migrator

Can take an export of nomie habits in json format and convert it to be importable in Loop Habit Tracker.

Confirmed working for nomie version 5.6.4 and Loop Habit Tracker version 2.0.2. Presumably works for other nomie 5.x versions and other Loop 2.x versions as well, but is untested.

Usage

Currently takes a single argument, the nomie database file, and will output to output.db in present working directory. Can also take an existing Loop Habit database (exported from the application), and add the nomie exported habits and checkmarks to it. Simply put the exported Loop database in the same directory and call it output.db, it will not (should not) overwrite anything.

Invoked like: python migrate.py nomie-export.json

Schemas

A collection of the schemas of Loop habit sqlite database for later migration

Loop Habit Tracker

Repetitions - 2021-08-26 -- seems to replace the older Chains table?

id|habit|timestamp|value 1|1|1629936000000|2 2|2|1629936000000|2 3|2|1629676800000|2

Habits - from 2021-07-23

id | archived | color | description | freq_den | freq_num | highlight | name | position | reminder_hour | reminder_min | reminder_days | type | target_type | target_value | unit | question | uuid 1 | 0 | 4 | | 1 | 1 | 0 | mood | 0 | | | 0 | 1 | 0 | 10.0 | | How do you feel today? | d183a7dd755e44ce9a5782f518b402b4 2 | 0 | 1 | | 1 | 1 | 0 | reading | 1 | | | 0 | 0 | 0 | 0.0 | | Did you read today? | 6b361353e0914a698e896798d5ebca6e 3 | 0 | 15 | | 1 | 1 | 0 | sex 💏 | 2 | | | 0 | 0 | 0 | 0.0 | | Did you have sex today? | 41b646162dc542b3ba223993847d861b

Habits - from 2021-08-26

id | archived | color | description | freq_den | freq_num | highlight | name | position | reminder_hour | reminder_min | reminder_days | type | target_type | target_value | unit | question | uuid 1 | 0 | 11 | | 1 | 1 | 0 | Gt | 0 | | | 0 | 0 | 0 | 0.0 | | | cfed6f97b67e435d8461ba1accf7457e 2 | 0 | 15 | And note | 3 | 1 | 0 | Iamtrack | 1 | 23 | 0 | 127 | 0 | 0 | 0.0 | | And have all fields? | 1ebe2d429e0d4cd293b1ea038c2b079a

Chains - habit maps to habit table ID - 2021-07-23

id|habit|timestamp|value 1|1|1627257600000|5000 2|2|1627257600000|2 3|2|1627171200000|2 4|2|1626998400000|2 5|1|1626912000000|10000 6|1|1626998400000|3000 7|3|1627171200000|2

EVENTS -- empty?

Nomie

Schema translation

trackers: nomie -> loop

? | id (primary key increasing id for each tracker, should autoincrement) hidden | archived color | color (but nomie: #369DD3, loop 2 of available selection) label + emoji | name ? | description (a little one-liner extended description) ? | freq_den (frequency denominator, either 7 for per week or 30 for per month) ? | freq_num (frequency numerator, how often per week/month. Has to be one for ranges afaik?) ? | highlight (function ??) ? | position (which vertical position on screen tracker takes. must be unique?) ? | reminder_hour (simple int) ? | reminder_min (simple int) ? | reminder_days (simple int, but i'm not sure how, saw 127) type | type (range,counter [more in nomie]; string in nomie, int in loop) ? | target_type (??) ? | target_value (maximum value for range habits afaik) uom | unit (text description of value, in nomie set values with num being no-value count) ? | question (text question tracker asks) id | uuid (unique id, must be unique surprisingly)

nomie has no concept of 'ideal' repetitions (i.e. success if.. once a day; twice a week; 4 miles a month; ...) nomie has no concept of reminder times for trackers loop has no concept of 'score' associated to trackers (when e.g. tracking bad things)

Nomie trackers

{ 'mood': { 'tag': 'mood', 'id': '02283493c7ed0b8dd08de38ae5ca4944', 'type': 'range', 'color': '#369DD3', 'math': 'mean', 'ignore_zeros': False, 'uom': 'num', 'emoji': '😉', 'default': '3', 'max': '10', 'min': '1', 'score': 'custom', 'score_calc': [{'if': 'value', 'is': 'gt', 'v': 5, 'sc': '1'}, {'if': 'value', 'is': 'lt', 'v': 5, 'sc': '-1'}], 'goal': None, 'one_tap': False, 'include': '', 'hidden': False, 'label': 'Mood' }, 'cigarette': { 'tag': 'cigarette', 'id': '551faae2c5d865ca81e20d00c952b679', 'type': 'tick', 'color': '#EB144C', 'math': 'su m', 'ignore_zeros': False, 'uom': 'num', 'emoji': '🚬', 'default': None, 'score': '-1', 'one_tap': True, 'incl ude': '', 'hidden': False, 'label': 'Cigarette' }, }

DataFrame sample from Nomie

      _id                                               note            end          start  score  lat  lng location  offset modified    source

0 a1a85aac2f #mood(7) #social #date #cigarette #alcohol #go... 1546282800000 1546282800000 0 NaN NaN -60 False importer 1 d717092fbd #mood(7) #reading #social #cigarette #good_mea... 1546209780000 1546209780000 0 NaN NaN -60 False importer 2 311a54f23e #mood(7) #work #social #date #cigarette #relax 1530381900000 1530381900000 0 NaN NaN -60 False importer 3 7f40cce690 #mood(7) #work #cigarette #good_meal #surfing 1530308340000 1530308340000 0 NaN NaN -60 False importer 4 d75e110fdc #mood(7) #reading #work #cigarette #good_meal ... 1530293580000 1530293580000 0 NaN NaN -60 False importer