Create Instances

This module creates the different instances. In this module you can change the description of Tools, the flow of InformationItems. Add Tools and add InformationItems.
# TODO: Maybe we don't need this file. We can use the app to create instances and place those in the database.

Tools

The function tools_from_code can be used to create instances for every Tool available. The instances are hardcoded in the function. This function can be used to start a fresh database.

The function tools_from_db can be used to create instances for every Tool available in the database.

In both cases the function does not return anything. The available instances are tracked in the Tool class and can be retrieved as a list using the get_instances method on the Tool class.

We must start with creating instances for each Tool that we can use. This must be done before we can create instances for the InformationItem and Improvement classes, because both have fields that are validated against the field name in the Tool class.


source

tools_from_code

 tools_from_code ()

Create all Tool instances as defined in the code.

The next stap is to define instances for each InformationItem we have.

tools_from_code()
Tool.get_instances()
{'reader': Tool(name='Reader', organization_system=[<OrganizationSystem.TAGS: 'tags'>], phase_quality=[<PhaseQuality.GREAT: 'great'>, <PhaseQuality.BAD: 'bad'>, <PhaseQuality.GREAT: 'great'>, <PhaseQuality.NA: 'na'>, <PhaseQuality.NA: 'na'>], collect=None, retrieve=None, consume=None, extract=None, refine=None, slug='reader'),
 'recall': Tool(name='Recall', organization_system=[<OrganizationSystem.LINKS: 'links'>], phase_quality=[<PhaseQuality.GREAT: 'great'>, <PhaseQuality.GREAT: 'great'>, <PhaseQuality.NA: 'na'>, <PhaseQuality.NA: 'na'>, <PhaseQuality.GREAT: 'great'>], collect=None, retrieve=None, consume=None, extract=None, refine=None, slug='recall'),
 'readwise': Tool(name='Readwise', organization_system=[<OrganizationSystem.TAGS: 'tags'>], phase_quality=[<PhaseQuality.NA: 'na'>, <PhaseQuality.OK: 'ok'>, <PhaseQuality.NA: 'na'>, <PhaseQuality.GREAT: 'great'>, <PhaseQuality.OK: 'ok'>], collect=None, retrieve=None, consume=None, extract=None, refine=None, slug='readwise'),
 'obsidian': Tool(name='Obsidian', organization_system=[<OrganizationSystem.JOHNNY_DECIMAL: 'johnny_decimal'>, <OrganizationSystem.LINKS: 'links'>], phase_quality=[<PhaseQuality.NA: 'na'>, <PhaseQuality.OK: 'ok'>, <PhaseQuality.OK: 'ok'>, <PhaseQuality.GREAT: 'great'>, <PhaseQuality.GREAT: 'great'>], collect=None, retrieve=None, consume=None, extract=None, refine=None, slug='obsidian'),
 'librarything': Tool(name='LibraryThing', organization_system=[<OrganizationSystem.TAGS: 'tags'>], phase_quality=[<PhaseQuality.OK: 'ok'>, <PhaseQuality.BAD: 'bad'>, <PhaseQuality.NA: 'na'>, <PhaseQuality.NA: 'na'>, <PhaseQuality.NA: 'na'>], collect=None, retrieve=None, consume=None, extract=None, refine=None, slug='librarything'),
 'snipd': Tool(name='Snipd', organization_system=[<OrganizationSystem.FOLDERS: 'folders'>], phase_quality=[<PhaseQuality.OK: 'ok'>, <PhaseQuality.BAD: 'bad'>, <PhaseQuality.GREAT: 'great'>, <PhaseQuality.NA: 'na'>, <PhaseQuality.NA: 'na'>], collect=None, retrieve=None, consume=None, extract=None, refine=None, slug='snipd'),
 'neoreader': Tool(name='NeoReader', organization_system=[<OrganizationSystem.FOLDERS: 'folders'>], phase_quality=[<PhaseQuality.OK: 'ok'>, <PhaseQuality.BAD: 'bad'>, <PhaseQuality.GREAT: 'great'>, <PhaseQuality.NA: 'na'>, <PhaseQuality.NA: 'na'>], collect=None, retrieve=None, consume=None, extract=None, refine=None, slug='neoreader'),
 'youtube': Tool(name='YouTube', organization_system=[<OrganizationSystem.FOLDERS: 'folders'>], phase_quality=[<PhaseQuality.OK: 'ok'>, <PhaseQuality.BAD: 'bad'>, <PhaseQuality.OK: 'ok'>, <PhaseQuality.NA: 'na'>, <PhaseQuality.NA: 'na'>], collect=None, retrieve=None, consume=None, extract=None, refine=None, slug='youtube')}

