<?php
/*****************************************************************************
*       DataTables.php
*
*       Author:  ClearHealth Inc. (www.clear-health.com)        2009
*       
*       ClearHealth(TM), HealthCloud(TM), WebVista(TM) and their 
*       respective logos, icons, and terms are registered trademarks 
*       of ClearHealth Inc.
*
*       Though this software is open source you MAY NOT use our 
*       trademarks, graphics, logos and icons without explicit permission. 
*       Derivitive works MUST NOT be primarily identified using our 
*       trademarks, though statements such as "Based on ClearHealth(TM) 
*       Technology" or "incoporating ClearHealth(TM) source code" 
*       are permissible.
*
*       This file is licensed under the GPL V3, you can find
*       a copy of that license by visiting:
*       http://www.fsf.org/licensing/licenses/gpl.html
*       
*****************************************************************************/


class DataTables {

	public static $unitsOfMeasure = array(
		'BG'=>'Bag',
		'BO'=>'Bottle',
		'BX'=>'Box',
		'AV'=>'Capsule',
		'CQ'=>'Cartridge',
		'CH'=>'Container',
		'X4'=>'Drop',
		'GR'=>'Gram',
		'IH'=>'Inhaler',
		'F2'=>'International Unite',
		'KT'=>'Kit',
		'LT'=>'Liter',
		'UU'=>'Lozenge',
		'ME'=>'Milligram',
		'ML'=>'Milliliter',
		'UM'=>'Million Units',
		'ZZ'=>'Mutually Defined',
		'FO'=>'Fluid Ounce',
		'00'=>'Not Specified',
		'PH'=>'Pack',
		'12'=>'Packet',
		'PT'=>'Pint',
		'AR'=>'Suppository',
		'SZ'=>'Syringe',
		'Y2'=>'Tablespoon',
		'U2'=>'Tablet',
		'Y3'=>'Teaspoon',
		'FG'=>'Transdermal Patch',
		'TB'=>'Tube',
		'UN'=>'Unit',
		'VI'=>'Vial',
		'EA'=>'Each',
		'Y7'=>'Gum',
	);

