PageRenderTime 54ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/client-web-api/php/lib/trisano-web-api-cmr.php

https://github.com/jonjensen/trisano
PHP | 568 lines | 561 code | 7 blank | 0 comment | 4 complexity | 5abe08a53ea8008e19bd7b9a01c1447b MD5 | raw file
Possible License(s): AGPL-3.0, LGPL-2.1, MPL-2.0-no-copyleft-exception, MIT
  1. <?php
  2. require_once('../lib/trisano-web-api.php');
  3. require_once('Console/Getopt.php');
  4. class TrisanoWebApiCmr extends TrisanoWebApi {
  5. private $options = array();
  6. function parse_args($args, $options = array()) {
  7. $longopts = array(
  8. "help",
  9. "first_name==",
  10. "middle_name==",
  11. "last_name==",
  12. "parent_guardian==",
  13. "birth_date==",
  14. "approx_age_no_birthday==",
  15. "birth_gender==",
  16. "ethnicity==",
  17. "race==",
  18. "primary_language==",
  19. "address_street_number==",
  20. "address_street_name==",
  21. "address_unit_number==",
  22. "address_city==",
  23. "address_state==",
  24. "address_county==",
  25. "address_postal_code==",
  26. "telephone_location_type==",
  27. "telephone_area_code==",
  28. "telephone_number==",
  29. "telephone_extension==",
  30. "telephone_delete==",
  31. "email_address==",
  32. "disease==",
  33. "disease_onset_date==",
  34. "date_diagnosed==",
  35. "hospitalized==",
  36. "health_facility==",
  37. "admission_date==",
  38. "discharge==",
  39. "medical_record_number==",
  40. "died==",
  41. "date_of_death==",
  42. "pregnant==",
  43. "pregnancy_due_date==",
  44. "treatment_given_yn==",
  45. "treatment==",
  46. "treatment_date==",
  47. "stop_treatment_date==",
  48. "clinician_first_name==",
  49. "clinician_middle_name==",
  50. "clinician_last_name==",
  51. "clinician_telephone_location_type==",
  52. "clinician_telephone_area_code==",
  53. "clinician_telephone_location_type==",
  54. "clinician_telephone_area_code==",
  55. "clinician_telephone_number==",
  56. "clinician_telephone_extension==",
  57. "clinician_telephone_delete==",
  58. "lab_name==",
  59. "lab_test_type==",
  60. "lab_test_result==",
  61. "lab_result_value==",
  62. "lab_units==",
  63. "lab_reference_range==",
  64. "lab_test_status==",
  65. "lab_specimen_source==",
  66. "lab_specimen_collection_date==",
  67. "lab_test_date==",
  68. "lab_specimen_sent_to_state==",
  69. "lab_comment==",
  70. "contact_first_name==",
  71. "contact_middle_name==",
  72. "contact_last_name==",
  73. "contact_disposition==",
  74. "contact_type==",
  75. "contact_telephone_location_type==",
  76. "contact_telephone_area_code==",
  77. "contact_telephone_number==",
  78. "contact_telephone_extension==",
  79. "contact_telephone_delete==",
  80. "food_handler==",
  81. "healthcare_worker==",
  82. "group_living==",
  83. "day_care_association==",
  84. "occupation==",
  85. "imported_from==",
  86. "risk_factors==",
  87. "risk_factors_notes==",
  88. "other_data_1==",
  89. "other_data_2==",
  90. "reporter_first_name==",
  91. "reporter_last_name==",
  92. "reporter_telephone_area_code==",
  93. "reporter_telephone_number==",
  94. "reporter_telephone_extension==",
  95. "results_reported_to_clinician_date==",
  96. "first_reported_ph_date==",
  97. "note==",
  98. "lhd_case_status==",
  99. "state_case_status==",
  100. "outbreak_associated==",
  101. "outbreak_name==",
  102. "event_name==",
  103. "jurisdiction_responsible_for_investigation==",
  104. "acuity=="
  105. );
  106. $cg = new Console_Getopt();
  107. $this->options = $cg->getopt($args, null, $longopts);
  108. if (PEAR::isError($this->options)) {
  109. die ("Error in command line: " . $this->options->getMessage() . "\n");
  110. }
  111. if (count($this->options[0]) == 0) {
  112. $this->print_help();
  113. exit(0);
  114. }
  115. }
  116. function populate_form() {
  117. foreach ($this->options[0] as $o) {
  118. switch ($o[0]) {
  119. case '--help':
  120. $this->print_help();
  121. exit(0);
  122. case '--first_name':
  123. $this->browser->setField('morbidity_event[interested_party_attributes][person_entity_attributes][person_attributes][first_name]', $o[1]);
  124. break;
  125. case '--middle_name':
  126. $this->browser->setField('morbidity_event[interested_party_attributes][person_entity_attributes][person_attributes][middle_name]', $o[1]);
  127. break;
  128. case '--last_name':
  129. $this->browser->setField('morbidity_event[interested_party_attributes][person_entity_attributes][person_attributes][last_name]', $o[1]);
  130. break;
  131. case '--birth_date':
  132. $this->browser->setField('morbidity_event[interested_party_attributes][person_entity_attributes][person_attributes][birth_date]', $o[1]);
  133. break;
  134. case '--parent_guardian':
  135. $this->browser->setField('morbidity_event[parent_guardian]', $o[1]);
  136. break;
  137. case '--approximate_age_no_birthday':
  138. $this->browser->setField('morbidity_event[interested_party_attributes][person_entity_attributes][person_attributes][approximate_age_no_birthday]', $o[1]);
  139. break;
  140. case '--birth_gender':
  141. $id = $this->get_option_id('morbidity_event[interested_party_attributes][person_entity_attributes][person_attributes][approximate_age_no_birthday]', $o[1]);
  142. $this->browser->setField('morbidity_event[interested_party_attributes][person_entity_attributes][person_attributes][birth_gender_id]', $id);
  143. break;
  144. case '--address_street_number':
  145. $this->browser->setField('morbidity_event[address_attributes][street_number]', $o[1]);
  146. break;
  147. case '--address_street_name':
  148. $this->browser->setField('morbidity_event[address_attributes][street_name]', $o[1]);
  149. break;
  150. case '--address_unit_number':
  151. $this->browser->setField('morbidity_event[address_attributes][unit_number]', $o[1]);
  152. break;
  153. case '--address_city':
  154. $this->browser->setField('morbidity_event[address_attributes][city]', $o[1]);
  155. break;
  156. case '--address_postal_code':
  157. $this->browser->setField('morbidity_event[address_attributes][postal_code]', $o[1]);
  158. break;
  159. case '--telephone_area_code':
  160. $this->browser->setField('morbidity_event[interested_party_attributes][person_entity_attributes][telephones_attributes][0][area_code]', $o[1]);
  161. break;
  162. case '--telephone_number':
  163. $this->browser->setField('morbidity_event[interested_party_attributes][person_entity_attributes][telephones_attributes][0][phone_number]', $o[1]);
  164. break;
  165. case '--telephone_extension':
  166. $this->browser->setField('morbidity_event[interested_party_attributes][person_entity_attributes][telephones_attributes][0][extension]', $o[1]);
  167. break;
  168. case '--telephone_delete':
  169. $this->browser->setField('morbidity_event[interested_party_attributes][person_entity_attributes][telephones_attributes][0][_delete]', true);
  170. break;
  171. case '--email_address':
  172. $this->browser->setField('morbidity_event[interested_party_attributes][person_entity_attributes][email_addresses_attributes][1][email_address]', $o[1]);
  173. break;
  174. case '--disease_onset_date':
  175. $this->browser->setField('morbidity_event[disease_event_attributes][disease_onset_date]', $o[1]);
  176. break;
  177. case '--date_diagnosed':
  178. $this->browser->setField('morbidity_event[disease_event_attributes][date_diagnosed]', $o[1]);
  179. break;
  180. case '--admission_date':
  181. $this->browser->setField('morbidity_event[hospitalization_facilities_attributes][0][hospitals_participation_attributes][admission_date]', $o[1]);
  182. break;
  183. case '--discharge_date':
  184. $this->browser->setField('morbidity_event[hospitalization_facilities_attributes][0][hospitals_participation_attributes][discharge_date]', $o[1]);
  185. break;
  186. case '--medical_record_number':
  187. $this->browser->setField('morbidity_event[hospitalization_facilities_attributes][0][hospitals_participation_attributes][medical_record_number]', $o[1]);
  188. break;
  189. case '--date_of_death':
  190. $this->browser->setField('morbidity_event[interested_party_attributes][person_entity_attributes][person_attributes][date_of_death]', $o[1]);
  191. break;
  192. case '--pregnancy_due_date':
  193. $this->browser->setField('morbidity_event[interested_party_attributes][risk_factor_attributes][pregnancy_due_date]', $o[1]);
  194. break;
  195. case '--treatment':
  196. $this->browser->setField('morbidity_event[interested_party_attributes][treatments_attributes][0][treatment]', $o[1]);
  197. case '--treatment_date':
  198. $this->browser->setField('morbidity_event[interested_party_attributes][treatments_attributes][0][treatment_date]', $o[1]);
  199. break;
  200. case '--stop_treatment_date':
  201. $this->browser->setField('morbidity_event[interested_party_attributes][treatments_attributes][0][stop_treatment_date]', $o[1]);
  202. break;
  203. case '--clinician_first_name':
  204. $this->browser->setField('morbidity_event[clinicians_attributes][1][person_entity_attributes][person_attributes][first_name]', $o[1]);
  205. $this->browser->setField('morbidity_event[clinicians_attributes][1][person_entity_attributes][person_attributes][person_type]', 'clinician');
  206. break;
  207. case '--clinician_middle_name':
  208. $this->browser->setField('morbidity_event[clinicians_attributes][1][person_entity_attributes][person_attributes][middle_name]', $o[1]);
  209. $this->browser->setField('morbidity_event[clinicians_attributes][1][person_entity_attributes][person_attributes][person_type]', 'clinician');
  210. break;
  211. case '--clinician_last_name':
  212. $this->browser->setField('morbidity_event[clinicians_attributes][1][person_entity_attributes][person_attributes][last_name]', $o[1]);
  213. $this->browser->setField('morbidity_event[clinicians_attributes][1][person_entity_attributes][person_attributes][person_type]', 'clinician');
  214. break;
  215. case '--clinician_telephone_area_code':
  216. $this->browser->setField('morbidity_event[clinicians_attributes][1][person_entity_attributes][telephones_attributes][0][area_code]', $o[1]);
  217. break;
  218. case '--clinician_telephone_number':
  219. $this->browser->setField('morbidity_event[clinicians_attributes][1][person_entity_attributes][telephones_attributes][0][phone_number]', $o[1]);
  220. break;
  221. case '--clinician_telephone_extension':
  222. $this->browser->setField('morbidity_event[clinicians_attributes][1][person_entity_attributes][telephones_attributes][0][extension]', $o[1]);
  223. break;
  224. case '--lab_name':
  225. $this->browser->setField('morbidity_event[labs_attributes][3][place_entity_attributes][place_attributes][name]', $o[1]);
  226. break;
  227. case '--lab_result_value':
  228. $this->browser->setField('morbidity_event[labs_attributes][3][lab_results_attributes][0][result_value]', $o[1]);
  229. break;
  230. case '--lab_units':
  231. $this->browser->setField('morbidity_event[labs_attributes][3][lab_results_attributes][0][units]', $o[1]);
  232. break;
  233. case '--lab_reference_range':
  234. $this->browser->setField('morbidity_event[labs_attributes][3][lab_results_attributes][0][reference_range]', $o[1]);
  235. break;
  236. case '--lab_specimen_collection_date':
  237. $this->browser->setField('morbidity_event[labs_attributes][3][lab_results_attributes][0][collection_date]', $o[1]);
  238. break;
  239. case '--lab_test_date':
  240. $this->browser->setField('morbidity_event[labs_attributes][3][lab_results_attributes][0][lab_test_date]', $o[1]);
  241. break;
  242. case '--lab_comment':
  243. $this->browser->setField('morbidity_event[labs_attributes][3][lab_results_attributes][0][comment]', $o[1]);
  244. break;
  245. case '--contact_first_name':
  246. $this->browser->setField('morbidity_event[contact_child_events_attributes][4][interested_party_attributes][person_entity_attributes][person_attributes][first_name]', $o[1]);
  247. break;
  248. case '--contact_last_name':
  249. $this->browser->setField('morbidity_event[contact_child_events_attributes][4][interested_party_attributes][person_entity_attributes][person_attributes][last_name]', $o[1]);
  250. break;
  251. case '--contact_telephone_area_code':
  252. $this->browser->setField('morbidity_event[contact_child_events_attributes][4][interested_party_attributes][person_entity_attributes][telephones_attributes][0][area_code]', $o[1]);
  253. break;
  254. case '--contact_telephone_number':
  255. $this->browser->setField('morbidity_event[contact_child_events_attributes][4][interested_party_attributes][person_entity_attributes][telephones_attributes][0][phone_number]', $o[1]);
  256. break;
  257. case '--contact_telephone_extension':
  258. $this->browser->setField('morbidity_event[contact_child_events_attributes][4][interested_party_attributes][person_entity_attributes][telephones_attributes][0][extension]', $o[1]);
  259. break;
  260. case '--encounter_date':
  261. $this->browser->setField('morbidity_event[encounter_child_events_attributes][5][participations_encounter_attributes][encounter_date]', $o[1]);
  262. break;
  263. case '--encounter_description':
  264. $this->browser->setField('morbidity_event[encounter_child_events_attributes][5][participations_encounter_attributes][description]', $o[1]);
  265. break;
  266. case '--occupation':
  267. $this->browser->setField('morbidity_event[interested_party_attributes][risk_factor_attributes][occupation]', $o[1]);
  268. break;
  269. case '--risk_factors':
  270. $this->browser->setField('morbidity_event[interested_party_attributes][risk_factor_attributes][risk_factors]', $o[1]);
  271. break;
  272. case '--risk_factors_notes':
  273. $this->browser->setField('morbidity_event[interested_party_attributes][risk_factor_attributes][risk_factors_notes]', $o[1]);
  274. break;
  275. case '--other_data_1':
  276. $this->browser->setField('morbidity_event[other_data_1]', $o[1]);
  277. break;
  278. case '--other_data_2':
  279. $this->browser->setField('morbidity_event[other_data_2]', $o[1]);
  280. break;
  281. case '--reporter_first_name':
  282. $this->browser->setField('morbidity_event[reporter_attributes][person_entity_attributes][person_attributes][first_name]', $o[1]);
  283. break;
  284. case '--reporter_last_name':
  285. $this->browser->setField('morbidity_event[reporter_attributes][person_entity_attributes][person_attributes][last_name]', $o[1]);
  286. break;
  287. case '--reporter_telephone_area_code':
  288. $this->browser->setField('morbidity_event[reporter_attributes][person_entity_attributes][telephones_attributes][0][area_code]', $o[1]);
  289. break;
  290. case '--reporter_telephone_number':
  291. $this->browser->setField('morbidity_event[reporter_attributes][person_entity_attributes][telephones_attributes][0][phone_number]', $o[1]);
  292. break;
  293. case '--reporter_telephone_extension':
  294. $this->browser->setField('morbidity_event[reporter_attributes][person_entity_attributes][telephones_attributes][0][extension]', $o[1]);
  295. break;
  296. case '--results_reported_to_clinician_date':
  297. $this->browser->setField('morbidity_event[results_reported_to_clinician_date]', $o[1]);
  298. break;
  299. case '--first_reported_ph_date':
  300. $this->browser->setField('morbidity_event[first_reported_PH_date]', $o[1]);
  301. break;
  302. case '--note':
  303. $this->browser->setField('morbidity_event[notes_attributes][0][note]', $o[1]);
  304. break;
  305. case '--outbreak_name':
  306. $this->browser->setField('morbidity_event[outbreak_name]', $o[1]);
  307. break;
  308. case '--event_name':
  309. $this->browser->setField('morbidity_event[event_name]', $o[1]);
  310. break;
  311. case '--acuity':
  312. $this->browser->setField('morbidity_event[acuity]', $o[1]);
  313. break;
  314. case '--ethnicity':
  315. $id = $this->get_menu_option_id('morbidity_event[interested_party_attributes][person_entity_attributes][person_attributes][ethnicity_id]', $o[1]);
  316. $this->browser->setField('morbidity_event[interested_party_attributes][person_entity_attributes][person_attributes][ethnicity_id]', $id);
  317. break;
  318. case '--race':
  319. $id = $this->get_menu_option_id('morbidity_event[interested_party_attributes][person_entity_attributes][race_ids][]', $o[1]);
  320. $this->browser->setField('morbidity_event[interested_party_attributes][person_entity_attributes][race_ids][]', $id);
  321. break;
  322. case '--primary_language':
  323. $id = $this->get_menu_option_id('morbidity_event[interested_party_attributes][person_entity_attributes][person_attributes][primary_language_id]', $o[1]);
  324. $this->browser->setField('morbidity_event[interested_party_attributes][person_entity_attributes][person_attributes][primary_language_id]', $id);
  325. break;
  326. case '--address_state':
  327. $id = $this->get_menu_option_id('morbidity_event[address_attributes][state_id]', $o[1]);
  328. $this->browser->setField('morbidity_event[address_attributes][state_id]', $id);
  329. break;
  330. case '--address_county':
  331. $id = $this->get_menu_option_id('morbidity_event[address_attributes][county_id]', $o[1]);
  332. $this->browser->setField('morbidity_event[address_attributes][county_id]', $id);
  333. break;
  334. case '--telephone_entity_location_type':
  335. $id = $this->get_menu_option_id('morbidity_event[interested_party_attributes][person_entity_attributes][telephones_attributes][0][entity_location_type_id]', $o[1]);
  336. $this->browser->setField('morbidity_event[interested_party_attributes][person_entity_attributes][telephones_attributes][0][entity_location_type_id]', $id);
  337. break;
  338. case '--disease':
  339. $id = $this->get_menu_option_id('morbidity_event[disease_event_attributes][disease_id]', $o[1]);
  340. $this->browser->setField('morbidity_event[disease_event_attributes][disease_id]', $id);
  341. break;
  342. case '--hospitalized':
  343. $id = $this->get_menu_option_id('morbidity_event[disease_event_attributes][hospitalized_id]', $o[1]);
  344. $this->browser->setField('morbidity_event[disease_event_attributes][hospitalized_id]', $id);
  345. break;
  346. case '--health_facility':
  347. $id = $this->get_menu_option_id('morbidity_event[hospitalization_facilities_attributes][0][secondary_entity_id]', $o[1]);
  348. $this->browser->setField('morbidity_event[hospitalization_facilities_attributes][0][secondary_entity_id]', $id);
  349. break;
  350. case '--died':
  351. $id = $this->get_menu_option_id('morbidity_event[disease_event_attributes][died_id]', $o[1]);
  352. $this->browser->setField('morbidity_event[disease_event_attributes][died_id]', $id);
  353. break;
  354. case '--pregnant':
  355. $id = $this->get_menu_option_id('morbidity_event[interested_party_attributes][risk_factor_attributes][pregnant_id]', $o[1]);
  356. $this->browser->setField('morbidity_event[interested_party_attributes][risk_factor_attributes][pregnant_id]', $id);
  357. break;
  358. case '--treatment_given_yn':
  359. $id = $this->get_menu_option_id('morbidity_event[interested_party_attributes][treatments_attributes][0][treatment_given_yn_id]', $o[1]);
  360. $this->browser->setField('morbidity_event[interested_party_attributes][treatments_attributes][0][treatment_given_yn_id]', $id);
  361. break;
  362. case '--clinician_telephone_entity_location_type':
  363. $id = $this->get_menu_option_id('morbidity_event[clinicians_attributes][1][person_entity_attributes][telephones_attributes][0][entity_location_type_id]', $o[1]);
  364. $this->browser->setField('morbidity_event[clinicians_attributes][1][person_entity_attributes][telephones_attributes][0][entity_location_type_id]', $id);
  365. break;
  366. case '--lab_test_type':
  367. $id = $this->get_menu_option_id('morbidity_event[labs_attributes][3][lab_results_attributes][0][test_type_id]', $o[1]);
  368. $this->browser->setField('morbidity_event[labs_attributes][3][lab_results_attributes][0][test_type_id]', $id);
  369. break;
  370. case '--lab_test_result':
  371. $id = $this->get_menu_option_id('morbidity_event[labs_attributes][3][lab_results_attributes][0][test_result_id]', $o[1]);
  372. $this->browser->setField('morbidity_event[labs_attributes][3][lab_results_attributes][0][test_result_id]', $id);
  373. break;
  374. case '--lab_test_status':
  375. $id = $this->get_menu_option_id('morbidity_event[labs_attributes][3][lab_results_attributes][0][test_status_id]', $o[1]);
  376. $this->browser->setField('morbidity_event[labs_attributes][3][lab_results_attributes][0][test_status_id]', $id);
  377. break;
  378. case '--lab_speciman_source':
  379. $id = $this->get_menu_option_id('morbidity_event[labs_attributes][3][lab_results_attributes][0][specimen_source_id]', $o[1]);
  380. $this->browser->setField('morbidity_event[labs_attributes][3][lab_results_attributes][0][specimen_source_id]', $id);
  381. break;
  382. case '--lab_speciman_sent_to_state':
  383. $id = $this->get_menu_option_id('morbidity_event[labs_attributes][3][lab_results_attributes][0][specimen_sent_to_state_id]', $o[1]);
  384. $this->browser->setField('morbidity_event[labs_attributes][3][lab_results_attributes][0][specimen_sent_to_state_id]', $id);
  385. break;
  386. case '--contact_disposition':
  387. $id = $this->get_menu_option_id('morbidity_event[contact_child_events_attributes][4][participations_contact_attributes][disposition_id]', $o[1]);
  388. $this->browser->setField('morbidity_event[contact_child_events_attributes][4][participations_contact_attributes][disposition_id]', $id);
  389. break;
  390. case '--contact_type':
  391. $id = $this->get_menu_option_id('morbidity_event[contact_child_events_attributes][4][participations_contact_attributes][contact_type_id]', $o[1]);
  392. $this->browser->setField('morbidity_event[contact_child_events_attributes][4][participations_contact_attributes][contact_type_id]', $id);
  393. break;
  394. case '--contact_telephone_entity_location_type':
  395. $id = $this->get_menu_option_id('morbidity_event[contact_child_events_attributes][4][interested_party_attributes][person_entity_attributes][telephones_attributes][0][entity_location_type_id]', $o[1]);
  396. $this->browser->setField('morbidity_event[contact_child_events_attributes][4][interested_party_attributes][person_entity_attributes][telephones_attributes][0][entity_location_type_id]');
  397. break;
  398. case '--encounter_investigator':
  399. $id = $this->get_menu_option_id('morbidity_event[encounter_child_events_attributes][5][participations_encounter_attributes][user_id]', $o[1]);
  400. $this->browser->setField('morbidity_event[encounter_child_events_attributes][5][participations_encounter_attributes][user_id]', $id);
  401. break;
  402. case '--encounter_location':
  403. $id = $this->get_menu_option_id('morbidity_event[encounter_child_events_attributes][5][participations_encounter_attributes][encounter_location_type]', $o[1]);
  404. $this->browser->setField('morbidity_event[encounter_child_events_attributes][5][participations_encounter_attributes][encounter_location_type]', $id);
  405. break;
  406. case '--food_handler':
  407. $id = $this->get_menu_option_id('morbidity_event[interested_party_attributes][risk_factor_attributes][food_handler_id]', $o[1]);
  408. $this->browser->setField('morbidity_event[interested_party_attributes][risk_factor_attributes][food_handler_id]', $id);
  409. break;
  410. case '--healthcare_worker':
  411. $id = $this->get_menu_option_id('morbidity_event[interested_party_attributes][risk_factor_attributes][healthcare_worker_id]', $o[1]);
  412. $this->browser->setField('morbidity_event[interested_party_attributes][risk_factor_attributes][healthcare_worker_id]', $id);
  413. break;
  414. case '--group_living':
  415. $id = $this->get_menu_option_id('morbidity_event[interested_party_attributes][risk_factor_attributes][group_living_id]', $o[1]);
  416. $this->browser->setField('morbidity_event[interested_party_attributes][risk_factor_attributes][group_living_id]', $id);
  417. break;
  418. case '--day_care_association':
  419. $id = $this->get_menu_option_id('morbidity_event[interested_party_attributes][risk_factor_attributes][day_care_association_id]', $o[1]);
  420. $this->browser->setField('morbidity_event[interested_party_attributes][risk_factor_attributes][day_care_association_id]', $id);
  421. break;
  422. case '--imported_from':
  423. $id = $this->get_menu_option_id('morbidity_event[imported_from_id]', $o[1]);
  424. $this->browser->setField('morbidity_event[imported_from_id]', $id);
  425. break;
  426. case '--lhd_case_status':
  427. $id = $this->get_menu_option_id('morbidity_event[lhd_case_status_id]', $o[1]);
  428. $this->browser->setField('morbidity_event[lhd_case_status_id]', $id);
  429. break;
  430. case '--state_case_status':
  431. $id = $this->get_menu_option_id('morbidity_event[state_case_status_id]', $o[1]);
  432. $this->browser->setField('morbidity_event[state_case_status_id]', $id);
  433. break;
  434. case '--outbreak_associated':
  435. $id = $this->get_menu_option_id('morbidity_event[outbreak_associated_id]', $o[1]);
  436. $this->browser->setField('morbidity_event[outbreak_associated_id]', $id);
  437. break;
  438. case '--jurisdiction_responsible_for_investigation':
  439. $id = $this->get_menu_option_id('morbidity_event[jurisdiction_attributes][secondary_entity_id]', $o[1]);
  440. $this->browser->setField('morbidity_event[jurisdiction_attributes][secondary_entity_id]', $id);
  441. break;
  442. }
  443. }
  444. }
  445. function print_help() {
  446. print "Usage: ./new_cmr.rb [options]
  447. Options:
  448. --first_name=NAME Person's first name.
  449. --middle_name=NAME Person's middle name.
  450. --last_name=NAME Person's last name.
  451. --parent_guardian=NAME Parent/guardian's full name.
  452. --birth_date=DATE Person's birth date. Most date formats work, including YYYY-MM-DD.
  453. --approx_age_no_birthday=AGE Approximate age if no birthday set.
  454. --birth_gender=GENDER Birth gender.
  455. --ethnicity=ETHNICITY Ethnicity.
  456. --race=RACE Comma-delimited list of races.
  457. --primary_language=LANGUAGE Primary language.
  458. --address_street_number=NUMBER Address street number.
  459. --address_street_name=NAME Address street name.
  460. --address_unit_number=NUMBER Address unit number.
  461. --address_city=CITY Address city.
  462. --address_state=STATE Address state.
  463. --address_county=COUNTY Address county.
  464. --address_postal_code=CODE Address postal code.
  465. --telephone_location_type=LOCATION Telephone location type.
  466. --telephone_area_code=CODE Telephone area code.
  467. --telephone_number=NUMBER Telephone number.
  468. --telephone_extension=NUMBER Telephone extension.
  469. --telephone_delete Delete telephone.
  470. --email_address=EMAIL Email address.
  471. --email_address_delete Delete email address.
  472. --disease=NAME Disease name.
  473. --disease_onset_date=DATE Disease onset date.
  474. --date_diagnosed=DATE Date diagnosed.
  475. --hospitalized=TEXT Hospitalized? Yes, No, or Unknown.
  476. --health_facility=NAME Health facility name.
  477. --admission_date=DATE Health facility admission_date
  478. --discharge=DATE Health facility discharge date.
  479. --medical_record_number=NUMBER Medical record number.
  480. --died=TEXT Died? Yes, No, or Unknown.
  481. --date_of_death=DATE Date of death.
  482. --pregnant=TEXT Pregnant? Yes, No, or Unknown.
  483. --pregnancy_due_date=DATE Pregnancy due date.
  484. --treatment_given_yn=TEXT Treatment given? Yes, No, or Unknown.
  485. --treatment=NAME Treatment name.
  486. --treatment_date=DATE Treatment date.
  487. --stop_treatment_date=DATE Treatment stop date.
  488. --clinician_first_name=NAME Clinician first name.
  489. --clinician_middle_name=NAME Clinician middle name.
  490. --clinician_last_name=NAME Clinician last name
  491. --clinician_telephone_location_type LOCATION Clinician telephone location type.
  492. --clinician_telephone_area_code=CODE Clinician telephone area code.
  493. --clinician_telephone_number=NUMBER Clinician telephone number.
  494. --clinician_telephone_extension=NUMBER Clinician telephone extension.
  495. --clinician_telephone_delete Delete clinician telephone.
  496. --lab_name=NAME Lab name.
  497. --lab_test_type=NAME Lab test type.
  498. --lab_test_result=TEXT Lab test result.
  499. --lab_result_value=TEXT Lab result value.
  500. --lab_units=UNITS Lab result units.
  501. --lab_reference_range=RANGE Lab reference range.
  502. --lab_test_status=STATUS Lab test status.
  503. --lab_specimen_source=SOURCE Lab specimen source.
  504. --lab_specimen_collection_date=DATE Lab specimen collection date.
  505. --lab_test_date=DATE Lab test date.
  506. --lab_specimen_sent_to_state=TEXT Sent to state? Yes, No, or Unknown.
  507. --lab_comment=TEXT Lab comment.
  508. --contact_first_name=NAME Contact last name.
  509. --contact_middle_name=NAME Contact middle name.
  510. --contact_last_name=NAME Contact last name
  511. --contact_disposition=NAME Contact disposition.
  512. --contact_type=TYPE Contact type.
  513. --contact_telephone_location_type=LOCATION Contact telephone location type.
  514. --contact_telephone_area_code=CODE Contact telephone area code.
  515. --contact_telephone_number=NUMBER Contact telephone number.
  516. --contact_telephone_extension=NUMBER Contact telephone extension.
  517. --contact_telephone_delete Delete contact telephone.
  518. --food_handler=TEXT Food handler? Yes, No, Unknown.
  519. --healthcare_worker=TEXT Healthcare worker? Yes, No, Unknown.
  520. --group_living=TEXT Group living? Yes, No, Unknown.
  521. --day_care_association=TEXT Day care association? Yes, No, Unknown.
  522. --occupation=TEXT Occupation name.
  523. --imported_from=TEXT Imported from.
  524. --risk_factors=TEXT Risk factors.
  525. --risk_factors_notes=TEXT Risk factors notes.
  526. --other_data_1=TEXT Other data 1.
  527. --other_data_2=TEXT Other data 2.
  528. --reporter_first_name=NAME Report first name.
  529. --reporter_last_name=NAME Report last name.
  530. --reporter_telephone_area_code=CODE Reporter telephone area code.
  531. --reporter_telephone_number=NUMBER Reporter telephone number.
  532. --reporter_telephone_extension=NUMBER Reporter telephone extension.
  533. --results_reported_to_clinician_date=DATE Results reported to clinician date.
  534. --first_reported_ph_date=DATE First reported to public health date.
  535. --note=TEXT Event notes.
  536. --lhd_case_status=STATUS Local health department case status.
  537. --state_case_status=STATUS State case status.
  538. --outbreak_associated=TEXT Outbreak associated? Yes, No, Unknown.
  539. --outbreak_name=NAME Outbreak name.
  540. --event_name=NAME Event name.
  541. --jurisdiction_responsible_for_investigation=TEXT Jurisdiction responsible for investigation.
  542. --acuity Acuity.
  543. ";
  544. }
  545. function get_menu_option_id($name, $value) {
  546. $page = $this->get_page();
  547. $dom = new DOMDocument();
  548. $dom->loadXML($page);
  549. $xpath = new DOMXPath($dom);
  550. $nodeList = $xpath->query(".//select[@name = '$name']/option");
  551. foreach($nodeList as $n) {
  552. if ($n->textContent == $value) {
  553. return $n->getAttribute('value');
  554. }
  555. }
  556. die("${name} with value ${value} not found in form");
  557. }
  558. }
  559. ?>