<?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: bob lee</title>
    <description>The latest articles on DEV Community by bob lee (@bob_lee_2d29b22cee96eb65f).</description>
    <link>https://dev.to/bob_lee_2d29b22cee96eb65f</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3976852%2F87e1f8a7-af0e-4d25-9b61-67341a2d9a5e.png</url>
      <title>DEV Community: bob lee</title>
      <link>https://dev.to/bob_lee_2d29b22cee96eb65f</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bob_lee_2d29b22cee96eb65f"/>
    <language>en</language>
    <item>
      <title>How I Built an FTIR Analysis Platform with Claude (and What I Learned About AI-Assisted Development)</title>
      <dc:creator>bob lee</dc:creator>
      <pubDate>Wed, 10 Jun 2026 03:32:31 +0000</pubDate>
      <link>https://dev.to/bob_lee_2d29b22cee96eb65f/how-i-built-an-ftir-analysis-platform-with-claude-and-what-i-learned-about-ai-assisted-development-1f0c</link>
      <guid>https://dev.to/bob_lee_2d29b22cee96eb65f/how-i-built-an-ftir-analysis-platform-with-claude-and-what-i-learned-about-ai-assisted-development-1f0c</guid>
      <description>&lt;h1&gt;
  
  
  DEV.to Article: How I Built an FTIR Analysis Platform with Claude
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Title:&lt;/strong&gt; How I Built an FTIR Analysis Platform with Claude (and What I Learned About AI-Assisted Development)&lt;br&gt;
&lt;strong&gt;Tags:&lt;/strong&gt; python, chemistry, opensource, ai&lt;br&gt;
&lt;strong&gt;Published:&lt;/strong&gt; true (can publish immediately on DEV)&lt;/p&gt;


&lt;h2&gt;
  
  
  The Backstory
&lt;/h2&gt;

&lt;p&gt;I'm a materials science graduate, not a software developer. I know FTIR spectroscopy — identifying polymers, interpreting functional group peaks, matching unknown samples against reference libraries. But when I needed to search FTIR spectra programmatically, I hit a wall: the existing tools were either expensive enterprise packages or Excel macros from the early 2000s.&lt;/p&gt;

