Code Types

From OpenEMR Project Wiki

Overview

Code types include billing, diagnosis, performance and other miscellaneous code sets (such as immunizations). By default, OpenEMR is set up to use ICD9 for diagnosis and CPT4/HCPCS for billing. OpenEMR can also support ICD10/SNOMED/DSMIV code types along with any other code types (guessing each country has their own flavor of these) and importing of these alternative code sets.

Import Code Sets

Code sets can be imported in several ways, depending on the code type. See the Import Standard Tables wiki page for detailed/updated import instructions.


CPT4

CPT4 is for billing codes (Mainly US based countries).

In the Demo version it is used to connect the New patients with brief etc, till comprehensive and Established patients brief, etc, till comprehensive and are connected to a Fee.
  • If the complete CPT4 List is incorporated in the different tables it can also be used in other parts of OpenEMR to create a claim. (In the Demo version the Fee amount is defined as 0 and are not defined in Codes)
  • After population of the CPT4 codes 99201 till 99210, (this can be done manually if you know the code and description in Administration => Services) these codes can be found in the Search options in Fee-sheet. To accomplish this:
Administration => Other => Codes (V.4.1.2)
Administration => Other => Services (V.4.1.1 and earlier) and can be viewed in the Codes table, this is also true for: New Local Installs.

Via .plx Import

Read through the following script here: openemr/contrib/util/load_cpt_desc.plx

  • This is a rather complicated script/method. See the following wiki page for how to configure it (note the wiki page discusses another script load_icd_desc.plx, so ensure you substitute/use the load_cpt_desc.plx script instead): OpenEMR_Billing_Setup_Howtos#Load_and_Update_Billing_Codes
  • To populate the Fee tables with CSV-files you need to be aware that CPT4 codes and Fee's are stored in separate tables, one for Defining the Code and one for the Fee to be paid for a certain procedure.

Via .sql Import

  • A second way to import CPT codes utilizes a .sql file, which is constructed in a spreadsheet and elements are strung together, otherwise known as Concatenation. An analogy would be the crafting of a bead necklace. The .sql file is the necklace, the beads are the entries in each of the cells (the boxes of the Columns and Rows) while the "strand" holding the beads together is the Concatenation function.
  • Because the CPT data set is not in .sql format, it cannot be directly imported into the OpenEMR database. Consequently it must be converted before this can occur.
  • If only a handful of CPT codes are required for a practice, it may be easier to enter them manually in Administration/Codes. The following method is designed for batch importation.
  • Purchase and download the CPT data set from the AMA Store. The data file is probably in ASCII .txt format. This is only an assumption, never having actually worked with it. The CPT codes used as illustration are derived from our office.
  • Download and deploy OpenOffice Calc. This application is not the simplest to use. It is open source and hence its major advantage. The Help section is not very enlightening. OpenOffice Calc online tutorials and other online resources are far more helpful. Any spreadsheet with functions enabled can be used in lieu of OpenOffice Calc.
  • Before commencement of the file construction, be certain that in Tools/Options/ OpenOffice Calc/View/Display that the Formula box is unchecked. If it is checked, the text in the Input Line will remain text without stringing the entries in the cells together and no function will occur.


Cpt1.PNG


  • Paste this text into C1, leaving no space after the second left parenthesis:
