Search the International Classification of Diseases table for classifying diagnoses for use in health care
npm install react-icd10> Search the International Classification of Diseases table
ICD-10-CM (International Classification of Diseases, 10th Revision, Clinical Modification) is a medical coding system for classifying diagnoses and reasons for visits in U.S. health care settings (source)

``bashNPM
npm install --save react-icd10
You will need to have a react version that supports react hooks (v16.6+) to use this library, or you will receive errors.
Usage
To use the component version, import directly from
react-icd10. The default export is a render prop component that exposes the necessary states to use on your interface, along with a few handy utilities:`jsx
import React from 'react'
import ReactICD10 from 'react-icd10'const App = () => (
render={({
onSearch,
fetching,
fetched,
fetchError,
data,
reset,
}) => (
onChange={(e) => onSearch(e.target.value)}
type='text'
placeholder='Search diagnosis'
/>
)}
/>
)export default App
`You can limit the results returned by passing in a
limit prop to the render component. For example, passing in a limit of 100 will return a maximum of 100 results:`js
const App = () => (
limit={100}
render={({
onSearch,
fetching,
fetched,
fetchError,
data,
reset,
}) => (
onChange={(e) => onSearch(e.target.value)}
type='text'
placeholder='Search diagnosis'
/>
)}
/>
)
`If you need an additional constraint to return results that must include a second keyword somewhere in each result, you can pass in
include and your keyword to it:`js
const App = () => (
include="medicine" // Will also take an array of strings
render={({
onSearch,
fetching,
fetched,
fetchError,
data,
reset,
}) => (
onChange={(e) => onSearch(e.target.value)}
type='text'
placeholder='Search diagnosis'
/>
)}
/>
)
`You can either use the render prop component version that is exported as default, but you can optionally use the react hook version instead which is basically the same flow:
`js
import React from 'react'
import { useICD10 } from 'react-icd10'const App = () => {
const { onSearch, ...rest } = useICD10({ limit: 7 })
const onChange = (e) => {
onSearch(e.target.value)
}
return (
{JSON.stringify(rest, null, 2)}
onChange={onChange}
type='text'
placeholder='Search diagnosis'
/>
)
}export default App
`$3
####
onSearch: (keyword: string) => PromiseonSearch will use your keyword to query for diagnoses. After the call has finished, data will be provided as arguments to the render prop. The data is an object that with this shape:`ts
interface Data {
codes: string[]
results: { [code: string]: ICD10Object, ...others }
total: number
}interface ICD10Object {
code?: string
description?: string
comment?: string
}
`For those who would like to see it from a visual perspective:
!react-icd10 international classification of diseases library
If an error occurred while fetching for the results,
fetchError will be returned as an Error object as part of the render props.onSearch is also optimized internally to avoid duplicate requests, so you can assure that users who are constantly typing for results won't be making mass amounts of requests in between.####
reset: () => voidIf you need to reset your results back to an empty state, you can call
reset`, provided from render props as well.- axios
MIT © pfftdammitchris