	protected static $dosageForms = array(
		'100'=>'Aerosol',
		'83'=>'Aerosol Powder',
		'160'=>'Aerosol Solution',
		'84'=>'Aerosol Spray',
		'101'=>'Aerosol with adapter',
		'102'=>'Bar',
		'13'=>'Buccal or Sublingual Tablet',
		'20'=>'Capsule',
		'22'=>'Capsule Unspecified',
		'104'=>'Capsule, extended release',
		'103'=>'Capsule, sprinkle',
		'06'=>'Chewable (candy) Bar',
		'14'=>'Chewable Tablet',
		'32'=>'Chewing Gum',
		'01'=>'Combination Forms',
		'105'=>'Concentrate',
		'03'=>'Contraceptive Devices',
		'79'=>'Contraceptive Sponge',
		'106'=>'Cream',
		'107'=>'Cream with applicator',
		'108'=>'Crystal',
		'87'=>'Dental Mouth Rinse',
		'82'=>'Dental Product',
		'04'=>'Devices',
		'07'=>'Dosepak',
		'77'=>'Douche',
		'98'=>'Dressing or Bandage',
		'65'=>'Drops',
		'60'=>'Elixir',
		'64'=>'Emulsion',
		'76'=>'Enema',
		'25'=>'Enteric Coated Capsule',
		'109'=>'Not used',
		'11'=>'Enteric Coated Tablet',
		'81'=>'External Cream',
		'85'=>'External Liquid',
		'80'=>'External Ointment',
		'86'=>'External Powder',
		'161'=>'Extract',
		'89'=>'Not used',
		'111'=>'Film',
		'112'=>'Film, extended release',
		'113'=>'Flakes',
		'114'=>'Foam',
		'115'=>'Foam with applicator',
		'91'=>'Gargle',
		'116'=>'Gel',
		'117'=>'Gel forming solution',
		'118'=>'Gel with applicator',
		'119'=>'Granule for reconstitution',
		'120'=>'Granule, effervescent',
		'121'=>'Granule, extended release',
		'33'=>'Granules',
		'122'=>'Gum',
		'123'=>'Implant',
		'94'=>'Inhalant',
		'88'=>'Inhalant (Refill Canister Only)',
		'43'=>'Injectable Lyophilized Powder',
		'42'=>'Injectable Unspecified',
		'40'=>'Injection',
		'124'=>'Insert',
		'31'=>'Internal Powder',
		'90'=>'Irrigant',
		'125'=>'Kit',
		'126'=>'Leaves',
		'67'=>'Liquid',
		'127'=>'Lollipop',
		'128'=>'Lotion',
		'129'=>'Lozenge',
		'30'=>'Lozenge or Troche',
		'99'=>'Miscellaneous Unspecified',
		'93'=>'Nasal',
		'162'=>'Nebulize Solution',
		'130'=>'Oil',
		'131'=>'Ointment',
		'132'=>'Ointment w/applicator',
		'53'=>'Ophthalmic Liquid (Compliance Cap)',
		'50'=>'Ophthalmic Liquid',
		'52'=>'Ophthalmic or Otic',
		'68'=>'Oral, Liquid, and Sustained Release',
		'95'=>'Otic',
		'133'=>'Pad',
		'134'=>'Paste',
		'05'=>'Patch or Disc',
		'66'=>'Pediatric Liquid',
		'135'=>'Pellet',
		'136'=>'Powder',
		'163'=>'Powder Effervescent',
		'137'=>'Powder for injection',
		'138'=>'Powder for reconstitution',
		'69'=>'Rectal Cream or Ointment',
		'70'=>'Rectal Suppository',
		'139'=>'Ring',
		'140'=>'Shampoo',
		'96'=>'Soap',
		'15'=>'Soluble Tablet',
		'63'=>'Solution',
		'141'=>'Spirit',
		'142'=>'Sponge',
		'143'=>'Spray',
		'97'=>'Stick',
		'164'=>'Strip',
		'144'=>'Suppository(ies)',
		'61'=>'Suspension',
		'145'=>'Not used',
		'146'=>'Suspension, extended release',
		'21'=>'Sustained Release Capsule',
		'41'=>'Sustained Release Injection',
		'12'=>'Sustained Release Tablet',
		'34'=>'Swabs',
		'62'=>'Syrup',
		'10'=>'Tablet',
		'23'=>'Tablet 21 Day Supply',
		'24'=>'Tablet 28 Day Supply',
		'16'=>'Tablet Unspecified',
		'147'=>'Tablet, chewable',
		'148'=>'Tablet, coated particles',
		'149'=>'Tablet, disintegrating',
		'150'=>'Tablet, effervescent',
		'151'=>'Tablet, extended release',
		'152'=>'Tampon',
		'153'=>'Tape',
		'154'=>'Tar',
		'155'=>'Test',
		'02'=>'Test Kits',
		'92'=>'Throat Spray and Swabs',
		'156'=>'Tincture',
		'159'=>'Troche',
		'75'=>'Urethral Suppository',
		'73'=>'Vaginal Cream',
		'74'=>'Vaginal Foam',
		'78'=>'Vaginal Ointment',
		'71'=>'Vaginal Suppository',
		'72'=>'Vaginal Tablet',
		'157'=>'Wafer',
		'158'=>'Wax',
	);

