<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>AlternativeBit</title>
    <link>https://alternativebit.fr/tags/weblog/</link>
    <description>Recent posts</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Fri, 08 Jul 2016 20:29:54 +0200</lastBuildDate>
    <atom:link href="https://alternativebit.fr/tags/weblog/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Open recipe database: how to gather, cure and store data</title>
      <link>https://alternativebit.fr/posts/open-receipe-database-how-to-gather-and-cure-data/</link>
      <author>picnoir</author>
      <category domain="https://alternativebit.fr/tags/weblog">Web log</category>
      <pubDate>Fri, 08 Jul 2016 20:29:54 +0200</pubDate>
      <guid>https://alternativebit.fr/posts/open-receipe-database-how-to-gather-and-cure-data/</guid>
      <description>&lt;p&gt;I recently started to think about creating an open recipe database. The major consideration coming with this project is how to gather, cure and store recipes.&lt;/p&gt;
&lt;h1 id=&#34;gathering-data&#34;&gt;Gathering data&lt;/h1&gt;
&lt;p&gt;Let&amp;rsquo;s start with something obvious: we cannot rely on users to create recipes from scratch.
This is a very time consuming task, so the first approach would be to find a way to fully automate that.&lt;/p&gt;
&lt;p&gt;As I mentioned in the previous article, the main goal of this project is to keep the recipes informations in a highly structured way.
Even if we can easily scrap recipes from the internet, it is usually hard to analyse a full text format in order to fit it
in a very structured and restricted database. It would involve some advanced machine learning techniques which I do not
master at all and will highly raise this project&amp;rsquo;s complexity.&lt;/p&gt;
&lt;p&gt;In order to keep things simple, we need to find a way to let users cure the unstructured information for us.&lt;/p&gt;
&lt;p&gt;We can find loosely structured recipes databases all around the internet. They usually come under two flavours:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Websites formatting their HTML using &lt;a href=&#34;http://microformats.org/wiki/hrecipe&#34;&gt;hrecipe&lt;/a&gt;. It basically use html classes
to add some semantic informations and metadatas about recipes. Ok, it is more a way to add semantical informations on
a website than a database per say, but it makes scrapping these website easier.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://open-recipe-format.readthedocs.io/en/latest/&#34;&gt;Open Recipes Format&lt;/a&gt; based database. &lt;a href=&#34;https://github.com/fictivekin/openrecipes&#34;&gt;Fictivekin&amp;rsquo;s Open Recipes&lt;/a&gt;
seems to be the more complete one even though it is more intended to be used as a recipe bookmark as mentioned in the repository. This format is YAML based.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Neither of these formats are strict enough for this project but it will be a good starting point which would need to be human curated.&lt;/p&gt;
&lt;h1 id=&#34;storing-data&#34;&gt;Storing data&lt;/h1&gt;
&lt;p&gt;We will not go in depth here, we will just identify the various entities. This list is not an exhaustive one and there are obviously lot of dependencies between these
entities, they will not be detailed in this post.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Recipe:&lt;/strong&gt; obviously&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ingredient:&lt;/strong&gt; it will contain one ingredient. Each ingredient should be unique in the database, we should avoid as much as possible duplicates.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Nutrition information:&lt;/strong&gt; it will contain various nutritive informations. It will be associated with the ingredient entity.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Diet information:&lt;/strong&gt; is this vegan/kasher/halal/vegetarian/watever friendly.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Technique:&lt;/strong&gt; cooking technique, such as grill, peel, cut, etc.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cooking step:&lt;/strong&gt; Combination of a technique + several ingredients.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There will also be &amp;ldquo;links&amp;rdquo; between these entities, for the moment, I just identified one of them:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Substitutes:&lt;/strong&gt; link between two ingredients. This link will probably also contain informations such as weight/volume ratio, etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;curating-data&#34;&gt;Curating data&lt;/h1&gt;
&lt;p&gt;Now we have some data, we need to cure it in order to make it fit in our strict table scheme. The idea here is to let users do that, a bit like reddit
let users cure internet links.&lt;/p&gt;
&lt;p&gt;We will need to design a proper algorithm here and I will not get into that until another post, however, the outline will be the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Each entity (ingredient, recipe, …) will be associated to three states:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;New:&lt;/strong&gt; a user is editing the entity, it is not ready for vote.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Voting:&lt;/strong&gt; the entity is currently candidate for integration in the database.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rejectted:&lt;/strong&gt; the entity has been rejected, it will not be inserted in the database.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Integrated:&lt;/strong&gt; the entity is integrated in the database.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Every user is associated to a rank (karma) which will weight the votes.&lt;/li&gt;
&lt;li&gt;During the &lt;strong&gt;voting&lt;/strong&gt; state, users are invited to upvote or downvote the entity.&lt;/li&gt;
&lt;li&gt;When an entity score meets a threshold (1 or -1), it will be accepted or rejected.&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;tricky-parts&#34;&gt;Tricky parts&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;Every&lt;/strong&gt; entity will need to be voted in order to be integrated in the database. This will probably prevent us to integrate duplicates and crappy data. However,
this may also discourage users from posting as they will not know if their work will be integrated or not.&lt;/p&gt;
&lt;p&gt;Another problem will be entity dependencies: recipes will depend on ingredients, it means that in order to be included in the database, a recipe needs all its
ingredients being already included. What if some ingredient are rejected, how should we handle that? I need to put more thoughs on that later…&lt;/p&gt;
&lt;p&gt;Do we need moderators? I would prefer not in order to keep the database as neutral as possible, but depending of users activeness, it could be needed.&lt;/p&gt;
&lt;h1 id=&#34;coming-next&#34;&gt;Coming next&lt;/h1&gt;
&lt;p&gt;Alright, enough talk, we need to start implementing that.&lt;/p&gt;
&lt;p&gt;Next step: entity system implementation.&lt;/p&gt;
</description>
    </item>
    <item>
      <title>Some thoughts about building an open recipe database</title>
      <link>https://alternativebit.fr/posts/some-thoughts-about-an-open-receipes-database/</link>
      <author>picnoir</author>
      <category domain="https://alternativebit.fr/tags/weblog">Web log</category>
      <pubDate>Thu, 23 Jun 2016 00:00:00 +0000</pubDate>
      <guid>https://alternativebit.fr/posts/some-thoughts-about-an-open-receipes-database/</guid>
      <description>&lt;p&gt;Lately, I have been thinking about creating an open recipe database. It is just not
