R/PROCEDURE.R

Defines functions procedure_lvl_2 procedure_lvl_1

Documented in procedure_lvl_1 procedure_lvl_2

#' Procedures Performed
#' Record both operative and non-operative procedures performed in your facility
#'
#' @param col A column in PTOS data that typically ends in _PR.
#'
#' @return It translations of the code into human friendly values.
#' @export
procedure_lvl_1 <- function(col) {
  col_value <-  case.(col >= 0.01 & col  < 1, 'PROCEDURES AND INTERVENTIONS , NOT ELSEWHERE CLASSIFIED (00)',
                      col >= 1 & col  < 6, 'OPERATIONS ON THE NERVOUS SYSTEM (01-05)',
                      col >= 6 & col  < 8, 'OPERATIONS ON THE ENDOCRINE SYSTEM (06-07)',
                      col >= 8 & col  < 17, 'OPERATIONS ON THE EYE (08-16)',
                      col >= 17 & col  < 18, 'OTHER MISCELLANEOUS DIAGNOSTIC AND THERAPEUTIC PROCEDURES (17)',
                      col >= 18 & col  < 21, 'OPERATIONS ON THE EAR (18-20)',
                      col >= 21 & col  < 30, 'OPERATIONS ON THE NOSE, MOUTH, AND PHARYNX (21-29)',
                      col >= 30 & col  < 35, 'OPERATIONS ON THE RESPIRATORY SYSTEM (30-34)',
                      col >= 35 & col  < 40, 'OPERATIONS ON THE CARDIOVASCULAR SYSTEM (35-39)',
                      col >= 40 & col  < 42, 'OPERATIONS ON THE HEMIC AND LYMPHATIC SYSTEM (40-41)',
                      col >= 42 & col  < 55, 'OPERATIONS ON THE DIGESTIVE SYSTEM (42-54)',
                      col >= 55 & col  < 60, 'OPERATIONS ON THE URINARY SYSTEM (55-59)',
                      col >= 60 & col  < 65, 'OPERATIONS ON THE MALE GENITAL ORGANS (60-64)',
                      col >= 65 & col  < 72, 'OPERATIONS ON THE FEMALE GENITAL ORGANS (65-71)',
                      col >= 72 & col  < 76, 'OBSTETRICAL PROCEDURES (72-75)',
                      col >= 76 & col  < 85, 'OPERATIONS ON THE MUSCULOSKELETAL SYSTEM (76-84)',
                      col >= 85 & col  < 87, 'OPERATIONS ON THE INTEGUMENTARY SYSTEM (85-86)',
                      col >= 87 & col  <= 99.99, 'MISCELLANEOUS DIAGNOSTIC AND THERAPEUTIC PROCEDURES (87-99)',

                      default =   'Not Documented' )
  return(col_value)
}