INSERT INTO `codes` (`code_text`, `code`, `code_type`) VALUES(

Cpt2.PNG

  • Copy and paste the descriptions into Column A, starting with A2.

Cpt3a.PNG


  • Copy and paste the codes into Column B, starting with B2.

Cpt4a.PNG


  • Click C2 and fx, Function Wizard. Working only in the Input Line may not bring about Concatenation.

Cpt5a.PNG


  • In the Formula box paste:
$C$1& "'"& A2& "'"& ",'"& B2& "'"& ","& "1"& ");"
  • Allow no space after the last quotation mark, then hit Enter. It is not necessary to use the word, Concatenate, with the above syntax. It is always a good sign when there is no error message in the Result box.

Cpt6.PNG



  • Output should look like this:
INSERT INTO `codes` (`code_text`, `code`, `code_type`) VALUES('Comprehensive Exam, New ','92004',1);

Cpt7a.PNG


  • Drag the lower right corner of C2 down to the last row and the rest of Column C will have the corresponding output as in C2.

Cpt8a.PNG


  • Giving this result:

Cpt9a.PNG


  • Copy and paste from C2 downward into Notepad++. This newly minted .sql file is now ready for import. Backup prior to importation is always wise.


  • Import via phpMyAdmin. Browse the .sql file and click Go. If the file is too large, either compress it or divide up the file for multiple importations.

Cpt.10a.png


  • Check in Database/codes and Admininstration/Codes to ensure that the process was correctly executed.

Cpt12a.PNG


  • This technique can be used also for the CPT modifiers, which should be included in the data set.
  • Once the codes have been written in the External Database Import Utility for CPT codes, this particular import will be a snap. A major obstacle to this becoming a reality lies in the fact that data set is proprietary, unlike that for the other databases. As a result importation of CPT codes cannot be seamless. This less elegant method will have to suffice for now.


HCPCS

The following will import the 2013 data set.

  • Backup your data before import.
  • Go to Administration/Other/Database/codes/Import/Browse, choose downloaded zip file, uncheck Partial Import and click Go.

Hcpcsimport.PNG

  • Go to Administration/Services or Administration/Codes to verify presence of HCPCS codes.


ICD9

  • Follow instructions at Administration->Other->External Data Loads->ICD9
  • For a new install of code set, basically just need to click 'INSTALL'.
  • For upgrade of code set, follow the instructions offered there.

ICD10

  • Follow instructions at Administration->Other->External Data Loads->ICD10
  • For a new install of code set, basically just need to click 'INSTALL'.
  • For upgrade of code set, follow the instructions offered there.

ICPC

(Copy right instructions can be found here: ICPC WONCA)

  • Follow instructions. Goto: Administration->Other-> Database-> select table-> Import CSV-file with correct information.
  • For a new install of code set be sure to follow all instructions as mentioned and not ruin the relations for different Codes in Code Types.
  • For upgrade of code set, follow the instructions to be made available in due time.
  • Changing Code-ID or Key in upgrades will ruin the history of coded patient information, be sure to add new codes at end of each table.


SNOMED

  • Follow instructions at Administration->Other->External Data Loads->SNOMED


Configure/Add Code Types

  • A code type can be configured or added at Administration->Lists->'Code Types' . Below is a description of each element in the Code Types Editor and note this is only applicable for OpenEMR versions 4.1.1 and above.
  • Active - Toggle to turn on/off the code type.
  • Key - Name of key used to identify code type within database. This should not be altered and needs to be unique.
  • ID - ID used to identify code type. This should not be altered and needs to be unique.
  • Label - Label of the code type (ok to alter this)
  • Seq - Order of the code type when showing the listing.
  • ModLength - Maximum length to use for modifiers (0 means there is no modifier used for the code type, 12 is max length used for Modifiers) Modifiers are two character codes to specify procedures done. Example: Left side => LT, Right side => RT. More information on Medicare Modifiers consult the MediCare manuals, any logic in these codes seem to be missing. Some extra info can be found in Forums of OpenEMR: [1] Modifiers are Codes separated by Space or Colon as specified by Medicaid for modifiers. (Please feel free to add comments more specific)
  • Justify - If justification is used, enter the name of the diagnostic code type and enter the Key of the code type that is used to justify this code type (blank means no justification) Once Justify is included and the code for this is included in Fee sheet (shows in blue) you can make the choice to include the Justification code as Issue (J) or include as Diagnosis (P) or both. Both are included in => Patient summary and can be traced by double click on the red-line.
  • Mask - Input formatting for consistency in Code. (# = Numeric, @ = Alpha, * = any character. Literal like " - " for dash, and others for literal consistency. Empty if not used)
  • Claims - Toggle to turn on/off whether the code type is used in insurance claims.
  • Fees - Toggle to turn on/off whether the code type is associated with fees.
  • Relations - Used to link the Code to another Code type.
  • Hide - Toggle to turn on/off whether the code type shown in the Fee Sheet searching option.
  • Procedure - Toggle to turn on/off whether the code type represents procedure/service codes.
  • Diagnosis - Toggle to turn on/off whether the code type represents diagnosis codes.
  • Clinical Term - Toggle to turn on/off whether the code type represents a clinical term. Can assign these to the Administration->Lists elements(codes entry). (OpenEMR 4.1.2)
  • Medical Problem - Toggle to turn on/off if the code type represents medical problems (ie. Issues). (OpenEMR 4.1.2)
  • External - Menu to choose where the code set of the code type is stored. When the code set is stored in an External table, this allows users to upgrade their reference code sets without losing their code set modifications (for example, fees or other flags set to specific codes).
  • No - The code set is stored in the 'codes' sql table.
  • ICD9 Diagnosis - The code set is stored in the standard ICD9 diagnosis tables.
  • ICD9 Procedure/Service - The code set is stored in the standard ICD9 procedure/service tables.
  • ICD10 Diagnosis - The code set is stored in the standard ICD10 diagnosis tables.
  • ICD10 Procedure/Service - The code set is stored in the standard ICD10 procedure/service tables.
  • SNOMED (RF1) Diagnosis - The code set is stored in the standard SNOMED diagnosis tables.
  • SNOMED (RF1) Clinical Term - The code set is stored in the standard SNOMED diagnosis tables. (OpenEMR 4.1.2)
  • SNOMED (RF1) Procedure - The code set is stored in the standard SNOMED diagnosis tables. (OpenEMR 4.1.2)
  • If you want to add a new External code set mechanism, can add it in the custom/code_types.inc.php script
  • OpenEMR 4.1.2
  • Incorporate it into the $code_external_tables metadata.
  • OpenEMR 4.1.1
  • Add it to the $cd_external_options array.
  • Incorporate it into the code_set_search() and lookup_code_descriptions() functions.
  • If you are adding a code type, recommend using the same ct_key and ct_id values as in below table. If creating a new code type, then recommend making sure the ct_id is greater than 100. If you think the code type has general use, then please request to have it added to the official OpenEMR codebase.
  • After making a new code type, the code set can either be stored in the 'codes' table by making External setting 'No' or you can create your own sql tables to store it, which can be added as an option to the External setting (see above).

Current Official Code Types

ct_key ct_id description
CPT4 1 Procedure/Service Codes
ICD9 2 Diagnosis Codes
HCPCS 3 Procedure/Service Codes
OPCS 6 Sports Medicine Procedure Codes
PTCJ 7 Sports Medicine Physiotherapy Codes
OSICS10 9 Sports Medicine Diagnosis Codes
SMPC 10 Sports Medicine Radiology Codes
IPPF 11 Family Planning Statistical Codes
MA 12 Family Planning Service Codes
ACCT 13 Family Planning Accounting Codes
REF 16 Family Planning Referral Codes
CVX 100 Immunization Codes
DSMIV 101 Diagnostic and Statistical Manual of Mental Disorders, 4th edition
ICD10 102 The International Statistical Classification of Diseases and Related Health Problems, 10th Revision
SNOMED 103 Systematized Nomenclature of Medicine - Diagnosis Codes
CPTII 104 Performance Measure Codes
ICD9-SG 105 Procedure/Service Codes
ICD10-PCS 106 Procedure/Service Codes
SNOMED-CT 107 Systematized Nomenclature of Medicine - Clinical Terms
SNOMED-PR 108 Systematized Nomenclature of Medicine - Procedure Codes
ICPC-TI 110 International Coding system for General Practitioners/Family doctors (Chapters/Titles)
ICPC-SX 111 International Coding system for General Practitioners/Family doctors (Symptoms and Complaints)
ICPC-DI 112 International Coding system for General Practitioners/Family doctors (Diagnostic, Screening, Prevention)
ICPC-TR 113 International Coding system for General Practitioners/Family doctors (Treatment, Procedures, Medicaton)
ICPC-TE 114 International Coding system for General Practitioners/Family doctors (Test Results)
ICPC-AD 115 International Coding system for General Practitioners/Family doctors (Administrative)
ICPC-OT 116 International Coding system for General Practitioners/Family doctors (Other)
ICPC-DD 117 International Coding system for General Practitioners/Family doctors (Diagnosis and Diseases)
LOCAL-F 118 Local Fees for Services rendered (Fees for Service)

LEGEND:

RED - Mandatory setting for this code type
Italic - Optional setting for this code type (ie. the ct_id can be anything greater than or equal to 100 for this code type)
BLUE - ICPC-coding is in testing phase and will take more time before flowless total implementation is available. (Date: 20130715)
  • Note the ct_key and ct_id are columns from the sql 'code_types' table and that the ct_id column is equal to the code_type column of entries in the sql 'codes' table.

Code Type Issues (For Developers)

Two elements in the code_types table are considered to be invariant. The ct_key element which holds a text identifier and the ct_id element which holds an id identifier. Changes either of these for ICD9, CPT4, or HCPCS caused problems in prior OpeneMR versions. To support allowance of incorporating new code sets in OpenEMR version 4.1.0+, it was important to modify the OpenEMR codebase and future code in a way that only the ct_key is invariant (ie. the ct_id does not need to be a pre-determined number). An example of this is the CVX code type that was added in OpenEMR version 4.1 and the SNOMED, DSMIV and ICD10 code sets that were added in OpenEMR version 4.1.1 . When adding new codesets during an upgrade, we are using a ct_id above 100 (in a flexible manner; ie. if already exists then increment and try the next and so on) to ensure we don't affect any current users that have added their own code types.