Search
The /search
endpoint helps find medical concepts (symptoms, risk factors, and conditions) that match a given phrase. In contrast to the /parse
endpoint, the /search
endpoint can handle short word fragments, even those just a few letters long, and is suitable for building autocomplete-like input forms. Its main function is to convert user-entered phrases into specific medical concept IDs recognized by our API.
Apart from the common attributes name
and common_name
, /search
also has access to a database that has two types of synonyms – ones used by the medical community and ones used by regular users. This enhances its capability to correctly recognize a broader range of user-entered phrases.
Unlike the /parse
endpoint, /search
supports all languages available in the Infermedica API.
Request
The /search
endpoint responds to GET requests and requires two query parameters:
phrase
– the phrase to be matched against medical concepts.age.value
– the patient's age, which should be a positive integer between 0 and 130.
An optional age.unit
query parameter can also be added to change the default unit from year
to month
. For example, age.value=5&age.unit=month
indicates an age of 5 months. If age.unit
is omitted, the default unit of year
will be used.
curl "https://api.infermedica.com/v3/search?phrase=bell&age.value=30" \
-X "GET" \
-H "App-Id: XXXXXXXX" \
-H "App-Key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
-H "Interview-Id: d083e76f-3c29-44aa-8893-587f3691c0c5"
Filtering by sex
An optional sex
parameter can be used to filter the search results for concepts applicable to a selected biological sex. The allowed values are female
or male
.
For example, use /v3/search?phrase=lacta&age.value=30&sex=female
to show only those medical concepts relevant for one biological sex.
Filtering by concept type
By default, the /search
endpoint only returns observations (symptoms and risk factors). You can use the optional types
parameter to specify a comma-separated list of medical concept types to be included in the search results. The supported types are condition
, symptom
, and risk_factor
.
For example, to search for both symptoms and conditions, you could use /v3/search?phrase=influ&age.value=30&types=symptom,condition
.
Filtering out professional observations
An optional include_pro
parameter can be used to include or exclude professional observations from the search results. Professional observations refer to symptoms or risk factors that are difficult for individuals without medical training to self-assess accurately as they require specific knowledge or diagnostic tools to identify. These complex observations are not used in patient-facing interviews and they do not have questions assigned to them.
By default, the include_pro
parameter is set to true
, which means professional observations are included in the search results. To exclude these observations and only return concepts suitable for patient self-assessment, the include_pro
parameter can be set to false
.
For example, to exclude professional observations from the search results, use /v3/search?phrase=sign&age.value=30&include_pro=false
.
Response
The response is a JSON list of objects, each containing two attributes:
id
– the ID of the medical concept,label
– the actual value that matched the phrase. This can be a value of either thename
orcommon_name
attributes, or one of their synonyms.
[
{
"id": "s_13",
"label": "belly pain"
},
{
"id": "s_309",
"label": "belly feels full"
},
{
"id": "s_1840",
"label": "belly pain since morning"
},
{
"id": "s_1783",
"label": "moderate belly ache"
},
{
"id": "s_1852",
"label": "belly pain from a few days"
},
{
"id": "s_1782",
"label": "my belly hurts a little"
},
{
"id": "s_1842",
"label": "belly pain from weeks"
},
{
"id": "s_1860",
"label": "belly cramps"
}
]