#' @rdname procedure_lvl_1
#' @export
procedure_lvl_2 <- function(col) {
  col_value <-  case.(col >= 0.01 & col  < 0.1, 'Therapeutic ultrasound',
                      col >= 0.1 & col  < 0.21, 'Pharamaceuticals',
                      col >= 0.21 & col  < 0.31, 'Intravascular imaging of blood vessels',
                      col >= 0.31 & col  < 0.4, 'Computer assisted surgery [CAS]',
                      col >= 0.4 & col  < 0.5, 'Adjunct Vascular System Procedures',
                      col >= 0.5 & col  < 0.6, 'Other cardiovascular procedures',
                      col >= 0.6 & col  < 0.7, 'Procedures on blood vessels',
                      col >= 0.7 & col  < 0.8, 'Other hip procedures',
                      col >= 0.8 & col  < 0.91, 'Other knee and hip procedures',
                      col >= 0.91 & col  < 1.01, 'Other procedures and interventions',
                      col >= 1.01 & col  < 2.01, 'Incision and excision of skull, brain, and cerebral meninges',
                      col >= 2.01 & col  < 3.01, 'Other operations on skull, brain, and cerebral meninges',
                      col >= 3.01 & col  < 4.01, 'Operations on spinal cord and spinal canal structures',
                      col >= 4.01 & col  < 5, 'Operations on cranial and peripheral nerves',
                      col >= 5 & col  < 6.01, 'Operations on sympathetic nerves or ganglia',
                      col >= 6.01 & col  < 7, 'Operations on thyroid and parathyroid glands',
                      col >= 7 & col  < 8.01, 'Operations on other endocrine glands',
                      col >= 8.01 & col  < 9, 'Operations on eyelids',
                      col >= 9 & col  < 10, 'Operations on lacrimal system',
                      col >= 10 & col  < 11, 'Operations on conjunctiva',
                      col >= 11 & col  < 12, 'Operations on cornea',
                      col >= 12 & col  < 13, 'Operations on iris, ciliary body, sclera, and anterior chamber',
                      col >= 13 & col  < 14, 'Operations on lens',
                      col >= 14 & col  < 15.01, 'Operations on retina, choroid, vitreous, and posterior chamber',
                      col >= 15.01 & col  < 16.01, 'Operations on extraocular muscles',
                      col >= 16.01 & col  < 17.11, 'Operations on orbit and eyeball',
                      col >= 17.11 & col  < 18.01, 'Other miscellaneous procedures',
                      col >= 18.01 & col  < 19, 'Operations on external ear',
                      col >= 19 & col  < 20.01, 'Reconstructive operations on middle ear',
                      col >= 20.01 & col  < 21, 'Other operations on middle and inner ear',
                      col >= 21 & col  < 22, 'Operations on nose',
                      col >= 22 & col  < 23.01, 'Operations on nasal sinuses',
                      col >= 23.01 & col  < 24, 'Removal and restoration of teeth',
                      col >= 24 & col  < 25.01, 'Other operations on teeth, gums, and alveoli',
                      col >= 25.01 & col  < 26, 'Operations on tongue',
                      col >= 26 & col  < 27, 'Operations on salivary glands and ducts',
                      col >= 27 & col  < 28, 'Other operations on mouth and face',
                      col >= 28 & col  < 29, 'Operations on tonsils and adenoids',
                      col >= 29 & col  < 30.01, 'Operations on pharynx',
                      col >= 30.01 & col  < 31, 'Excision of larynx',
                      col >= 31 & col  < 32.01, 'Other operations on larynx and trachea',
                      col >= 32.01 & col  < 33, 'Excision of lung and bronchus',
                      col >= 33 & col  < 34.01, 'Other operations on lung and bronchus',
                      col >= 34.01 & col  < 35, 'Operations on chest wall, pleura, mediastinum, and diaphragm',
                      col >= 35 & col  < 36.03, 'Operations on valves and septa of heart',
                      col >= 36.03 & col  < 37, 'Operations on vessels of heart',
                      col >= 37 & col  < 38, 'Other operations on heart and pericardium',
                      col >= 38 & col  < 39, 'Incision, excision, and occlusion of vessels',
                      col >= 39 & col  < 40, 'Other operations on vessels',
                      col >= 40 & col  < 41, 'Operations on lymphatic system',
                      col >= 41 & col  < 42.01, 'Operations on bone marrow and spleen',
                      col >= 42.01 & col  < 43, 'Operations on esophagus',
                      col >= 43 & col  < 44, 'Incision and excision of stomach',
                      col >= 44 & col  < 45, 'Other operations on stomach',
                      col >= 45 & col  < 46.01, 'Incision, excision, and anastomosis of intestine',
                      col >= 46.01 & col  < 47.01, 'Other operations on intestine',
                      col >= 47.01 & col  < 48, 'Operations on appendix',
                      col >= 48 & col  < 49.01, 'Operations on rectum, rectosigmoid and perirectal tissue',
                      col >= 49.01 & col  < 50, 'Operations on anus',
                      col >= 50 & col  < 51.01, 'Operations on liver',
                      col >= 51.01 & col  < 52.01, 'Operations on gallbladder and biliary tract',
                      col >= 52.01 & col  < 53, 'Operations on pancreas',
                      col >= 53 & col  < 54, 'Repair of hernia',
                      col >= 54 & col  < 55.01, 'Other operations on abdominal region',
                      col >= 55.01 & col  < 56, 'Operations on kidney',
                      col >= 56 & col  < 57, 'Operations on ureter',
                      col >= 57 & col  < 58, 'Operations on urinary bladder',
                      col >= 58 & col  < 59, 'Operations on urethra',
                      col >= 59 & col  < 60, 'Other operations on urinary tract',
                      col >= 60 & col  < 61, 'Operations on prostate and seminal vesicles',
                      col >= 61 & col  < 62, 'Operations on scrotum and tunica vaginalis',
                      col >= 62 & col  < 63.01, 'Operations on testes',
                      col >= 63.01 & col  < 64, 'Operations on spermatic cord, epididymis, and vas deferens',
                      col >= 64 & col  < 65.01, 'Operations on penis',
                      col >= 65.01 & col  < 66.01, 'Operations on ovary',
                      col >= 66.01 & col  < 67, 'Operations on fallopian tubes',
                      col >= 67 & col  < 68, 'Operations on cervix',
                      col >= 68 & col  < 69.01, 'Other incision and excision of uterus',
                      col >= 69.01 & col  < 70, 'Other operations on uterus and supporting structures',
                      col >= 70 & col  < 71.01, 'Operations on vagina and cul-de-sac',
                      col >= 71.01 & col  < 72, 'Operations on vulva and perineum',
                      col >= 72 & col  < 73.01, 'Forceps, vacuum, and breech delivery',
                      col >= 73.01 & col  < 74, 'Other procedures inducing or assisting delivery',
                      col >= 74 & col  < 75, 'Cesarean section and removal of fetus',
                      col >= 75 & col  < 76.01, 'Other obstetric operations',
                      col >= 76.01 & col  < 77, 'Operations on facial bones and joints',
                      col >= 77 & col  < 78, 'Incision, excision, and division of other bones',
                      col >= 78 & col  < 79, 'Other operations on bones, except facial bones',
                      col >= 79 & col  < 80, 'Reduction of fracture and dislocation',
                      col >= 80 & col  < 81, 'Incision and excision of joint structures',
                      col >= 81 & col  < 82.01, 'Repair and plastic operations on joint structures',
                      col >= 82.01 & col  < 83.01, 'Operations on muscle, tendon, and fascia of hand',
                      col >= 83.01 & col  < 84, 'Operations on muscle, tendon, fascia, and bursa, except hand',
                      col >= 84 & col  < 85, 'Other procedures on musculoskeletal system',
                      col >= 85 & col  < 86.01, 'Operations on the breast',
                      col >= 86.01 & col  < 87.01, 'Operations on skin and subcutaneous tissue',
                      col >= 87.01 & col  < 88.01, 'Diagnostic Radiology',
                      col >= 88.01 & col  < 89.01, 'Other diagnostic radiology and related techniques',
                      col >= 89.01 & col  < 90.01, 'Interview, evaluation, consultation, and examination',
                      col >= 90.01 & col  < 91.01, 'Microscopic examination-I',
                      col >= 91.01 & col  < 92.01, 'Microscopic examination-II',
                      col >= 92.01 & col  < 93.01, 'Nuclear medicine',
                      col >= 93.01 & col  < 94.01, 'Physical therapy, respiratory therapy, rehabilitation, and related procedures',
                      col >= 94.01 & col  < 95.01, 'Procedures related to the psyche',
                      col >= 95.01 & col  < 96.01, 'Ophthalmologic and otologic diagnosis and treatment',
                      col >= 96.01 & col  < 97.01, 'Nonoperative intubation and irrigation',
                      col >= 97.01 & col  < 98.01, 'Replacement and removal of therapeutic appliances',
                      col >= 98.01 & col  < 99, 'Nonoperative removal of foreign body or calculus',
                      col >= 99 & col  <= 99.99, 'Other nonoperative procedures',
                      default =   'Not Documented' )
  return(col_value)
}

#' @export
#' @rdname procedure_lvl_2
mjkarlsen/traumaR documentation built on June 10, 2020, 2:45 p.m.