<?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: Md.abdullah atif</title>
    <description>The latest articles on DEV Community by Md.abdullah atif (@abdullah-atif).</description>
    <link>https://dev.to/abdullah-atif</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%2F4198420%2F982b3f92-0c30-47f4-9ac6-27e6776dec5c.jpg</url>
      <title>DEV Community: Md.abdullah atif</title>
      <link>https://dev.to/abdullah-atif</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abdullah-atif"/>
    <language>en</language>
    <item>
      <title>Finding the fastest hospital in Dhaka with AI and Geoapify: MCP vs. OpenAPI</title>
      <dc:creator>Md.abdullah atif</dc:creator>
      <pubDate>Wed, 28 Oct 2026 11:24:40 +0000</pubDate>
      <link>https://dev.to/abdullah-atif/finding-the-fastest-hospital-in-dhaka-with-ai-and-geoapify-mcp-vs-openapi-3fnn</link>
      <guid>https://dev.to/abdullah-atif/finding-the-fastest-hospital-in-dhaka-with-ai-and-geoapify-mcp-vs-openapi-3fnn</guid>
      <description>&lt;p&gt;&lt;em&gt;By Abdullah Atif. Built for the &lt;a href="https://www.geoapify.com/" rel="noopener noreferrer"&gt;Geoapify&lt;/a&gt; Open Geospatial Program, Batch #2: AI × Geospatial.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Emergency in Bangladesh? Call 999 first.&lt;/strong&gt; This project helps you find a facility. It does not replace emergency services.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In Dhaka, the hospital that looks closest on a map is often not the one you can reach first. One-way roads,&lt;br&gt;
canals, rivers and dense traffic change the answer. I wanted to see whether AI tools can answer the question&lt;br&gt;
people actually have in an emergency, "where can I get to fastest?", and where they get it wrong.&lt;/p&gt;

&lt;p&gt;I answered the same question in three ways with &lt;a href="https://www.geoapify.com/" rel="noopener noreferrer"&gt;Geoapify&lt;/a&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;An AI agent&lt;/strong&gt; that calls &lt;a href="https://apidocs.geoapify.com/mcp/" rel="noopener noreferrer"&gt;Geoapify MCP&lt;/a&gt; tools at run time (tested in Claude Code and
in VS Code + GitHub Copilot).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A small Python CLI&lt;/strong&gt; that an AI coding agent wrote from the &lt;a href="https://apidocs.geoapify.com/open-api/" rel="noopener noreferrer"&gt;Geoapify OpenAPI specifications&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A phone-friendly web app&lt;/strong&gt; for people who are not developers: "use my location", tap to call 999, Bangla or English.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Then I tested the pipeline on 10 real Dhaka locations, in English and in Bangla.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhj7mr6oel6n4gqkj17hg.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhj7mr6oel6n4gqkj17hg.jpg" alt="Architecture: three front ends, one four-step Geoapify pipeline" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Try the app:&lt;/strong&gt; &lt;a href="https://abdullah-atif.github.io/dhaka-emergency-finder/app/" rel="noopener noreferrer"&gt;https://abdullah-atif.github.io/dhaka-emergency-finder/app/&lt;/a&gt; ·&lt;br&gt;
&lt;strong&gt;Code:&lt;/strong&gt; &lt;a href="https://github.com/Abdullah-Atif/dhaka-emergency-finder" rel="noopener noreferrer"&gt;https://github.com/Abdullah-Atif/dhaka-emergency-finder&lt;/a&gt; (MIT)&lt;/p&gt;


&lt;h2&gt;
  
  
  What you need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Python 3.9 or newer (the CLI uses only the standard library)&lt;/li&gt;
&lt;li&gt;A free Geoapify API key from &lt;a href="https://myprojects.geoapify.com" rel="noopener noreferrer"&gt;https://myprojects.geoapify.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Optional: an MCP-capable AI client (Claude Code, Claude Desktop, VS Code + GitHub Copilot, Cursor)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Put the key in an environment variable. Never commit it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;GEOAPIFY_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your_key            &lt;span class="c"&gt;# macOS / Linux / Git Bash&lt;/span&gt;
&lt;span class="nv"&gt;$env&lt;/span&gt;:GEOAPIFY_API_KEY &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"your_key"&lt;/span&gt;          &lt;span class="c"&gt;# Windows PowerShell&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Part 1: The question, step by step
&lt;/h2&gt;

&lt;p&gt;Whichever way you choose, the answer comes from the same four steps:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Step&lt;/th&gt;
&lt;th&gt;Geoapify MCP tool&lt;/th&gt;
&lt;th&gt;Geoapify REST API&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1. Where am I?&lt;/td&gt;
&lt;td&gt;&lt;code&gt;geocode_address&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Forward Geocoding&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2. What is nearby?&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;search_places&lt;/code&gt; (&lt;code&gt;healthcare.hospital&lt;/code&gt;, ...)&lt;/td&gt;
&lt;td&gt;Places&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3. What can I reach fastest?&lt;/td&gt;
&lt;td&gt;&lt;code&gt;calculate_route_matrix&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Route Matrix&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4. How do I get there?&lt;/td&gt;
&lt;td&gt;&lt;code&gt;calculate_route&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Routing&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Step 3 is the important one. Instead of sorting by straight-line distance, we ask for &lt;strong&gt;travel times from one&lt;br&gt;
source to up to 10 candidates&lt;/strong&gt; in a single request, and sort by time. Use &lt;code&gt;traffic=approximated&lt;/code&gt;: it lowers&lt;br&gt;
speeds on roads that are likely to be congested.&lt;/p&gt;