possible to find any good quality recipes database. Often, the website indexing
recipes does not expose its data using any kind of API. When it does - and very
few does - the recipes are stored in a data format close to unrestricted plain text.&lt;/p&gt;
&lt;h1 id=&#34;advanced-queries&#34;&gt;Advanced queries&lt;/h1&gt;
&lt;p&gt;Most recipes websites are offering very primitives search possibilities. For instance,
&lt;a href=&#34;http://www.marmiton.org/&#34;&gt;Marmiton&lt;/a&gt;, the most complete french recipes database offers
the following search options:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Meal type&lt;/li&gt;
&lt;li&gt;Difficulty&lt;/li&gt;
&lt;li&gt;Cost - using cheap, average and expensive options&lt;/li&gt;
&lt;li&gt;Vegetarian friendly&lt;/li&gt;
&lt;li&gt;Keywords&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As you can see, this search is really primitive, I personally need some more criteria.&lt;/p&gt;
&lt;h2 id=&#34;disclaimer&#34;&gt;Disclaimer&lt;/h2&gt;
&lt;p&gt;There is a notable exception: &lt;a href=&#34;http://bigoven.com/&#34;&gt;Big Oven&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This website provides a lot ofrecipes, the ux and search function are really sweet and
all the data is accessible using a REST API.&lt;/p&gt;
&lt;p&gt;The problem with that website, besides being quite buggy (I have not managed to get my API key because of a login related bug…)
is the very restrictive &lt;a href=&#34;http://api2.bigoven.com/web/documentation/terms-of-use&#34;&gt;data license&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Basically, you cannot use this data for anything else than sending users to their website.&lt;/p&gt;
&lt;h1 id=&#34;features-we-need&#34;&gt;Features we need&lt;/h1&gt;
&lt;p&gt;After putting some thoughts on these criteria, I have come up with that list of features
of the ideal recipes web index:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Ingredients list:&lt;/strong&gt; I want to be able to specify a ingredients list in which the recipe
will be created on. I also want to exclude some ingredients from the search results because
my diet does not permit to eat these ingredients, because I do not like this ingredient, etc.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Equivalence class between ingredients:&lt;/strong&gt; I want to be able to know if soy creme is an
acceptable substitute to crême fraiche. In a more general way, I want to be able to
determine the substitutes and their quantity substitution for each ingredient.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Hierarchy/Relationships/Categories of ingredients:&lt;/strong&gt; Is my meal balanced? Is my meal free of meat?
Is my meal kasher/halal? Does my meal contains fish? What kind of rice should I use for this
particular meal?&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Measurement scales equivalences:&lt;/strong&gt; what the fuck is a cup? I want grams!&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So yeah, seems like a lot of work to do…&lt;/p&gt;
&lt;h1 id=&#34;problem-we-are-actually-facing&#34;&gt;Problem we are actually facing&lt;/h1&gt;
&lt;p&gt;It seems that every recipe index website is getting killed by a new one which is more user
friendly or has more feature every 5 years.&lt;/p&gt;
&lt;p&gt;There is no open database of recipes. Every time a new website is created, the data needs to be
scraped or created from scratch. We need to separate the data (actual recipes) from the
processing/presentational part or we will keep creating some crappy database from scratch every
5 years.&lt;/p&gt;
&lt;p&gt;I think it is time to create something more durable: an &lt;strong&gt;open recipe database&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;More article about this index are about to come.&lt;/p&gt;
</description>
    </item>
    </channel>
</rss>