&lt;p&gt;So I decided to build my own. And I used Claude (Anthropic's AI assistant) as my coding partner.&lt;/p&gt;

&lt;p&gt;This is the story of how a domain expert with basic Python skills built a production FTIR search platform — 135,000 spectra, MCP server, API, community features — with AI writing about 70% of the code.&lt;/p&gt;


&lt;h2&gt;
  
  
  Step 1: The Core Algorithm
&lt;/h2&gt;

&lt;p&gt;FTIR spectrum matching sounds complex, but the core is simple geometry: given a set of peak positions from an unknown sample, find the library spectra with the most matching peaks within a tolerance window (typically ±5 to ±15 cm⁻¹).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Claude helped with:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Writing the initial peak-matching loop&lt;/li&gt;
&lt;li&gt;Setting up the Django project structure&lt;/li&gt;
&lt;li&gt;Designing the database schema for the spectral library&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What I handled:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understanding which tolerance values actually work (different wavenumber regions need different tolerances)&lt;/li&gt;
&lt;li&gt;Validating match results against known materials&lt;/li&gt;
&lt;li&gt;Rejecting the first three algorithm designs that looked correct on paper but failed on real data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Lesson:&lt;/strong&gt; AI can write the code faster than you can, but it can't tell you if the chemistry is right. Domain expertise is the bottleneck, not code.&lt;/p&gt;


&lt;h2&gt;
  
  
  Step 2: Parsing FTIR Instrument Files
&lt;/h2&gt;

&lt;p&gt;This was the hardest technical challenge. FTIR instruments output data in at least 6 different formats:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Format&lt;/th&gt;
&lt;th&gt;Origin&lt;/th&gt;
&lt;th&gt;Difficulty&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;SPA&lt;/td&gt;
&lt;td&gt;Thermo Nicolet&lt;/td&gt;
&lt;td&gt;Medium — binary, proprietary&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SPC&lt;/td&gt;
&lt;td&gt;GRAMS&lt;/td&gt;
&lt;td&gt;Medium — documented but complex&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OPUS&lt;/td&gt;
&lt;td&gt;Bruker&lt;/td&gt;
&lt;td&gt;High — completely proprietary&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CSV&lt;/td&gt;
&lt;td&gt;Universal&lt;/td&gt;
&lt;td&gt;Easy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;JDX&lt;/td&gt;
&lt;td&gt;JCAMP-DX&lt;/td&gt;
&lt;td&gt;Medium — standard but varied implementations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;XLSX&lt;/td&gt;
&lt;td&gt;Labs&lt;/td&gt;
&lt;td&gt;Easy — but infinite variations&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;What Claude helped with:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Writing binary file parsers from format documentation&lt;/li&gt;
&lt;li&gt;Extracting peak tables from raw instrument data&lt;/li&gt;
&lt;li&gt;Handling edge cases (missing metadata, non-standard headers)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What I handled:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Testing with real instrument files from my university lab&lt;/li&gt;
&lt;li&gt;Identifying which format variants actually appear in practice&lt;/li&gt;
&lt;li&gt;Setting up error handling for unparseable files&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Lesson:&lt;/strong&gt; Claude is surprisingly good at binary file parsing. I pasted format specs from Thermo and Bruker documentation, and it generated working parsers. But I caught three subtle byte-offset errors that would have silently corrupted data.&lt;/p&gt;


&lt;h2&gt;
  
  
  Step 3: The MCP Server
&lt;/h2&gt;

&lt;p&gt;MCP (Model Context Protocol) lets AI agents call your tool directly. Instead of a human typing peak values into a web form, an AI agent can send structured requests and receive structured results.&lt;/p&gt;

&lt;p&gt;The MCP server, at &lt;code&gt;fastapi_server/mcp_server.py&lt;/code&gt;, exposes one main tool:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;analyze_ftir_spectrum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file_content&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;peaks&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Accept either an instrument file or a peak list. Returns ranked matches with similarity scores.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Claude generated:&lt;/strong&gt; ~90% of the MCP server code, including the Pydantic output schemas, error handling, and feature documentation.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 4: What Broke in Production
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Problem 1: Memory&lt;/strong&gt;&lt;br&gt;
Loading the entire 135K-spectrum library into memory on every request was fine locally. On a 2GB VPS with other services running, it caused OOM kills within hours.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fix:&lt;/strong&gt; Added Redis caching for frequent searches, lazy loading for the library, and a batch query size limit.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Problem 2: Cloudflare timeouts&lt;/strong&gt;&lt;br&gt;
The MCP streamable-http transport needs persistent connections. Cloudflare's default 100-second timeout killed long searches.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fix:&lt;/strong&gt; Server-sent events for progress reporting, and Cloudflare timeout tuning.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Problem 3: Hallucination-like false positives&lt;/strong&gt;&lt;br&gt;
The matching algorithm returned chemically impossible candidates for very short peak lists (2-3 peaks).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fix:&lt;/strong&gt; Added a minimum peak count threshold and a confidence penalty for low-peak queries.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The Result
&lt;/h2&gt;

&lt;p&gt;FTIR.fun is now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Live at&lt;/strong&gt; &lt;a href="https://ftir.fun" rel="noopener noreferrer"&gt;https://ftir.fun&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MCP endpoint:&lt;/strong&gt; &lt;code&gt;https://ftir.fun/mcp&lt;/code&gt; — connect from Claude, Cursor, Copilot, or any MCP client&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenAPI spec:&lt;/strong&gt; &lt;code&gt;https://ftir.fun/openapi.platform.yaml&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/jxbaoxiaodong/ftirfun-mcp" rel="noopener noreferrer"&gt;github.com/jxbaoxiaodong/ftirfun-mcp&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;~135,000 spectra&lt;/strong&gt; indexed and searchable&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;~70% of the code&lt;/strong&gt; co-written with Claude&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;~30% of the code&lt;/strong&gt; rewritten after Claude's version failed in production&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What I'd Tell Other Domain Experts Considering AI-Assisted Development
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Start with the messy data, not the shiny framework.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I spent two weeks getting Claude to generate a perfect Docker Compose setup. Then I spent two months wrangling real FTIR instrument files. The infrastructure was the easy part — the data was the hard part.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. AI will write code that looks right but is wrong.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Claude produced beautiful peak-matching code that passed unit tests and failed on real spectra. The peak positions "matched" mathematically but violated basic FTIR chemistry. You need domain knowledge to catch this.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Production is where the AI-generated code breaks first.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The code that looks clean in a notebook dies first under real load, real data variety, and real timeout limits. Be ready to rewrite the hot paths.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. But the framework code is perfect for AI.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Settings, schemas, API routing, test scaffolding, README files, deployment scripts — Claude wrote these flawlessly. Let AI handle the glue while you focus on the domain logic.&lt;/p&gt;




&lt;h2&gt;
  
  
  What's Next
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Confidence calibration (how reliable is a 0.85 similarity score?)&lt;/li&gt;
&lt;li&gt;Expanded file format support&lt;/li&gt;
&lt;li&gt;Public API with usage tiers&lt;/li&gt;
&lt;li&gt;More MCP tools for agent workflows&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;FTIR.fun is an open-spectral-search project by a materials scientist who learned Python by building it. Questions, feedback, or FTIR datasets to contribute? &lt;a href="mailto:ftir.fun@outlook.com"&gt;ftir.fun@outlook.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>chemistry</category>
      <category>opensource</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