&lt;h2&gt;
  
  
  Part 2: The AI agent (Geoapify MCP)
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Connect the client
&lt;/h3&gt;

&lt;p&gt;Geoapify MCP is a remote Streamable HTTP server at &lt;code&gt;https://api.geoapify.com/v1/mcp&lt;/code&gt;. It authenticates with your&lt;br&gt;
key in the &lt;code&gt;x-api-key&lt;/code&gt; header. In Claude Code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add &lt;span class="nt"&gt;--transport&lt;/span&gt; http geoapify https://api.geoapify.com/v1/mcp &lt;span class="nt"&gt;--header&lt;/span&gt; &lt;span class="s2"&gt;"x-api-key: YOUR_API_KEY"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check that it is connected:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ claude mcp list
geoapify: https://api.geoapify.com/v1/mcp (HTTP) - ✔ Connected
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I tested this command with Claude Code 2.1, and I also tested VS Code + GitHub Copilot (session 3 below). Setup for both&lt;br&gt;
is in &lt;a href="https://github.com/Abdullah-Atif/dhaka-emergency-finder/blob/main/agent/MCP_SETUP.md" rel="noopener noreferrer"&gt;agent/MCP_SETUP.md&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Tell the agent how to behave
&lt;/h3&gt;

&lt;p&gt;Tools alone are not enough. The agent needs rules, especially for an emergency use case. Mine&lt;br&gt;
(&lt;a href="https://github.com/Abdullah-Atif/dhaka-emergency-finder/blob/main/agent/AGENT_INSTRUCTIONS.md" rel="noopener noreferrer"&gt;agent/AGENT_INSTRUCTIONS.md&lt;/a&gt;) say:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Always start with "Call 999".&lt;/li&gt;
&lt;li&gt;Never invent a facility, phone number or time. Every fact must come from a tool result.&lt;/li&gt;
&lt;li&gt;Rank by &lt;strong&gt;travel time&lt;/strong&gt;, not by distance.&lt;/li&gt;
&lt;li&gt;If geocoding only matched the city, ask for a landmark instead of answering for the city centre.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Session 1: English, every call logged
&lt;/h3&gt;

&lt;p&gt;I asked: &lt;em&gt;"I am at Mirpur 10 golchottor. Where is the fastest hospital to reach by car?"&lt;/em&gt; For this first session,&lt;br&gt;
the agent (Claude Code) called the MCP tools through a tiny JSON-RPC helper,&lt;br&gt;
&lt;a href="https://github.com/Abdullah-Atif/dhaka-emergency-finder/blob/main/agent/mcp_call.py" rel="noopener noreferrer"&gt;&lt;code&gt;agent/mcp_call.py&lt;/code&gt;&lt;/a&gt;, so that&lt;br&gt;
every request and response is logged. The agent decided every call itself; the helper only sends them. It made 6 tool&lt;br&gt;
calls. The &lt;a href="https://github.com/Abdullah-Atif/dhaka-emergency-finder/blob/main/agent/sessions/01-mirpur-hospital.md" rel="noopener noreferrer"&gt;full transcript&lt;/a&gt; is in the repository. Here is what happened:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;geocode_address&lt;/code&gt; found the Mirpur 10 bus station with &lt;code&gt;match_type: inner_part&lt;/code&gt; and confidence 1.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;search_places&lt;/code&gt; found 10 places tagged as hospitals within 75 to 201 m.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;calculate_route_matrix&lt;/code&gt; returned travel times of 120 to 429 seconds.&lt;/li&gt;
&lt;li&gt;The first &lt;code&gt;calculate_route&lt;/code&gt; call &lt;strong&gt;failed&lt;/strong&gt;: &lt;code&gt;geometry_scope "steps" requires include_instructions to be true&lt;/code&gt;.
The error was clear, and the agent fixed it in one retry.&lt;/li&gt;
&lt;li&gt;The second call worked, but returned &lt;strong&gt;33 s&lt;/strong&gt; while the matrix said &lt;strong&gt;120 s&lt;/strong&gt;. The agent had forgotten
&lt;code&gt;traffic=approximated&lt;/code&gt; on the route call.&lt;/li&gt;
&lt;li&gt;With the same &lt;code&gt;traffic&lt;/code&gt; setting the route took 121 s, which matches the matrix.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The answer it gave:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Emergency? Call 999.&lt;/strong&gt; Fastest by car: AALOK HEALTHCARE (~2 min, 254 m), FSCD Burn Unite Hospital (~2 min),&lt;br&gt;
DR. AZMAL HOSPITAL LTD. (~2 min). Note: &lt;strong&gt;Medinova Hospital looks very close on the map (122 m), but by road it is&lt;br&gt;
about 1 km and 7 minutes away.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That last line is the whole point of the project.&lt;/p&gt;
&lt;h3&gt;
  
  
  Session 2: Bangla, inside Claude Code
&lt;/h3&gt;

&lt;p&gt;Then I asked in Bangla, &lt;em&gt;"আমি ফার্মগেটে আছি, গাড়িতে সবচেয়ে তাড়াতাড়ি কোন হাসপাতালে যেতে পারব?"&lt;/em&gt; ("I am at&lt;br&gt;
Farmgate. Which hospital can I reach fastest by car?"). This time Claude Code used its &lt;strong&gt;built-in MCP client&lt;/strong&gt;, with&lt;br&gt;
only the Geoapify tools allowed. It took 4 Geoapify calls and 35 seconds&lt;br&gt;
(&lt;a href="https://github.com/Abdullah-Atif/dhaka-emergency-finder/blob/main/agent/sessions/02-farmgate-claude-code-bangla.md" rel="noopener noreferrer"&gt;write-up and transcript&lt;/a&gt;):&lt;br&gt;
&lt;code&gt;geocode_address&lt;/code&gt; → &lt;code&gt;search_places&lt;/code&gt; (15 places) → &lt;code&gt;calculate_route_matrix&lt;/code&gt; (10 targets) → &lt;code&gt;calculate_route&lt;/code&gt; with&lt;br&gt;
&lt;code&gt;include_instructions: true&lt;/code&gt;, which was right on the first try this time.&lt;/p&gt;

&lt;p&gt;The answer came back in Bangla. It listed Al Razi Hospital Complex first (about 1 min, 401 m, "open 24/7" from the&lt;br&gt;
place's &lt;code&gt;opening_hours&lt;/code&gt;). It also put Al Fateh Diagnostics, an eye institute and Brain and Mind Hospital in a separate&lt;br&gt;
list as "may not be a general hospital". The instructions only ask for a general reminder; sorting the places this&lt;br&gt;
way was the agent's own idea.&lt;/p&gt;

&lt;p&gt;One gap: my instructions said "rank by travel time" but did not say to use &lt;code&gt;traffic=approximated&lt;/code&gt;, so the agent used&lt;br&gt;
free-flow speeds. It told the user so ("traffic not counted; real times will be longer"). The instructions now require it.&lt;/p&gt;
&lt;h3&gt;
  
  
  Session 3: the same question in VS Code + GitHub Copilot
&lt;/h3&gt;

&lt;p&gt;Finally I asked the session 1 question again, this time in &lt;strong&gt;VS Code with GitHub Copilot in Agent mode&lt;/strong&gt;, which used an&lt;br&gt;
OpenAI model and VS Code's own MCP client&lt;br&gt;
(&lt;a href="https://github.com/Abdullah-Atif/dhaka-emergency-finder/blob/main/agent/sessions/03-mirpur-vscode-copilot.md" rel="noopener noreferrer"&gt;write-up and transcript&lt;/a&gt;).&lt;br&gt;
It made the same 4 Geoapify calls, this time with &lt;code&gt;traffic: "approximated"&lt;/code&gt; on both the matrix and the route, as the&lt;br&gt;
updated instructions require. It gave &lt;strong&gt;the same answer as Claude Code in session 1&lt;/strong&gt;: AALOK HEALTHCARE, about 2 min, 254 m.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4ngc8tbe12k4lv6ts9cq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4ngc8tbe12k4lv6ts9cq.png" alt="Copilot's answer in VS Code" width="604" height="613"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Two surprises worth knowing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Copilot read &lt;code&gt;.vscode/mcp.json&lt;/code&gt; on its own&lt;/strong&gt;, after a permission prompt, and so sent my Geoapify key to the model,
because for this test I had written the key straight into that file. A key exposed like this should be replaced. Use VS Code's &lt;code&gt;inputs&lt;/code&gt; prompt
(&lt;code&gt;${input:geoapify-key}&lt;/code&gt;) instead, and deny file-read requests for config files.&lt;/li&gt;
&lt;li&gt;Pressing &lt;strong&gt;Start&lt;/strong&gt; on the MCP server before sending any chat message fails with &lt;em&gt;"Send a message first."&lt;/em&gt; Just ask
your question; the server starts on its own.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What worked:&lt;/strong&gt; MCP tools take &lt;code&gt;{lat, lon}&lt;/code&gt; objects everywhere, so the agent never mixed up coordinate order.&lt;br&gt;
Error messages were precise enough to fix in one retry.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What needed a human:&lt;/strong&gt; the two mistakes in session 1 (steps 4 and 5), and the missing &lt;code&gt;traffic&lt;/code&gt; in session 2. Each one&lt;br&gt;
became a rule in the instructions: &lt;em&gt;use &lt;code&gt;traffic: "approximated"&lt;/code&gt; for driving, and the same &lt;code&gt;mode&lt;/code&gt; and &lt;code&gt;traffic&lt;/code&gt; for&lt;br&gt;
the matrix and the route&lt;/em&gt;.&lt;/p&gt;


&lt;h2&gt;
  
  
  Part 3: The CLI, written by an AI coding agent from the OpenAPI specs
&lt;/h2&gt;

&lt;p&gt;I gave Claude Code the four JSON specifications (Forward Geocoding, Places, Route Matrix, Routing) and a short&lt;br&gt;
brief. The brief is in &lt;a href="https://github.com/Abdullah-Atif/dhaka-emergency-finder/blob/main/prompts/01-prototype.md" rel="noopener noreferrer"&gt;prompts/01-prototype.md&lt;/a&gt;.&lt;br&gt;
The result is a standard-library-only Python package:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python &lt;span class="nt"&gt;-m&lt;/span&gt; dhaka_emergency &lt;span class="s2"&gt;"Farmgate, Dhaka"&lt;/span&gt; &lt;span class="nt"&gt;--top&lt;/span&gt; 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;!! Emergency? Call 999 first.

From: Farmgate, Airport Road, Tejgaon, Dhaka - 1215, Bangladesh
Nearest hospital by drive travel time:

1. Al Fateh Diagnostics
   1 min | 0.3 km by road | 0.3 km straight line
   Note: the name suggests this may not have an emergency department
   Kazi Nazrul Islam Avenue, Tejgaon, Dhaka - 1215, Bangladesh
2. Brain and Mind Hospital
   1 min | 0.5 km by road | 0.3 km straight line
   Airport Road, Tejgaon, Dhaka - 1215, Bangladesh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add &lt;code&gt;--map out.html&lt;/code&gt; to get a Leaflet map with Geoapify tiles and the route to the first result.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftnq009y416h4cccljsp9.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftnq009y416h4cccljsp9.jpg" alt="HTML map for Farmgate: your position (blue), hospitals (markers) and the route to the fastest one (red)" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The core of it
&lt;/h3&gt;

&lt;p&gt;The heart of the code is the ranking step: one Route Matrix request with one source and all candidates as targets&lt;br&gt;
(simplified from &lt;a href="https://github.com/Abdullah-Atif/dhaka-emergency-finder/blob/main/dhaka_emergency/geoapify.py" rel="noopener noreferrer"&gt;&lt;code&gt;geoapify.py&lt;/code&gt;&lt;/a&gt;):&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="n"&gt;body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;mode&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sources&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;location&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;lon&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lat&lt;/span&gt;&lt;span class="p"&gt;]}],&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;targets&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;location&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;lon&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;lat&lt;/span&gt;&lt;span class="p"&gt;]}&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;candidates&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;traffic&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;approximated&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://api.geoapify.com/v1/routematrix&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;times&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sources_to_targets&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;   &lt;span class="c1"&gt;# one row: source -&amp;gt; each target
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What the AI got right from the specs
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The right servers (&lt;code&gt;/v1&lt;/code&gt; for geocoding, routing and matrix; &lt;code&gt;/v2&lt;/code&gt; for places).&lt;/li&gt;
&lt;li&gt;Exact category keys (&lt;code&gt;healthcare.hospital&lt;/code&gt;, &lt;code&gt;service.fire_station&lt;/code&gt;, &lt;code&gt;emergency.ambulance_station&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;x-api-key&lt;/code&gt; header from the specs' &lt;code&gt;securitySchemes&lt;/code&gt;, instead of putting the key in the URL.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The trap: coordinate order
&lt;/h3&gt;

&lt;p&gt;The REST APIs do not agree on coordinate order. &lt;strong&gt;Routing&lt;/strong&gt; &lt;code&gt;waypoints&lt;/code&gt; use &lt;code&gt;lat,lon&lt;/code&gt;, while &lt;strong&gt;Places&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;filter&lt;/code&gt;/&lt;code&gt;bias&lt;/code&gt; and &lt;strong&gt;Route Matrix&lt;/strong&gt; &lt;code&gt;location&lt;/code&gt; use &lt;code&gt;lon,lat&lt;/code&gt;. This is the easiest bug to ship. The fix is to keep&lt;br&gt;
all HTTP calls in one module, with a comment at each spot. (The MCP tools avoid the problem completely with&lt;br&gt;
named &lt;code&gt;{lat, lon}&lt;/code&gt; fields.)&lt;/p&gt;


&lt;h2&gt;
  
  
  Part 4: A web app for everyone else
&lt;/h2&gt;

&lt;p&gt;A CLI and an AI client are fine for developers, but in an emergency people reach for a phone. So the same pipeline&lt;br&gt;
also runs as a single static page (&lt;a href="https://github.com/Abdullah-Atif/dhaka-emergency-finder/tree/main/docs/app" rel="noopener noreferrer"&gt;&lt;code&gt;docs/app/&lt;/code&gt;&lt;/a&gt;,&lt;br&gt;
no build step, no server), hosted free on GitHub Pages:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Bangla, dark mode, hospitals near Mirpur 10&lt;/th&gt;
&lt;th&gt;English, light mode, fire service near Shahbag&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy5d816t3itzdb8afc161.jpg" alt="Web app in Bangla" width="750" height="1624"&gt;&lt;/td&gt;
&lt;td&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6pof3tdgo770ombqoclw.jpg" alt="Web app in English" width="750" height="1624"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;What it does differently from a plain "nearest hospital" search:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A big "tap to call 999" button at the top&lt;/strong&gt;, before anything else.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;📍 Use my location&lt;/strong&gt; starts the search right away, and looks up the street address in parallel.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Suggestions while you type&lt;/strong&gt;, like Google Maps, from the Geoapify
&lt;a href="https://apidocs.geoapify.com/docs/geocoding/address-autocomplete/" rel="noopener noreferrer"&gt;Address Autocomplete API&lt;/a&gt;. One catch: Autocomplete
returned &lt;strong&gt;nothing&lt;/strong&gt; for partial Bangla words ("ধানমন্ডি", "মিরপুর ১০"), while the regular search found them. So for Bangla
text the app falls back to &lt;code&gt;/geocode/search&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2za8twadlwiglq3ztzy3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2za8twadlwiglq3ztzy3.jpg" alt="Suggestions while typing &amp;quot;dhanmo&amp;quot;" width="375" height="812"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Results appear in two steps.&lt;/strong&gt; The 10 nearest places show by distance after the Places call (1.6 s in one test on a
good connection; it depends on the network); they are re-sorted by travel time when the Route Matrix answers, and the route to #1 is drawn on the map.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The same warnings as the CLI:&lt;/strong&gt; city-level geocoding fallback, and a badge on every hospital saying whether it
likely has an emergency department (see Part 6), plus a warning for places whose name says they are something else. In the Shahbag fire-service search,
#2 was &lt;em&gt;"Mosque of Bangladesh Fire Service &amp;amp; Civil Defence Headquarter"&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It merges duplicates&lt;/strong&gt; ("radda" and "RADDA", 5 m apart, were both in the Places results).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bangla and English&lt;/strong&gt; interface, a &lt;strong&gt;Navigate&lt;/strong&gt; button that opens directions in Google Maps, and &lt;strong&gt;tap-to-call&lt;/strong&gt; for
places that have a phone number in the map data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;🕒 10 / 15 min reach:&lt;/strong&gt; one tap shades the area you can reach in 10 and 15 minutes, from the
&lt;a href="https://apidocs.geoapify.com/docs/isolines/" rel="noopener noreferrer"&gt;Isoline API&lt;/a&gt; (3 credits), and says how many of the listed places fall
inside it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;📤 Share:&lt;/strong&gt; sends "I am going to X, about 12 min by car" with map links to where you are and where you are going
(the phone's share menu, or WhatsApp on a computer).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;✏️ Fix it on OpenStreetMap:&lt;/strong&gt; every card links to the place on OpenStreetMap (Places returns &lt;code&gt;osm_type&lt;/code&gt; and
&lt;code&gt;osm_id&lt;/code&gt;), so anyone who sees a wrong name or a missing phone number can correct it for every app, not only this one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verified emergency lines.&lt;/strong&gt; Map data rarely has a phone number, and a hospital's switchboard is not its emergency
room. So a separate pass read the official websites of the 7 confirmed hospitals and kept only numbers the
hospital itself labels emergency or hotline: &lt;strong&gt;BIRDEM, Evercare and Bangladesh Specialized Hospital&lt;/strong&gt; publish one;
DMCH, BMU, NITOR and the eye institute publish only switchboard or daytime numbers, so the app shows none for them
rather than a wrong one. Each number carries its source link. Fire-service searches also show the &lt;strong&gt;102&lt;/strong&gt; hotline.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Works like an app:&lt;/strong&gt; it can be installed to the home screen (web app manifest + service worker), opens without a
network, and then shows &lt;strong&gt;your last search&lt;/strong&gt; with a clear "no internet" note. The Geoapify calls themselves are never
cached: emergency data must be live.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The browser calls Geoapify directly. Geoapify answers with &lt;code&gt;access-control-allow-origin: *&lt;/code&gt;, so a static page is&lt;br&gt;
enough. The pure logic (ranking, duplicate merging, the warning heuristics) has its own tests:&lt;br&gt;
&lt;code&gt;node --test tests/app.test.js&lt;/code&gt;.&lt;/p&gt;


&lt;h2&gt;
  
  
  Part 5: What 10 Dhaka locations showed
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;python benchmark/run.py&lt;/code&gt; geocodes each location, finds up to 10 hospitals, and compares the &lt;strong&gt;nearest on the map&lt;/strong&gt;&lt;br&gt;
with the &lt;strong&gt;fastest to reach&lt;/strong&gt;. &lt;a href="https://github.com/Abdullah-Atif/dhaka-emergency-finder/blob/main/benchmark/results.md" rel="noopener noreferrer"&gt;Full results&lt;/a&gt; ·&lt;br&gt;
&lt;a href="https://github.com/Abdullah-Atif/dhaka-emergency-finder/blob/main/benchmark/NOTES.md" rel="noopener noreferrer"&gt;manual review&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Finding&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;The nearest hospital on the map was &lt;strong&gt;not&lt;/strong&gt; the fastest by car&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;8 of 9&lt;/strong&gt; locations; at least 1 minute faster in &lt;strong&gt;6 of 9&lt;/strong&gt; (up to 6.9 min)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The fastest "hospital" is, by its name, a diagnostic centre or eye hospital&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;3 of 9&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Geocoding found the right place&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;8 of 10&lt;/strong&gt;: English 4 / 6, &lt;strong&gt;Bangla 4 / 4&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Three lessons:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Bangla often geocodes better than English.&lt;/strong&gt; &lt;code&gt;ধানমন্ডি ২৭&lt;/code&gt; found the Dhanmondi 27 junction, but&lt;br&gt;
&lt;code&gt;Dhanmondi 27, Dhaka&lt;/code&gt; fell back to the whole city. &lt;code&gt;বুয়েট&lt;/code&gt; found the BUET campus, but &lt;code&gt;BUET, Dhaka&lt;/code&gt; matched a&lt;br&gt;
building with "BUET" in its name 8 km away. The full English name matched a company called "… Technology".&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Check &lt;code&gt;match_type&lt;/code&gt;.&lt;/strong&gt; A city-level fallback looks like a normal answer. The only hint is&lt;br&gt;
&lt;code&gt;rank.match_type = "match_by_city_or_disrict"&lt;/code&gt;. My first version listed hospitals around the city centre without&lt;br&gt;
any warning, and the benchmark caught it. Now the CLI warns, and the agent asks for a landmark. Some wrong&lt;br&gt;
results still come back as &lt;code&gt;full_match&lt;/code&gt;, though, so this check does not catch everything.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. "Hospital" in the map data is not always a hospital.&lt;/strong&gt; In Dhaka, OpenStreetMap tags many diagnostic centres,&lt;br&gt;
eye hospitals and even a pharmacy as hospitals. The CLI flags names that suggest no emergency department. It is a&lt;br&gt;
heuristic, so verify before relying on it.&lt;/p&gt;


&lt;h2&gt;
  
  
  Part 6: Which "hospital" actually has an emergency department?
&lt;/h2&gt;

&lt;p&gt;Testing the app around Dhaka, the fastest "hospital" was often a diagnostic centre, a pharmacy or an unnamed building.&lt;br&gt;
Map data is the reason. Of the &lt;strong&gt;447 places Geoapify returns as &lt;code&gt;healthcare.hospital&lt;/code&gt; inside Dhaka city, none has a bed&lt;br&gt;
count, only 40 say anything about emergency care, and 4 of those 40 are wrong&lt;/strong&gt;: &lt;code&gt;emergency=yes&lt;/code&gt; on a homeo pharmacy,&lt;br&gt;
a dental clinic, an outpatient unit and a diagnostic centre.&lt;/p&gt;

&lt;p&gt;So I ran a &lt;strong&gt;deep-research pass&lt;/strong&gt;: four researchers in parallel, then one writer&lt;br&gt;
(&lt;a href="https://github.com/Abdullah-Atif/dhaka-emergency-finder/blob/main/docs/research/hospital-classification.md" rel="noopener noreferrer"&gt;full report with sources&lt;/a&gt;). It covered the OSM tagging rules, Bangladeshi licensing and naming,&lt;br&gt;
sources for 24-hour emergency departments, and the status of the hotlines. Three findings shaped the design:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bangladeshi law puts "hospital", "clinic" and "nursing home" in &lt;strong&gt;one category&lt;/strong&gt;. Diagnostic centres, labs and blood
banks hold &lt;strong&gt;separate licences&lt;/strong&gt; with no inpatient care. So a word like &lt;em&gt;Diagnostic&lt;/em&gt; or &lt;em&gt;Chamber&lt;/em&gt; in a name is a strong
"no", but &lt;em&gt;Hospital&lt;/em&gt; alone proves little.&lt;/li&gt;
&lt;li&gt;Government tiers (medical college hospitals, Upazila Health Complexes) reliably run emergency departments. Specialised
institutes take only their own kind of emergency (eye, trauma, children, burns, heart).&lt;/li&gt;
&lt;li&gt;Strong sources confirm a 24-hour emergency department for only &lt;strong&gt;7&lt;/strong&gt; Dhaka hospitals.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;From that, one rules file (&lt;a href="https://github.com/Abdullah-Atif/dhaka-emergency-finder/blob/main/docs/app/facility_rules.json" rel="noopener noreferrer"&gt;&lt;code&gt;facility_rules.json&lt;/code&gt;&lt;/a&gt;)&lt;br&gt;
drives the same classifier in the web app (JavaScript) and the CLI (Python). The two agree on all 837 hospital and clinic places&lt;br&gt;
in Dhaka:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Name in the map data&lt;/th&gt;
&lt;th&gt;Badge&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Dhaka Medical College Hospital, Government hospital, Secretariat Rd, Dhaka&lt;/td&gt;
&lt;td&gt;🚑 24-hour emergency (confirmed, with source)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mugda Medical College Hospital&lt;/td&gt;
&lt;td&gt;🚑 Government hospital: emergency expected&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ibn Sina Hospital&lt;/td&gt;
&lt;td&gt;Hospital: emergency department not verified&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ispahani Islamia Eye Institute and Hospital&lt;/td&gt;
&lt;td&gt;Specialised: eye emergencies only&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Square hospital &lt;strong&gt;Consultation&lt;/strong&gt; and Diagnostic centre&lt;/td&gt;
&lt;td&gt;⛔ Not an emergency hospital: a consultation centre&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Meherun Homeo Pharmacy (tagged &lt;code&gt;emergency=yes&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;⛔ Not an emergency hospital: a pharmacy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Al Razi Hospital Complex (tagged &lt;code&gt;emergency=no&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;⛔ Map data says: no emergency department&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flwzbaowrbugwsxxjd609.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flwzbaowrbugwsxxjd609.jpg" alt="Badges near Shahbag: PG Hospital and BIRDEM confirmed, one place not verified" width="375" height="812"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Places marked ⛔ move to the end of the list but stay visible. The badges work in Bangla too, and Bangla names are&lt;br&gt;
matched (ডায়াগনস্টিক, চেম্বার, চক্ষু, শিশু, পঙ্গু ...).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How good is it?&lt;/strong&gt; (&lt;a href="https://github.com/Abdullah-Atif/dhaka-emergency-finder/blob/main/benchmark/classify_eval.md" rel="noopener noreferrer"&gt;evaluation&lt;/a&gt;)&lt;br&gt;
I reviewed a random sample of 40 places by hand: &lt;strong&gt;36 of 40 were right&lt;/strong&gt;. The 4 misses were fixed: a consultation centre&lt;br&gt;
with "hospital" in its name, a real name hidden in the second comma part, "Orthopedic &lt;strong&gt;and General&lt;/strong&gt; Hospital", and the&lt;br&gt;
typo "Metarnity". Because I fixed those rules on that same sample, I then checked &lt;strong&gt;30 fresh places: 28 right&lt;/strong&gt;. The&lt;br&gt;
2 misses ended up as "unknown", never as a wrong answer. In both samples no non-hospital was promoted and no emergency&lt;br&gt;
hospital was hidden. And wherever the classifier disagreed with OSM's own &lt;code&gt;emergency&lt;/code&gt; tag, the tag was the one that was wrong.&lt;/p&gt;

&lt;p&gt;Outside the samples, a real test with the AI agent found one dangerous miss. Two of NITOR's five map entries&lt;br&gt;
("... Rehabilitation &lt;strong&gt;(NITOR)&lt;/strong&gt;" and the typo "Traum*&lt;em&gt;t&lt;/em&gt;*ology") were labelled a physiotherapy centre because of the word&lt;br&gt;
"Rehabilitation", so the country's main trauma hospital was pushed to the end. Now the confirmed-hospital check also&lt;br&gt;
reads the text inside brackets and fixes that typo, and both entries are confirmed again.&lt;/p&gt;

&lt;p&gt;A third, larger check after all fixes: &lt;a href="https://github.com/Abdullah-Atif/dhaka-emergency-finder/blob/main/benchmark/classify_review.md" rel="noopener noreferrer"&gt;50 fresh places, &lt;strong&gt;47 right&lt;/strong&gt;&lt;/a&gt;.&lt;br&gt;
The 3 misses (an office, a nuclear-medicine institute, "DigiLab") all came out as "unknown", again never as a wrong answer.&lt;/p&gt;

&lt;p&gt;What it still cannot do: say how big a hospital is or which departments it has. That data is simply not in the map,&lt;br&gt;
and fixing it upstream in OpenStreetMap would help every app.&lt;/p&gt;
&lt;h3&gt;
  
  
  The nearest &lt;em&gt;major&lt;/em&gt; hospital
&lt;/h3&gt;

&lt;p&gt;The fastest place is not always the best one. From Mirpur 10 the fastest "hospital" is 2 minutes away, but its emergency&lt;br&gt;
department is unknown; a big general hospital is about half an hour away. Without bed counts, the classifier marks&lt;br&gt;
three groups as &lt;strong&gt;major&lt;/strong&gt;: hospitals with a source-confirmed general 24-hour emergency department, government general&lt;br&gt;
hospitals, and medical college hospitals (teaching hospitals with many departments). The app then:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;asks Places for the &lt;strong&gt;200 nearest&lt;/strong&gt; hospitals instead of 10 (100 reach only about 4 km in central Dhaka), keeps the
10 nearest and adds up to &lt;strong&gt;6 major hospitals&lt;/strong&gt; from further away, so they get real travel times too;&lt;/li&gt;
&lt;li&gt;shows a &lt;strong&gt;"Nearest major hospital"&lt;/strong&gt; card above the list when #1 is not a major hospital;&lt;/li&gt;
&lt;li&gt;offers a &lt;strong&gt;"Major hospitals only"&lt;/strong&gt; switch (CLI: &lt;code&gt;--major&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Two map details mattered. The same hospital often appears several times: "Shahid Sohrawardy Medical College" and&lt;br&gt;
"Shaheed Suhrawardi Medical College Hospital" 190 m apart, or three entries for PG Hospital. Distance alone cannot merge&lt;br&gt;
them, because BIRDEM is only 80 m from PG Hospital. So entries merge when they match the same confirmed hospital, or&lt;br&gt;
when they are within 300 m and the first word of the name has the same consonants ("shrwrd").&lt;/p&gt;

&lt;p&gt;The cost is honest to state: a hospital search now uses about 27 Geoapify credits (Places: 1 + 1 per 20 places;&lt;br&gt;
Route Matrix: 1 per target) instead of about 13, so a free key covers roughly 100 hospital searches a day.&lt;/p&gt;


&lt;h2&gt;
  
  
  Part 7: How much of Dhaka is within 15 minutes of an emergency department?
&lt;/h2&gt;

&lt;p&gt;The app answers "where do I go from &lt;em&gt;here&lt;/em&gt;?". The same APIs can answer a city-wide question too.&lt;br&gt;
&lt;a href="https://github.com/Abdullah-Atif/dhaka-emergency-finder/blob/main/benchmark/coverage.py" rel="noopener noreferrer"&gt;&lt;code&gt;benchmark/coverage.py&lt;/code&gt;&lt;/a&gt;&lt;br&gt;
(standard library only):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;takes the &lt;strong&gt;Dhaka Metropolitan boundary&lt;/strong&gt; (OSM "ঢাকা মহানগর") from the Geoapify
&lt;a href="https://apidocs.geoapify.com/docs/boundaries/" rel="noopener noreferrer"&gt;Boundaries API&lt;/a&gt; &lt;code&gt;part-of&lt;/code&gt; endpoint;&lt;/li&gt;
&lt;li&gt;finds every hospital in and around it with the Places API and keeps the ones the classifier from Part 6 can
defend: &lt;strong&gt;set A&lt;/strong&gt; = confirmed general 24-hour emergency departments + government general hospitals (11 after
merging entries of one campus); &lt;strong&gt;set B&lt;/strong&gt; = A + medical college hospitals (26);&lt;/li&gt;
&lt;li&gt;asks the &lt;strong&gt;Isoline API&lt;/strong&gt; for the area reachable by car in 10 and 15 minutes from each of them (traffic approximated);&lt;/li&gt;
&lt;li&gt;lays a 300 m grid over the boundary (304 km²) and checks which points fall inside any isoline.&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Hospitals counted&lt;/th&gt;
&lt;th&gt;Within 10 min&lt;/th&gt;
&lt;th&gt;Within 15 min&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A: confirmed + government (11)&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;12%&lt;/strong&gt; of the area&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;28%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;B: A + medical college hospitals (26)&lt;/td&gt;
&lt;td&gt;30%&lt;/td&gt;
&lt;td&gt;54%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhqv5u1odo0hcljfh9ull.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhqv5u1odo0hcljfh9ull.jpg" alt="Coverage map: green within 15 minutes of a confirmed or government emergency department, red beyond" width="650" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://abdullah-atif.github.io/dhaka-emergency-finder/app/coverage.html" rel="noopener noreferrer"&gt;Open the interactive coverage map&lt;/a&gt; ·&lt;br&gt;
&lt;a href="https://github.com/Abdullah-Atif/dhaka-emergency-finder/blob/main/benchmark/coverage.md" rel="noopener noreferrer"&gt;method and caveats&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The public emergency departments cluster in the old city and around Shahbag; most of the metropolitan area, east and&lt;br&gt;
north, relies on private hospitals whose emergency units nobody has verified. Read it with its limits: it measures&lt;br&gt;
&lt;strong&gt;area, not people&lt;/strong&gt;, uses Geoapify's typical-traffic model rather than rush hour, and treats isolines that go &lt;em&gt;out of&lt;/em&gt;&lt;br&gt;
a hospital as minutes &lt;em&gt;to&lt;/em&gt; it. It also found a data gap: Bangladesh Specialized Hospital, whose 24-hour emergency&lt;br&gt;
department is confirmed, is not in the map data as a hospital at all, so it could not be counted.&lt;/p&gt;

&lt;p&gt;Two classifier fixes came out of this run: the map spells Shaheed Suhrawardy Medical College Hospital "Shahid&lt;br&gt;
&lt;strong&gt;Sohrawardy&lt;/strong&gt;" and "Shaheed &lt;strong&gt;Suhrawardi&lt;/strong&gt;", so this 1,000-bed government hospital was being shown as an unverified&lt;br&gt;
private one; and Dhaka Mohanagar General Hospital (Dhaka South City Corporation) was missing from the government list.&lt;/p&gt;


&lt;h2&gt;
  
  
  Part 8: Feedback for Geoapify
&lt;/h2&gt;

&lt;p&gt;The full list, with evidence for each point, is in &lt;a href="https://github.com/Abdullah-Atif/dhaka-emergency-finder/blob/main/docs/feedback.md" rel="noopener noreferrer"&gt;feedback.md&lt;/a&gt;. The main suggestions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understand Dhaka abbreviations: &lt;code&gt;R/A&lt;/code&gt; → Residential Area, &lt;code&gt;Gulshan 1 Circle&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Penalise single-token matches for landmark queries ("BUET" → "BUET-TPHS Building").&lt;/li&gt;
&lt;li&gt;Wrong places (up to about 15 km away) returned as &lt;code&gt;full_match&lt;/code&gt; make &lt;code&gt;match_type&lt;/code&gt; less useful as a quality signal.&lt;/li&gt;
&lt;li&gt;Small typo in the API: &lt;code&gt;match_by_city_or_disrict&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;MCP &lt;code&gt;geocode_address&lt;/code&gt; could tell agents in its description to check &lt;code&gt;match_type&lt;/code&gt; before using the result.&lt;/li&gt;
&lt;li&gt;An MCP tool for place details or outlines. Today &lt;code&gt;search_places&lt;/code&gt; returns points only.&lt;/li&gt;
&lt;li&gt;A Places condition for hospitals with an emergency department (OpenStreetMap &lt;code&gt;emergency=yes&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;MCP &lt;code&gt;search_places&lt;/code&gt; drops the OSM tags (&lt;code&gt;emergency&lt;/code&gt;, &lt;code&gt;name:en&lt;/code&gt;, &lt;code&gt;opening_hours&lt;/code&gt;), which the REST Places API returns.&lt;/li&gt;
&lt;li&gt;Address Autocomplete returns nothing for partial Bangla words, while search finds them.&lt;/li&gt;
&lt;li&gt;An Isoline option for the reverse direction ("from where can I reach this point in 15 minutes?"), which is what
emergency coverage needs.&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;In your browser:&lt;/strong&gt; &lt;a href="https://abdullah-atif.github.io/dhaka-emergency-finder/app/" rel="noopener noreferrer"&gt;https://abdullah-atif.github.io/dhaka-emergency-finder/app/&lt;/a&gt; ·&lt;br&gt;
&lt;a href="https://abdullah-atif.github.io/dhaka-emergency-finder/app/coverage.html" rel="noopener noreferrer"&gt;coverage map&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;From the command line:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/Abdullah-Atif/dhaka-emergency-finder
&lt;span class="nb"&gt;cd &lt;/span&gt;dhaka-emergency-finder
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;GEOAPIFY_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your_key
python &lt;span class="nt"&gt;-m&lt;/span&gt; dhaka_emergency &lt;span class="s2"&gt;"ধানমন্ডি ২৭"&lt;/span&gt; &lt;span class="nt"&gt;--type&lt;/span&gt; pharmacy
python &lt;span class="nt"&gt;-m&lt;/span&gt; unittest discover &lt;span class="nt"&gt;-s&lt;/span&gt; tests
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Location data © OpenStreetMap contributors. Geocoding, places, routing and map tiles by &lt;a href="https://www.geoapify.com/" rel="noopener noreferrer"&gt;Geoapify&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>mcp</category>
      <category>python</category>
      <category>maps</category>
    </item>
  </channel>
</rss>
