Hi, I'm trying to build a searchable database of diagnosis codes and I'm finding out that making intelligent searches is not as easy as I though it would be.
I have a database of about 15000+ entries. These are the fields:
CodeID
DxName
DxExcludes
Essentially, I only need to be able to search the DxName field, which can be very long, depending on how many diagnoses use the same code.
I want the search engine to be able to find partial word matches (i.e. TYMPANIC and tuboTYPMANIC) and close matches (e.g. RUPTURE even if you typed in RUPTURED or PERFORATED even if you typed in PERFORATION). I also need it to be able to find things even they are not next to each other (i.e. a search for "serosanguinous externa" should find "serosanginous otitis externa").
I need to be able to score these in a way that the most likely diagnosis will be at the top. This is important because typing in common things like "otitis" will yield a relatively large number of results. If I need to use any kind of OR statement, the number of results becomes huge. One way I will tackle this problem is to add a field which I can use to flag common diagnoses, since there will only be a few hundred. That way, I can sort by that column first.
Here is a sample of the data (a SELECT query on like "tympanic"):
| code | dxname | dxexclude |
| 384 |Other disorders of tympanic membrane||
| 384.8 |Other specified disorders of tympanic membrane||
| 384.20 |Perforation of tympanic membrane, unspecified||
| 384.21 |Central perforation of tympanic membrane||
| 384.23 |Other marginal perforation of tympanic membrane||
| 384.24 |Multiple perforations of tympanic membrane||
| 384.25 |Total perforation of tympanic membrane||
| 385.01 |Tympanosclerosis involving tympanic membrane only||
| 384.9 |Unspecified disorder of tympanic membrane||
| 384.82 |Atrophic nonflaccid tympanic membrane||
| 385.02 |Tympanosclerosis involving tympanic membrane and ear ossicles||
| 389.02 |Conductive hearing loss, tympanic membrane||
| 384.22 |Attic perforation of tympanic membrane! Pars flaccida||
| 385.03 |Tympanosclerosis involving tympanic membrane, ear ossicles, and middle ear||
| 384.81 |Atrophic flaccid tympanic membrane! Healed perforation of ear drum||
| 384.2 |Perforation of tympanic membrane! Perforation of ear drum:! NOS! persistent posttraumatic! postinflammatory|Excludes: otitis media with perforation of tympanic membrane (382.00-382.9)! traumatic perforation [current injury] (872.61)|| code | dxname | dxexclude |
| 384 |Other disorders of tympanic membrane||
| 384.8 |Other specified disorders of tympanic membrane||
| 384.20 |Perforation of tympanic membrane, unspecified||
| 384.21 |Central perforation of tympanic membrane||
| 384.23 |Other marginal perforation of tympanic membrane||
| 384.24 |Multiple perforations of tympanic membrane||
| 384.25 |Total perforation of tympanic membrane||
| 385.01 |Tympanosclerosis involving tympanic membrane only||
| 384.9 |Unspecified disorder of tympanic membrane||
| 384.82 |Atrophic nonflaccid tympanic membrane||
| 385.02 |Tympanosclerosis involving tympanic membrane and ear ossicles||
| 389.02 |Conductive hearing loss, tympanic membrane||
| 384.22 |Attic perforation of tympanic membrane! Pars flaccida||
| 385.03 |Tympanosclerosis involving tympanic membrane, ear ossicles, and middle ear||
| 384.81 |Atrophic flaccid tympanic membrane! Healed perforation of ear drum||
| 384.2 |Perforation of tympanic membrane! Perforation of ear drum:! NOS! persistent posttraumatic! postinflammatory|Excludes: otitis media with perforation of tympanic membrane (382.00-382.9)! traumatic perforation [current injury] (872.61)|
Any guidance and hand holding is greatly appreciated!
Regards,
Bhavesh Patel