I just uploaded this (if any one is interested). It will help with keying errors and does allow the user to skip the city and state fields. Thanks to Sam Likins for the Ajax schooling.
Thanks
Terry
PS I am working on some more stuff (like a guarantor)
Old PMS had same concept. Input: 95814. Bam! Output: Sacramento, CA. Some municipalities share the same zip code, so there would be a drop down for the user to choose.
Rebased most recent code and reviewed it here(also tested it here):
(search for bradymiller to see comments)
This is really nice code for this purpose, but I am at a bit of a loss how to get it into OpenEMR codebase in a friendly fashion. I placed some thoughts on the review; hopefully others can also chime in.
I made those changes and removed the documentation ( i will get a more professional version posted soon) I think I want to add country code to the population of the data.
We had similar requirements from users. Although we chose to leverage Select2, some features that can be homegrown as well are:
Create common generic library so you can provide suggestions for any text box with minimal code.
Let mysql query provide values rather than creating lists. This means first few entries will have fewer options but it allows list to be ordered by COUNT rather than description.
Pre-populate TOP n values until first 2-3 characters are entered and then switch to dynamic look ups.
Not far off. I have all the us zips in text files that will take very little effort to place them in a database. then the code will need to hit that database when the zip is entered.
Our code is geared for Select2. So a simplified/generic version of db interface is attached as select2_lookup.php. This gets called from select2_call_sample code fragment script. In production, the ajaxcombo is also a library function. As a result we can convert text box to combo box with a single line.
Could you consider using existing data to derive valid/most likely values? This can be done by simple json lookups and javascript. A suggestion would be:
When any address field is updated, a json call returns city+state+zip array ordered by COUNT DESC. Script then converts other textboxes to combo by adding datalist in HTML5 or standard HTML4 trick.
Granted first few entries will be unguided but it eliminates need for any lists/tables. Same approach can be reused for addresses in user and insurance tables.
On a related note, in your current code is there any reason why anyone would want to turn off this helpful functionality?
Assumption here is that data is being entered from verbal source (e.g. over phone) or written form (email, registration info etc.). If ‘Seal Beach’ zip is incorrectly entered as 91740, later documents will be entered as 90740 and have higher count - so 90740 will rise to the top of list.
USPS/FedEx/UPS are good at taking care of minor errors. Users, specifically MDs, just want some magic to speed up data entry - not just in addresses but all fields with recurring data.
I agree the best way is to allow the data to be stored and retrieved from one place. The best situation is to allow patient postal codes to stored and retrieved from the patient data file , insurance from insurance etc. I haven’t had a chance to look at the code and information that you sent but it sounds to me like you already do most of this. Sam was a big help in getting what I have here he gave me a lot of help with the comet… I mean Ajax stuff. Thanks again Sam.