Skip to content

wikip-co/protocol-builder

Repository files navigation

Health Database & Alchemy App

A Flask web application that extracts health/nutrition articles from markdown files, imports them into a SQLite database with full citation linking, and provides an alchemy-style interface for combining healing items into protocols.

Features

  • Article Management: Browse, search, and view health/nutrition articles with full citation support
  • Alchemy Builder: Combine healing items from different categories to create custom protocols
  • Protocol Management: Create, edit, view, and delete user-created protocols
  • Citation Linking: Granular citation linking at sentence, paragraph, and bullet-point level
  • Full-Text Search: Search articles using SQLite FTS5

Project Structure

alchemy-app/
├── database/          # Database schema
├── parser/           # Markdown parsing modules
├── import/           # Data import scripts
├── app/              # Flask application
├── templates/        # Jinja2 templates
├── static/           # CSS, JS, images
├── requirements.txt  # Python dependencies
└── README.md         # This file

Setup

  1. Install dependencies:

    pip install -r requirements.txt
  2. Initialize the database:

    python -m import.import_articles --init --db health.db
  3. Import articles:

    python -m import.import_articles --db health.db --articles ../site/source/_posts/Natural\ Healing
  4. Run the Flask application:

    export FLASK_APP=app
    export FLASK_ENV=development
    flask run

    Or using Python:

    python run.py

Usage

Importing Articles

The import script scans the Natural Healing directory and parses all markdown files:

python -m import.import_articles --db health.db --articles ../site/source/_posts/Natural\ Healing

Options:

  • --db: Database file path (default: health.db)
  • --articles: Path to Natural Healing articles directory
  • --init: Initialize database schema (run once)

Creating Protocols

  1. Navigate to the Alchemy Builder page
  2. Search and select items from the sidebar
  3. Add items to your protocol
  4. Enter a protocol name and description
  5. Click "Create Protocol"

Viewing Protocols

  • View all protocols on the Protocols page
  • Click on a protocol to see its details and combined properties
  • Edit or delete user-created protocols (predefined protocols are read-only)

Database Schema

The database includes the following main tables:

  • articles - Main article information
  • categories - Category hierarchy
  • tags - Article tags
  • citations - Citation/reference information
  • content_blocks - Granular content units with citation links
  • healing_properties - Healing properties with hierarchy
  • treatments - Disease/symptom treatments
  • composition_items - Chemical constituents
  • synergistic_relationships - Synergistic combinations
  • protocols - User-created and predefined protocols
  • protocol_items - Items in protocols

API Endpoints

  • GET /api/articles - Get all articles
  • GET /api/article/<slug> - Get article by slug
  • POST /api/protocol/create - Create a new protocol
  • POST /api/protocol/<id>/add-item - Add item to protocol
  • DELETE /api/protocol/<id>/remove-item/<item_id> - Remove item from protocol
  • GET /api/protocol/<id>/combined - Get combined properties for protocol

Development

The application uses:

  • Flask for the web framework
  • SQLite for the database
  • Jinja2 for templating
  • python-frontmatter for parsing markdown frontmatter

License

See LICENSE file in the parent directory.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published