<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Bekir Berk Mergan</title>
    <description>The latest articles on DEV Community by Bekir Berk Mergan (@bekir_berkmergan_b64aa10).</description>
    <link>https://dev.to/bekir_berkmergan_b64aa10</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4246101%2Fb5b7ffe4-3fd6-4a2d-a988-732cf1c042b9.png</url>
      <title>DEV Community: Bekir Berk Mergan</title>
      <link>https://dev.to/bekir_berkmergan_b64aa10</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bekir_berkmergan_b64aa10"/>
    <language>en</language>
    <item>
      <title>Why my calorie app doesn't let the AI pick the calories</title>
      <dc:creator>Bekir Berk Mergan</dc:creator>
      <pubDate>Sun, 15 Nov 2026 14:51:41 +0000</pubDate>
      <link>https://dev.to/bekir_berkmergan_b64aa10/why-my-calorie-app-doesnt-let-the-ai-pick-the-calories-5f3o</link>
      <guid>https://dev.to/bekir_berkmergan_b64aa10/why-my-calorie-app-doesnt-let-the-ai-pick-the-calories-5f3o</guid>
      <description>&lt;p&gt;Most photo-based calorie apps send your picture to a vision model and ask it for a number. It works well enough in a demo. Then a user takes a photo of the same lunch on Tuesday and Thursday and gets 540 kcal one day and 710 the next.&lt;/p&gt;

&lt;p&gt;When I was planning Kalomi, an Android calorie and diet tracker, I read a few hundred reviews of existing apps. That inconsistency came up again and again, right next to "everything gets locked on day 2" and "the trial charged me". This post is about the first one, because it shaped the architecture more than anything else.&lt;/p&gt;

&lt;h2&gt;
  
  
  Split the problem: recognition vs. arithmetic
&lt;/h2&gt;

&lt;p&gt;A vision model is good at "this is lentil soup, roughly one bowl". It is not a reliable nutrition database, and it has no reason to give the same answer twice.&lt;/p&gt;

&lt;p&gt;So Kalomi splits the job:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The model only recognizes.&lt;/strong&gt; For each item on the plate it returns a food name and a portion estimate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The app does the math.&lt;/strong&gt; The name is matched against a food catalog (USDA data plus a hand-built catalog of Turkish dishes, since that's where most of my users are). Calories and macros come from the catalog entry multiplied by the portion.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If the model says "lentil soup, 1 bowl" on Tuesday and on Thursday, the result is identical, because the number came from the catalog, not the model. The result screen also shows alternative matches, so the user can switch "lentil soup" to "ezogelin soup" with one tap.&lt;/p&gt;

&lt;p&gt;There is one honest exception: if nothing in the catalog matches, the app falls back to the model's own estimate and marks it as an estimate in the UI, so the user knows which numbers are database-backed and which aren't.&lt;/p&gt;

&lt;p&gt;A nice side effect: photo, text entry and catalog search all go through the same catalog, so those logging methods draw from the same numbers. (Packaged food is different: barcodes are looked up in Open Food Facts, which has the label values.)&lt;/p&gt;

&lt;h2&gt;
  
  
  Shipping the catalog
&lt;/h2&gt;

&lt;p&gt;The catalog ships inside the app as a SQLite file, so catalog search works offline and doesn't cost a server call. A build script generates it from the source data along with a tiny version stamp. On launch the app copies the bundled catalog into app storage only when that stamp changes, and the user's own meal database is never touched.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Flutter&lt;/strong&gt; for the app (Android first).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Supabase&lt;/strong&gt; for auth, Postgres with row-level security, and Edge Functions (Deno) that sit between the app and the AI provider. The app never holds AI keys. Servers are in the EU.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Health Connect&lt;/strong&gt; with read-only permissions (steps, workouts, weight, sleep). Kalomi never writes to it.&lt;/li&gt;
&lt;li&gt;Photos are re-encoded before upload, which strips EXIF and GPS data.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Things I'd do the same way again
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Keep the free core useful.&lt;/strong&gt; Barcode, manual entry, water, weight, history and PDF reports are free. Photo analysis and the AI coach are Premium, because those are the parts that cost money per use.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A calorie floor.&lt;/strong&gt; The app won't suggest daily targets below a safe minimum, whatever the user enters as a goal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No dark patterns at checkout.&lt;/strong&gt; The trial needs no card and doesn't auto-charge.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it / tell me what's wrong
&lt;/h2&gt;

&lt;p&gt;Kalomi is on Google Play (Android 9+, English and Turkish): &lt;a href="https://play.google.com/store/apps/details?id=com.nimpyfit.kalomi&amp;amp;referrer=utm_source%3Ddevto%26utm_medium%3Dicerik%26utm_campaign%3Dlansman2026" rel="noopener noreferrer"&gt;https://play.google.com/store/apps/details?id=com.nimpyfit.kalomi&amp;amp;referrer=utm_source%3Ddevto%26utm_medium%3Dicerik%26utm_campaign%3Dlansman2026&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'm especially interested in how other people handle the "model output vs. source of truth" boundary in their apps. Do you let the model produce final values anywhere, or always route through your own data?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Calorie values are estimates, not medical advice.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>flutter</category>
      <category>ai</category>
      <category>android</category>
    </item>
  </channel>
</rss>
