Fix README by removing internal details

This commit is contained in:
Marty Oehme 2021-12-06 19:44:14 +01:00
parent f9044daba1
commit ebb916a911
Signed by: Marty
GPG key ID: B7538B8F50A1C800

161
README.md
View file

@ -1,4 +1,4 @@
# Nomie Habit Migrator # habit-migrate
Can take an export of nomie habits in json format and convert it to be importable in Loop Habit Tracker. Can take an export of nomie habits in json format and convert it to be importable in Loop Habit Tracker.
@ -8,7 +8,9 @@ but that is untested.
## Usage ## Usage
Currently takes a single argument, the nomie database file, and will output to `output.db` in present working directory. Run as a commandline utility habit migrate currently takes a single argument, the nomie database `.json` file.
The output as importable Loop Habit Tracker database will be written to `output.db` in present working directory.
Can also take an existing Loop Habit database (exported from the application), Can also take an existing Loop Habit database (exported from the application),
and add the nomie exported habits and checkmarks to it. 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`, Simply put the exported Loop database in the same directory and call it `output.db`,
@ -16,25 +18,21 @@ it will not (should not™) overwrite anything.
Invoked like: `python run.py nomie-export.json`. Invoked like: `python run.py nomie-export.json`.
Note, however, that -- until a packaged version is released -- you will need to have some packages in your environment. Note, however, that -- until a packaged version is released -- you will need to have some packages in your environment.
If you wish to run it un-packaged, install poetry and let it do all dependency management by doing: If you wish to run it un-packaged, install [poetry](https://python-poetry.org/) and let it do all dependency management by doing:
``` ```
poetry install poetry install
poetry run habitmove <nomie-json> poetry run habitmove <nomie-json>
``` ```
In the future there might be an easier road to using this package but that's the way it is for now.
The package can also be used as a library to load nomie data
or move data into Loop Habit Tracker.
## Roadmap ## Roadmap
* [x] transform nomie data into dataclasses
* [x] Trackers
* [x] Events
* [x] Activities
* [x] transform loop data into dataclasses
* [x] create habit
* [x] create some way of getting 'length' of habit (how many fields)
* [x] move extracting of 'activity' from loop to nomie functionality (coupled with nomie note representation)
* [x] make loop migration use this activity data
* [x] create repetition
* [ ] clean up README * [ ] clean up README
* [ ] begin adding tests * [ ] begin adding tests
* [ ] add some unit tests for various functions * [ ] add some unit tests for various functions
@ -44,140 +42,3 @@ poetry run habitmove <nomie-json>
* [ ] abstract importer/migrator themselves to work with other targets * [ ] abstract importer/migrator themselves to work with other targets
* [ ] allow migration to/from nomie/loop * [ ] allow migration to/from nomie/loop
## Internal concepts
The migrator has the concept of a tracker, an event, and an activity:
* A tracker is the system / the goal / the accumulator that tracks a certain number of you 'doing' things.
* In Loop Habit Tracker it corresponds to a Habit
* An event is something happening, something being emitted but generally in its raw form. They do *not*
exist for pure numerical value tracking.
* Nomie has the idea of an event as a little text note that you write
* Loop Habit Tracker has no equivalent of an event and they will simply be discarded
* Generally, this will be most useful if you wish to preserve and keep prose notes in the system
* An activity is the interpreted variation of an event and which only effects your trackers.
Essentially something that changes a tracker's counter / value, like you doing sports or drinking water.
* Nomie keeps activities within its notes (as tags) and has no separate concept of them
* Loop Habit Tracker is only geared toward tracking activities and they are its main building block
* Generally, this will be quantifiable data and most useful for statistics and similar analysis
# 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