	protected static $chmedToSSDose = array(
		'AEROSOL'=>'100',
		'AEROSOL, FOAM'=>'100',
		'AEROSOL, METERED'=>'162',
		'AEROSOL, POWDER'=>'83',
		'AEROSOL, SPRAY'=>'84',
		'BEAD'=>'99',
		'BEAD, IMPLANT, EXTENDED RELEASE'=>'99',
		'BLOCK'=>'102',
		'CAPSULE'=>'20',
		'CAPSULE, COATED'=>'20',
		'CAPSULE, COATED PELLETS'=>'103',
		'CAPSULE, COATED, EXTENDED RELEASE'=>'104',
		'CAPSULE, DELAYED RELEASE'=>'104',
		'CAPSULE, DELAYED RELEASE PELLETS'=>'104',
		'CAPSULE, EXTENDED RELEASE'=>'104',
		'CAPSULE, GELATIN COATED'=>'20',
		'CAPSULE, LIQUID FILLED'=>'20',
		'CIGARETTE'=>'20',
		'CREAM'=>'106',
		'CRYSTAL'=>'108',
		'DISC'=>'05',
		'ELIXIR'=>'60',
		'EMULSION'=>'64',
		'ENEMA'=>'76',
		'EXTRACT'=>'161',
		'FILM'=>'111',
		'FILM, EXTENDED RELEASE'=>'112',
		'FOR SUSPENSION'=>'99',
		'GAS'=>'99',
		'GEL'=>'116',
		'GEL, DENTIFRICE'=>'116',
		'GLOBULE'=>'99',
		'GRANULE'=>'33',
		'GRANULE, DELAYED RELEASE'=>'121',
		'GRANULE, EFFERVESCENT'=>'120',
		'GRANULE, FOR SOLUTION'=>'119',
		'GRANULE, FOR SUSPENSION'=>'33',
		'GRANULE, FOR SUSPENSION, EXTENDED RELEASE'=>'121',
		'GUM'=>'122',
		'IMPLANT'=>'123',
		'INHALANT'=>'94',
		'INJECTION'=>'40',
		'INJECTION, EMULSION'=>'42',
		'INJECTION, POWDER, FOR SOLUTION'=>'42',
		'INJECTION, POWDER, FOR SUSPENSION'=>'42',
		'INJECTION, POWDER, FOR SUSPENSION, EXTENDED RELEASE'=>'42',
		'INJECTION, POWDER, LYOPHILIZED, FOR LIPOSOMAL SUSPENSION'=>'42',
		'INJECTION, POWDER, LYOPHILIZED, FOR SOLUTION'=>'42',
		'INJECTION, POWDER, LYOPHILIZED, FOR SUSPENSION'=>'42',
		'INJECTION, POWDER, LYOPHILIZED, FOR SUSPENSION, EXTENDED RELEASE'=>'42',
		'INJECTION, SOLUTION'=>'42',
		'INJECTION, SOLUTION, CONCENTRATE'=>'42',
		'INJECTION, SUSPENSION'=>'42',
		'INJECTION, SUSPENSION, EXTENDED RELEASE'=>'42',
		'INJECTION, SUSPENSION, LIPOSOMAL'=>'42',
		'INSERT, EXTENDED RELEASE'=>'123',
		'INTRAUTERINE DEVICE'=>'123',
		'IRRIGANT'=>'99',
		'JELLY'=>'99',
		'KIT'=>'125',
		'LIPSTICK'=>'99',
		'LIQUID'=>'67',
		'LOTION'=>'128',
		'LOZENGE'=>'129',
		'MOUTHWASH'=>'87',
		'NOT APPLICABLE'=>'145',
		'OIL'=>'130',
		'OINTMENT'=>'131',
		'PASTE'=>'134',
		'PASTE, DENTIFRICE'=>'134',
		'PATCH'=>'05',
		'PATCH, EXTENDED RELEASE'=>'05',
		'PATCH, EXTENDED RELEASE, ELECTRICALLY CONTROLLED'=>'05',
		'PELLET'=>'135',
		'POWDER'=>'136',
		'POWDER, DENTIFRICE'=>'136',
		'POWDER, FOR RECONSTITUTION'=>'138',
		'POWDER, FOR SOLUTION'=>'138',
		'POWDER, FOR SUSPENSION'=>'138',
		'RINSE'=>'87',
		'SHAMPOO'=>'140',
		'SOAP'=>'96',
		'SOLUTION'=>'63',
		'SOLUTION, CONCENTRATE'=>'63',
		'SOLUTION, FOR SLUSH'=>'63',
		'SPRAY'=>'143',
		'SPRAY, METERED'=>'143',
		'SPRAY, METERED PUMP'=>'143',
		'SPRAY, SUSPENSION'=>'143',
		'STICK'=>'97',
		'STRIP'=>'164',
		'SUPPOSITORY'=>'144',
		'SUSPENSION'=>'61',
		'SUSPENSION, EXTENDED RELEASE'=>'146',
		'SWAB'=>'34',
		'SYRUP'=>'62',
		'TABLET'=>'10',
		'TABLET, CHEWABLE'=>'147',
		'TABLET, COATED'=>'148',
		'TABLET, DELAYED RELEASE'=>'16',
		'TABLET, DELAYED RELEASE PARTICLES'=>'16',
		'TABLET, EFFERVESCENT'=>'150',
		'TABLET, EXTENDED RELEASE'=>'151',
		'TABLET, FILM COATED'=>'16',
		'TABLET, FILM COATED, EXTENDED RELEASE'=>'151',
		'TABLET, MULTILAYER'=>'16',
		'TABLET, MULTILAYER, EXTENDED RELEASE'=>'16',
		'TABLET, ORALLY DISINTEGRATING'=>'149',
		'TABLET, SOLUBLE'=>'149',
		'TABLET, SUGAR COATED'=>'16',
		'TAPE'=>'153',
		'TINCTURE'=>'156',
		'TROCHE'=>'159',
		'UNASSIGNED'=>'145',
		'WAFER'=>'157',
	);

	public static function getDosageForm($dose) {
		$ret = '109'; // Not used
		if (isset(self::$chmedToSSDose[$dose])) {
			$ret = self::$chmedToSSDose[$dose];
		}
		return $ret;
	}

}