InformationItems

Just as with the Tools we have two functions to create instances for every InformationItem. We can use the function informationitems_from_code to create instances for every InformationItem available from the definitions hardcoded in the function. This function can be used to start a fresh database. We can use the function informationitems_from_db to create instances for every InformationItem available in the database.

These functions don’t return anything. The available instances are tracked in the InformationItem class and can be retrieved as a list using the get_instances method on the InformationItem class.


source

informationitems_from_code

 informationitems_from_code ()

Create all InformationItem instances as defined in the code.

Check all the available tools and information items.

informationitems_from_code()
InformationItem.get_instances()
{'web_article': InformationItem(name='Web Article', info_type=<InformationType.WEB_ARTICLE: 'web_article'>, method=[<Method.MANUAL: 'manual'>, None, None, None, None], toolflow=[['Reader', 'Recall'], 'Recall', 'Reader', None, None], slug='web_article'),
 'annotation': InformationItem(name='Annotation', info_type=<InformationType.ANNOTATION: 'annotations&highlights'>, method=[<Method.AUTOMATIC: 'automatic'>, None, None, None, None], toolflow=[None, None, None, 'Readwise', ['Recall', 'Obsidian']], slug='annotation'),
 'note': InformationItem(name='Note', info_type=<InformationType.NOTE: 'note'>, method=[<Method.MANUAL: 'manual'>, None, None, None, None], toolflow=[None, 'Obsidian', 'Obsidian', 'Obsidian', 'Obsidian'], slug='note'),
 'book': InformationItem(name='Book', info_type=<InformationType.BOOK: 'book'>, method=[<Method.MANUAL: 'manual'>, None, None, None, None], toolflow=['LibraryThing', 'LibraryThing', 'NeoReader', 'Readwise', 'Obsidian'], slug='book'),
 'podcast': InformationItem(name='Podcast', info_type=<InformationType.PODCAST: 'podcast'>, method=[<Method.AUTOMATIC: 'automatic'>, None, None, None, None], toolflow=['Snipd', 'Snipd', 'Snipd', 'Readwise', 'Obsidian'], slug='podcast'),
 'research_paper': InformationItem(name='Research Paper', info_type=<InformationType.RESEARCH_PAPER: 'research_paper'>, method=[<Method.MANUAL: 'manual'>, None, None, None, None], toolflow=[['Recall', 'NeoReader'], ['Recall', 'NeoReader'], 'NeoReader', 'Readwise', ['Obsidian', 'Recall']], slug='research_paper'),
 'document': InformationItem(name='Document', info_type=<InformationType.DOCUMENT: 'document'>, method=[<Method.MANUAL: 'manual'>, None, None, None, None], toolflow=['NeoReader', 'NeoReader', 'NeoReader', 'Readwise', ['Obsidian', 'Recall']], slug='document'),
 'youtube_video': InformationItem(name='YouTube Video', info_type=<InformationType.YOUTUBE_VIDEO: 'youtube_video'>, method=[<Method.AUTOMATIC: 'automatic'>, None, None, None, None], toolflow=['YouTube', 'YouTube', 'YouTube', 'Obsidian', 'Obsidian'], slug='youtube_video')}