$t('Permissions API'), 'description' => $t('The Permissions API is required in order to automatically configure roles and permissions at install time. You must manually configure these using the permissions administration tool if you do not have this module installed.'), 'severity' => REQUIREMENT_WARNING, ); } else { $requirements['permissions_api'] = array( 'title' => $t('Permissions API'), 'description' => $t('The Permissions API was detected as installed, so roles and permissions are automatically configured.'), 'severity' => REQUIREMENT_OK, ); } } } function _iAbetics_create_roles() { $q = $_GET['q']; $_GET['q'] = ""; require_once(drupal_get_path('module', 'user') . "/user.admin.inc"); $form_id = "user_admin_new_role"; $form_state = array( 'values' => array( 'op' => t('Add role'), ), ); foreach(array("patient", "guardian", "doctor", "researcher", "medical professional") as $role) { $form_state['values']['name'] = "iAbetics $role"; drupal_set_message(t("Adding role: "). "iAbetics $role"); drupal_execute($form_id, $form_state); } $_GET['q'] = $q; $roles_table = user_roles(); // loads the roles table into an array foreach(array("patient", "guardian", "doctor", "researcher", "medical professional") as $role) { permissions_grant_permissions(array_search("iAbetics $role", $roles_table), array("access iAbetics $role content")); } } function _iAbetics_destroy_roles() { // Don't need to revoke module permissions cos that happens automagically, // we just need to nuke the roles. We do this by "submitting" the edit role form and telling it to delete the roles. $q = $_GET['q']; require_once(drupal_get_path('module', 'user') . "/user.admin.inc"); $roles_table = user_roles(); // loads the roles table into an array $form_id = "user_admin_role"; $form_state = array( 'values' => array( 'op' => t('Delete role'), ), ); foreach(array("patient", "guardian", "doctor", "researcher", "medical professional") as $role) { $rid = array_search("iAbetics $role", $roles_table); drupal_set_message(t("Removing role: "). "iAbetics $role"); $form_state['values']['name'] = "iAbetics $role"; $form_state['values']['rid'] = $rid; $_GET['q'] = "admin/user/roles/edit/$rid"; drupal_execute($form_id, $form_state); } $_GET['q'] = $q; } function iAbetics_enable() { _iAbetics_create_roles(); } function iAbetics_disable() { drupal_set_message(t('Disabling iAbetics...')); _iAbetics_destroy_roles(); drupal_set_message(t('iAbetics has been disabled')); } /* * Implementation of hook_install() */ function iAbetics_install() { drupal_install_schema('iAbetics'); db_query("DELETE FROM {cache}"); } /* * Implementation of hook_uninstall() */ function iAbetics_uninstall() { drupal_uninstall_schema('iAbetics'); } /* * Implementation of hook_schema() */ function iAbetics_schema() { $schema['iab_insulin_favorite'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'insulin_favorite_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, ), 'name' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '32', 'not null' => TRUE, ), 'patient_profile_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, ), ), 'primary key' => array('patient_profile_id', 'name'), ); $schema['iab_fia_favorite'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'fia_favorite_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, ), 'name' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '32', 'not null' => TRUE, ), 'patient_profile_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, ), ), 'primary key' => array('patient_profile_id', 'name'), ); $schema['iab_food_favorite'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'food_favorite_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, ), 'name' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '32', 'not null' => TRUE, ), 'patient_profile_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, ), ), 'primary key' => array('patient_profile_id', 'name'), ); $schema['iab_activity_favorite'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'activity_favorite_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, ), 'name' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '32', 'not null' => TRUE, ), 'patient_profile_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, ), ), 'primary key' => array('patient_profile_id', 'name'), ); $schema['iab_research_trial'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'trial_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'serial', 'not null' => TRUE, ), 'name' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), 'brief_description' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'text', 'not null' => FALSE, ), 'description' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'text', 'not null' => FALSE, ), ), 'primary key' => array('trial_id'), ); $schema['iab_person_phone'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'person_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'contact_phone_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'description' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), 'is_primary' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'size' => 'tiny', 'not null' => FALSE, ), ), 'primary key' => array('person_id', 'contact_phone_id'), 'indexes' => array( 'contact_phone_id' => array('contact_phone_id'), ), ); $schema['iab_person_email'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'person_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'contact_email_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'description' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), 'is_primary' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'size' => 'tiny', 'not null' => FALSE, ), ), 'primary key' => array('person_id', 'contact_email_id'), 'indexes' => array( 'contact_email_id' => array('contact_email_id'), ), ); $schema['iab_research_trial_address'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'trial_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'contact_address_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'description' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), 'is_primary' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'size' => 'tiny', 'not null' => FALSE, ), ), 'primary key' => array('trial_id', 'contact_address_id'), 'indexes' => array( 'contact_address_id' => array('contact_address_id'), ), ); $schema['iab_research_trial_email'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'trial_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'contact_email_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'description' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), 'is_primary' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'size' => 'tiny', 'not null' => FALSE, ), ), 'primary key' => array('trial_id', 'contact_email_id'), 'indexes' => array( 'contact_email_id' => array('contact_email_id'), ), ); $schema['iab_research_trial_phone'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'trial_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'contact_phone_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'description' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), 'is_primary' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'size' => 'tiny', 'not null' => FALSE, ), ), 'primary key' => array('trial_id', 'contact_phone_id'), 'indexes' => array( 'contact_phone_id' => array('contact_phone_id'), ), ); $schema['iab_research_trial_person'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'trial_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'person_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'relationship' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), ), 'primary key' => array('trial_id', 'person_id'), 'indexes' => array( 'person_id' => array('person_id'), ), ); $schema['iab_person_address'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'person_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'contact_address_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'description' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), 'is_primary' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'size' => 'tiny', 'not null' => FALSE, ), ), 'primary key' => array('person_id', 'contact_address_id'), 'indexes' => array( 'contact_address_id' => array('contact_address_id'), ), ); $schema['iab_person'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'person_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'serial', 'not null' => TRUE, ), 'first_name' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '32', 'not null' => FALSE, ), 'middle_name' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '32', 'not null' => FALSE, ), 'last_name' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '32', 'not null' => FALSE, ), 'title' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '8', 'not null' => FALSE, ), ), 'primary key' => array('person_id'), ); $schema['iab_meds_and_supplements'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'med_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'serial', 'not null' => TRUE, ), 'name' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), 'description' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'text', 'not null' => FALSE, ), 'unit' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), ), 'primary key' => array('med_id'), ); $schema['iab_medical_pratice_address'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'practice_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'contact_address_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'description' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), 'is_primary' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'size' => 'tiny', 'not null' => FALSE, ), ), 'primary key' => array('practice_id', 'contact_address_id'), 'indexes' => array( 'contact_address_id' => array('contact_address_id'), ), ); $schema['iab_medical_practice_phone'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'practice_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'contact_phone_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'description' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), 'is_primary' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'size' => 'tiny', 'not null' => FALSE, ), ), 'primary key' => array('practice_id', 'contact_phone_id'), 'indexes' => array( 'contact_phone_id' => array('contact_phone_id'), ), ); $schema['iab_patient_doctor'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'patient_profile_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'doctor_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'specialty' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), ), 'indexes' => array( 'doctor_id' => array('doctor_id'), 'patient_profile_id' => array('patient_profile_id'), ), ); $schema['iab_patient_guardian'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'patient_profile_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'guardian_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'description' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), ), 'primary key' => array('patient_profile_id', 'guardian_id'), 'indexes' => array( 'guardian_id' => array('guardian_id'), ), ); $schema['iab_patient_profile'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'patient_profile_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'serial', 'not null' => TRUE, ), 'type1_diabetic' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'size' => 'tiny', 'not null' => FALSE, ), 'diagnosis_date' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'datetime', 'not null' => FALSE, ), 'account_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'person_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'treatment_type' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '16', 'not null' => FALSE, ), 'gender' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '1', 'not null' => FALSE, ), 'birth_date' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'datetime', 'not null' => FALSE, ), 'race' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '32', 'not null' => FALSE, ), 'job' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), 'notes' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'text', 'not null' => FALSE, ), 'research_ok' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'size' => 'tiny', 'not null' => FALSE, ), 'contact_ok' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'size' => 'tiny', 'not null' => FALSE, ), ), 'primary key' => array('patient_profile_id'), 'indexes' => array( 'account_id' => array('account_id'), 'person_id' => array('person_id'), ), ); $schema['iab_patient_professional'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'patient_profile_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'professional_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'specialty' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), ), 'indexes' => array( 'patient_profile_id' => array('patient_profile_id'), 'professional_id' => array('professional_id'), ), ); $schema['iab_sr21_food_groups'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'group_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '4', 'not null' => TRUE, ), 'description' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '60', 'not null' => FALSE, ), ), 'primary key' => array('group_id'), ); $schema['iab_sr21_food_values'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'ndb_no' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '5', 'not null' => TRUE, ), 'food_group_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '4', 'not null' => FALSE, ), 'long_description' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '200', 'not null' => FALSE, ), 'short_description' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '60', 'not null' => FALSE, ), 'common_names' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '100', 'not null' => FALSE, ), 'manufacturer_name' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '65', 'not null' => FALSE, ), 'refuse_description' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '135', 'not null' => FALSE, ), 'refuse_percentage' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'scientific_name' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '65', 'not null' => FALSE, ), 'water' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'numeric', 'not null' => FALSE, 'precision' => '10', 'scale' => '2', ), 'energy_kcal' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'protein' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'numeric', 'not null' => FALSE, 'precision' => '10', 'scale' => '2', ), 'total_lipids' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'numeric', 'not null' => FALSE, 'precision' => '10', 'scale' => '2', ), 'carbohydrate' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'numeric', 'not null' => FALSE, 'precision' => '10', 'scale' => '2', ), 'fiber' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'numeric', 'not null' => FALSE, 'precision' => '10', 'scale' => '1', ), 'total_sugar' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'numeric', 'not null' => FALSE, 'precision' => '10', 'scale' => '2', ), 'saturated_fat' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'numeric', 'not null' => FALSE, 'precision' => '10', 'scale' => '3', ), 'mono_unsaturated_fat' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'numeric', 'not null' => FALSE, 'precision' => '10', 'scale' => '3', ), 'poly_unsaturated_fat' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'numeric', 'not null' => FALSE, 'precision' => '10', 'scale' => '3', ), 'cholesterol' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'numeric', 'not null' => FALSE, 'precision' => '10', 'scale' => '3', ), 'household_weight_1' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'numeric', 'not null' => FALSE, 'precision' => '9', 'scale' => '2', ), 'household_weight_desc_1' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '120', 'not null' => FALSE, ), 'household_weight_2' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'numeric', 'not null' => FALSE, 'precision' => '9', 'scale' => '2', ), 'household_weight_desc_2' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '120', 'not null' => FALSE, ), ), 'primary key' => array('ndb_no'), ); $schema['iab_zipcode_lookup'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'zipcode' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'state' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'char', 'length' => '2', 'not null' => FALSE, ), ), 'indexes' => array( 'zipcode_lookup_idx' => array('zipcode'), ), ); $schema['iab_system_user'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'system_user_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, ), 'account_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), ), 'primary key' => array('system_user_id'), 'indexes' => array( 'account_id' => array('account_id'), ), ); $schema['iab_medical_practice_person'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'practice_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'person_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'relationship' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), ), 'primary key' => array('practice_id', 'person_id'), 'indexes' => array( 'person_id' => array('person_id'), ), ); $schema['iab_medical_practice_email'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'practice_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'contact_email_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0, ), 'description' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), 'is_primary' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'size' => 'tiny', 'not null' => FALSE, ), ), 'primary key' => array('practice_id', 'contact_email_id'), 'indexes' => array( 'contact_email_id' => array('contact_email_id'), ), ); $schema['iab_address_format'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'address_format_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'serial', 'not null' => TRUE, ), 'address_format' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '128', 'not null' => TRUE, 'default' => '', ), 'address_summary' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '48', 'not null' => TRUE, 'default' => '', ), ), 'primary key' => array('address_format_id'), ); $schema['iab_activities'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'activity_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'serial', 'not null' => TRUE, ), 'name' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), 'description' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'text', 'not null' => FALSE, ), 'activity_unit' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '16', 'not null' => FALSE, ), ), 'primary key' => array('activity_id'), ); $schema['iab_account'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'account_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'serial', 'not null' => TRUE, ), 'creation_date' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'datetime', 'not null' => TRUE, ), 'account_status' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '16', 'not null' => FALSE, ), 'subscription_start' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'datetime', 'not null' => FALSE, ), 'subscription_end' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'datetime', 'not null' => FALSE, ), 'consent_form_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'consent_date' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'datetime', 'not null' => FALSE, ), ), 'primary key' => array('account_id'), 'indexes' => array( 'consent_form_id' => array('consent_form_id'), ), ); $schema['iab_consent_form'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'consent_form_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'serial', 'not null' => TRUE, ), 'consent_form_created' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'datetime', 'not null' => TRUE, ), 'consent_form_form' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'text', 'not null' => FALSE, ), ), 'primary key' => array('consent_form_id'), ); $schema['iab_contact_address'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'contact_address_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'serial', 'not null' => TRUE, ), 'street' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), 'suburb' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '32', 'not null' => FALSE, ), 'postcode' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '10', 'not null' => FALSE, ), 'city' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '32', 'not null' => FALSE, ), 'state' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '32', 'not null' => FALSE, ), 'country_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), ), 'primary key' => array('contact_address_id'), 'indexes' => array( 'country_id' => array('country_id'), ), ); $schema['iab_contact_phone'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'contact_phone_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'serial', 'not null' => TRUE, ), 'country_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'phone_number' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '16', 'not null' => FALSE, ), ), 'primary key' => array('contact_phone_id'), 'indexes' => array( 'country_id' => array('country_id'), ), ); $schema['iab_contact_email'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'contact_email_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'serial', 'not null' => TRUE, ), 'email' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), ), 'primary key' => array('contact_email_id'), ); $schema['iab_countries'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'country_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'serial', 'not null' => TRUE, ), 'country_name' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => TRUE, 'default' => '', ), 'country_iso_code_2' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'char', 'length' => '2', 'not null' => TRUE, 'default' => '', ), 'country_iso_code_3' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'char', 'length' => '3', 'not null' => TRUE, 'default' => '', ), 'phone_country_code' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '4', 'not null' => TRUE, 'default' => '', ), 'address_format_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), ), 'primary key' => array('country_id'), 'indexes' => array( 'IDX_COUNTRIES_NAME' => array('country_name'), ), ); $schema['iab_daily_status_report'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'dsr_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'serial', 'not null' => TRUE, ), 'patient_profile_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'dsr_creator' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'dsr_creation_time' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'datetime', 'not null' => TRUE, ), 'dsr_datetime' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'datetime', 'not null' => TRUE, 'default' => '0000-00-00 00:00:00', ), 'weight' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'numeric', 'not null' => FALSE, 'precision' => '5', 'scale' => '2', ), 'height' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'numeric', 'not null' => FALSE, 'precision' => '3', 'scale' => '2', ), 'systolic_bp' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'diastolic_bp' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'stress' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'size' => 'tiny', 'not null' => FALSE, ), ), 'primary key' => array('dsr_id'), 'indexes' => array( 'dsr_creator' => array('dsr_creator'), 'patient_profile_id' => array('patient_profile_id'), ), ); $schema['iab_illnesses'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'illness_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'serial', 'not null' => TRUE, ), 'name' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), 'description' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'text', 'not null' => FALSE, ), 'ICD10' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '5', 'not null' => FALSE, ), ), 'primary key' => array('illness_id'), ); $schema['iab_fia_event_insulin'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'event_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'insulin_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'serial', 'not null' => TRUE, ), 'insulin_type_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'insulin_quantity' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'injection_site' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), ), 'indexes' => array( 'event_id' => array('event_id'), 'insulin_id' => array('insulin_id'), 'injection_site' => array('injection_site'), 'insulin_type_id' => array('insulin_type_id'), ), ); $schema['iab_fia_event_food'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'event_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'food_item_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'serial', 'not null' => TRUE, ), 'food_item_code' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '5', 'not null' => FALSE, ), 'food_quantity_grams' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), ), 'indexes' => array( 'event_id' => array('event_id'), 'food_item_id' => array('food_item_id'), 'food_item_code' => array('food_item_code'), ), ); $schema['iab_injection_site'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'injection_site_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'serial', 'not null' => TRUE, ), 'name' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => TRUE, ), 'description' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'text', 'not null' => FALSE, ), ), 'primary key' => array('injection_site_id'), ); $schema['iab_insulin_type'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'insulin_type_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'serial', 'not null' => TRUE, ), 'insulin_name' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => TRUE, ), 'insulin_description' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'text', 'not null' => FALSE, ), ), 'primary key' => array('insulin_type_id'), ); $schema['iab_medical_practice'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'practice_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'serial', 'not null' => TRUE, ), 'practice_name' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), 'specialty' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), 'description' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'text', 'not null' => FALSE, ), ), 'primary key' => array('practice_id'), ); $schema['iab_fia_event_activity'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'event_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'activity_instance_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'serial', 'not null' => TRUE, ), 'activity_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'activity_amount' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), ), 'indexes' => array( 'activity_id' => array('activity_id'), 'activity_instance_id' => array('activity_instance_id'), 'event_id' => array('event_id'), ), ); $schema['iab_fia_event'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'event_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'serial', 'not null' => TRUE, ), 'patient_profile_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'event_creator' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'creation_date' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'datetime', 'not null' => TRUE, ), 'event_bgl' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'event_datetime' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'datetime', 'not null' => FALSE, ), 'event_final_bgl' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), ), 'primary key' => array('event_id'), 'indexes' => array( 'event_creator' => array('event_creator'), 'patient_profile_id' => array('patient_profile_id'), ), ); $schema['iab_dsr_illnesses'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'dsr_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'illness_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'illness_severity' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'size' => 'tiny', 'not null' => FALSE, ), ), 'indexes' => array( 'dsr_id' => array('dsr_id'), 'illness_id' => array('illness_id'), ), ); $schema['iab_dsr_otc_meds'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'dsr_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'otc_med_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'med_quantity' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), ), 'indexes' => array( 'dsr_id' => array('dsr_id'), 'otc_med_id' => array('otc_med_id'), ), ); $schema['iab_dsr_prescription_meds'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'dsr_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'prescription_med_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'med_quantity' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), ), 'indexes' => array( 'dsr_id' => array('dsr_id'), 'prescription_med_id' => array('prescription_med_id'), ), ); $schema['iab_dsr_tobacco'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'dsr_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'tobacco_type' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '64', 'not null' => FALSE, ), 'tobacco_quantity' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), ), 'indexes' => array( 'dsr_id' => array('dsr_id'), ), ); $schema['iab_dsr_supplements'] = array( 'description' => t('TODO: please describe this table!'), 'fields' => array( 'dsr_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'supplement_id' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), 'supplement_quantity' => array( 'description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE, ), ), 'indexes' => array( 'dsr_id' => array('dsr_id'), 'supplement_id' => array('supplement_id'), ), ); return $schema; } ?>