Skip to content
melt-srcPublic

About

A diet management and gastronomic recommender system written in C.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is Artie?

Artie is a diet management system written in C. The idea is simple: every week I eat 28 meals: 7 breakfasts, 7 lunches, 7 snacks and 7 dinners. In order to keep track of what I eat and my weight, plan my meals and grocery shopping I implemented an SQLite database following this schema:

  • each weekly plan features a starting/ending day, a starting/ending weight and seven daily plans,
  • each daily plan features four meals and a day of the week,
  • each meal features three ingredients and a calory count,
  • each ingredient features a category (carbohydrate, protein or fat) and an amount of calories per 100g.

Operating on a SQLite database via CLI on a daily basis can easily become a burder, so Artie makes your life easier by abstracting such operations.

What can Artie do?

Basic use cases for Artie are:

  • storing data about staples and ingredients,
  • building meals by combining ingredients,
  • building daily plans by combining meals,
  • building weekly plans by combining daily plans,

but also:

  • keep track of weight over the weeks,
  • keep count of calories consumed,
  • compose a grocery shopping list

How to use:

Adding/removing ingredients, building meals and daily plans

Artie parses CSV files as input. To insert ingredients into the system, for example, the user would run Artie as follows:

$ ./artie i.csv

with the file i.csv looking like this:

"pasta"     | "carb" | 0.67 | 150
"lentils"   | "prot" | 0.08 | 150
"olive_oil" | "fat"  | 0.89 | 150

the system would then transform the CSV file into queries similar to these:

INSERT INTO ingredient (name, category, macro_prop, cal) VALUES
    ('pasta', 'carb', 0.67, 150);
INSERT INTO ingredient (name, category, prop) VALUES
    ('lentils', 'prot', 0.08, 150);
INSERT INTO ingredient (name, category, prop) VALUES
    ('olive_oil', 'fat', 0.89, 150);

then, in order to build meals with said ingredients, the user would run Artie as follows:

$ ./artie m.csv

with the file m.csv looking like this:

"pasta_e_lenticchie" | "pasta" | "lentils" | "olive_oil" | 100 | 250 | 5

the system would then transform the CSV file into queries similar to these:

INSERT INTO meal (name, category) VALUES
    ('pasta_e_lenticchie', 'full');

INSERT INTO composition (id_meal, id_ingredient, portion) VALUES
    ((SELECT id FROM meal WHERE name = 'pasta_e_lenticchie'),
     (SELECT id FROM ingredient WHERE name = 'pasta'),
     100),
    ((SELECT id FROM meal WHERE name = 'pasta_e_lenticchie'),
     (SELECT id FROM ingredient WHERE name = 'lentils'),
     250),
    ((SELECT id FROM meal WHERE name = 'pasta_e_lenticchie'),
     (SELECT id FROM ingredient WHERE name = 'olive_oil'),
     5),

a daily plan can be built out of meals similarly using a proper *.plan file:

$ ./artie p.csv

with the file p.csv looking like this:

"mon" | "2026-10-02" | "pasta_e_lenticchie" | "lunch"

the system would then transform the CSV file into queries similar to these:

INSERT INTO plan (day_of_week, date_calendar) VALUES
    ('mon', '2026-10-02');

INSERT INTO slot (id_meal, id_plan, meal_type) VALUES
    ((SELECT id FROM meal WHERE name = 'pasta_e_lenticchie'),
     (SELECT id FROM ingredient WHERE date_calendar = '2026-10-02'),
     'lunch');

Data can be updated and removed from the system in the same way, for example:

$ ./artie i.csv

with the file i.csv looking like this:

pasta
lentils

the system would generate queries similar to these:

DELETE FROM ingredient WHERE name = 'pasta';
DELETE FROM ingredient WHERE name = 'lentils';

, if the file i.csv looked like this instead:

"pasta" | "carb" | 0.55

Artie would generate a query similar to this:

UPDATE ingredient SET prop = 0.55 WHERE name = 'pasta';

Visualizing plans

Generating statistics

Generating shopping list

About

A diet management and gastronomic recommender system written in C.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages