Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/sagar-grv/ayush-synapse/llms.txt

Use this file to discover all available pages before exploring further.

The /api/search endpoint powers the frontend dashboards and is available without authentication in demo mode. It searches across NAMASTE codes and ICD-11 codes (both TM2 and Biomedicine) simultaneously, returning a unified result list that includes each code’s mapping status and linked ICD-11 target where applicable. This is the primary entry point for the Professional Dashboard, Public Dashboard, and Technical Dashboard search features.

GET /api/search

Method: GET
Path: /api/search
Auth: None required

Query Parameters

q
string
Full-text search query. The value is matched case-insensitively against the code, display, and definition fields of both NAMASTE and ICD-11 code sets. Must be at least 2 characters to return any results. Shorter values are treated as empty.
system
string
default:"all"
Filter results to a specific coding system. Accepted values:
ValueFilters to
allAll NAMASTE and ICD-11 codes (default)
AyurvedaNAMASTE codes with system = "Ayurveda"
SiddhaNAMASTE codes with system = "Siddha"
UnaniNAMASTE codes with system = "Unani"
TM2ICD-11 codes with chapter = "TM2"
BiomedicineICD-11 codes with chapter = "Biomedicine"
mapping
string
default:"all"
Filter results by concept-map status. Accepted values:
ValueFilters to
allBoth mapped and unmapped codes (default)
mappedCodes that have a corresponding entry in the concept map
unmappedCodes with no concept-map entry

Response

Returns a JSON array of unified result objects. Each element represents one code, whether it originated from the NAMASTE set or the ICD-11 set.
NAMASTE_Code
string
The NAMASTE code identifier, e.g. NAM-003. For results that originate purely from an ICD-11 search (i.e. no NAMASTE source code is mapped to this ICD-11 entry), this field is "N/A".
Display_Term
string
Human-readable name for the condition, e.g. Fever.
Definition
string
Clinical definition of the condition.
System
string
The originating coding system. One of Ayurveda, Siddha, Unani, ICD-11 TM2, or ICD-11 Biomedicine.
Target_Code
string
The ICD-11 code this NAMASTE code maps to, e.g. TM2-003. Set to "N/A" if no mapping exists for this code.
Target_Display
string
Display name of the mapped ICD-11 code, e.g. Fever. Set to "Not Mapped" if no mapping exists.

Example — Search for “fever”

curl "http://localhost:5000/api/search?q=fever&system=all&mapping=all"
Response
[
  {
    "NAMASTE_Code": "NAM-003",
    "Display_Term": "Fever",
    "Definition": "Elevated body temperature above normal range",
    "System": "Ayurveda",
    "Target_Code": "TM2-003",
    "Target_Display": "Fever"
  },
  {
    "NAMASTE_Code": "NAM-007",
    "Display_Term": "Jwara",
    "Definition": "Fever or elevated body temperature",
    "System": "Ayurveda",
    "Target_Code": "TM2-007",
    "Target_Display": "Not Mapped"
  },
  {
    "NAMASTE_Code": "N/A",
    "Display_Term": "Fever of unknown origin",
    "Definition": "Elevated body temperature without identified cause",
    "System": "ICD-11 Biomedicine",
    "Target_Code": "BM-003",
    "Target_Display": "Fever of unknown origin"
  }
]

Search Logic

The endpoint applies a two-stage search on each request:
  1. NAMASTE search (primary): The server iterates over all in-memory NAMASTE codes. For each code, it applies the system filter first, then checks whether q appears in the code, display, or definition field (case-insensitive substring match). Passing codes are then matched against the concept map to populate Target_Code and Target_Display. The mapping filter is applied after the concept-map lookup.
  2. ICD-11 search (supplementary): If the NAMASTE stage returns fewer than 20 results, the server calls WhoApiService.search_codes(q) which runs the same substring match against both TM2 and Biomedicine code sets. Results from this stage are subject to the same system and mapping filters. Each ICD-11 result is checked against the concept map in reverse (target → source) to resolve its NAMASTE_Code.
This two-stage design ensures NAMASTE codes are always surfaced first and that the combined result never exceeds a manageable size for frontend rendering.

Example Queries

curl "http://localhost:5000/api/search?q=fever"
Ayurveda system only — returns Ayurveda NAMASTE codes matching “fever”:
Response — system=Ayurveda
[
  {
    "NAMASTE_Code": "NAM-003",
    "Display_Term": "Fever",
    "Definition": "Elevated body temperature above normal range",
    "System": "Ayurveda",
    "Target_Code": "TM2-003",
    "Target_Display": "Fever"
  },
  {
    "NAMASTE_Code": "NAM-007",
    "Display_Term": "Jwara",
    "Definition": "Fever or elevated body temperature",
    "System": "Ayurveda",
    "Target_Code": "TM2-007",
    "Target_Display": "Not Mapped"
  }
]
Mapped codes only — excludes any result without a concept-map entry:
Response — mapping=mapped
[
  {
    "NAMASTE_Code": "NAM-003",
    "Display_Term": "Fever",
    "Definition": "Elevated body temperature above normal range",
    "System": "Ayurveda",
    "Target_Code": "TM2-003",
    "Target_Display": "Fever"
  }
]

Sending an empty q parameter (or omitting it entirely) with no active filters (system=all and mapping=all) returns an empty array [] immediately — no database query is executed. The search query must be at least 2 characters long to trigger any matching logic.
To browse all codes in a specific AYUSH system without a keyword, use the system filter with an empty or omitted q but add an explicit mapping value, e.g. GET /api/search?system=Ayurveda&mapping=unmapped. Because a non-all mapping filter is present, the server will scan the full NAMASTE code list even without a keyword.

Build docs developers (and LLMs) love