Reports and Data Management
Cooklang's report system transforms recipes into any format you need through powerful templates and data management. Whether you're creating shopping lists, nutrition labels, recipe cards, or custom exports, the report command combined with the database system provides complete control over your recipe data.
The Report System
The cook report
command uses Jinja2 templates to generate custom outputs from your recipes. This flexibility means you can create anything from simple ingredient lists to complex meal planning documents.
Basic Report Generation
Start with a simple template to create a recipe card:
The template receives comprehensive recipe data including ingredients, steps, metadata, and more. You can format this data however you need:
The Database System
The database (db
) system enriches your recipes with additional data like nutritional information, costs, and shopping details. This data lives in a structured directory that the report system can access.
Database Structure
Your database is organized as a directory tree where each ingredient has its own folder containing various data files:
Shopping Data Example
The shopping data connects ingredients to real products at specific stores:
Smart Shopping Lists
Combine reports and database to create intelligent shopping lists that link to actual products:
The Template
Using the Template
This generates a YAML shopping list with direct links to products, excluding items already in your pantry.
Pantry Management
The pantry configuration tracks what you already have, preventing duplicate purchases:
Advanced Report Examples
Cost Analysis Report
Track recipe costs using database pricing:
Nutrition Label
Generate nutrition facts from your database:
Smart Shopping with Aisles
Organize by store layout for efficient shopping:
Template Functions
The report system provides powerful functions for recipe manipulation:
Pantry Functions
excluding_pantry(ingredients)
- Filter out pantry itemsfrom_pantry(ingredients)
- Get only pantry itemsget_ingredient_list(ingredients)
- Normalize ingredient list
Organization Functions
aisled(ingredients)
- Group by store aisledb(path, default)
- Access database valuesunderscore(text)
- Convert to underscore format
Formatting Filters
titleize
- Convert to title caseformat
- Python string formattinground
- Round numbersdefault
- Provide fallback values
Practical Workflows
Weekly Meal Planning
Create templates for different views:
- Shopping list with links
- Cost breakdown
- Prep schedule
- Nutrition summary
Generate all reports at once:
Recipe Scaling with Data
Scale recipes while maintaining data connections:
Export Formats
Create templates for different export formats:
- YAML: For automation and APIs
- Markdown: For documentation and sharing
- HTML: For web display
- LaTeX: For cookbook publishing
- CSV: For spreadsheet import
Building Your Database
Start simple and grow your database over time:
- Begin with essentials: Add shopping links for frequently used ingredients
- Add nutrition data: Include calories, macros for meal planning
- Track costs: Monitor recipe expenses and budget
- Store alternatives: List substitute ingredients
- Include metadata: Add tags, categories, dietary info
Tips and Best Practices
Database Organization
- Use consistent naming (underscore format)
- Group related data in subdirectories
- Version control your database
- Share databases with others
Template Development
- Start with simple templates
- Test with various recipes
- Use default values for missing data
- Create reusable template components
Workflow Integration
- Automate report generation
- Chain multiple reports together
- Export to different formats
- Integrate with other tools
See Also
- CLI Report Command – Detailed command reference
- Shopping Lists – Focused shopping list workflows
- Meal Planning – Planning multiple meals
- Pantry Management – Managing your ingredient inventory