-- DBMS: bigquery
CREATE TABLE `bigquery-public-data.san_francisco_sffd_service_calls.sffd_service_calls`
(
  call_number INT64 NOT NULL OPTIONS(description="A unique 9-digit number assigned by the 911 Dispatch Center (DEM) to this call. These number are used for both Police and Fire calls"),
  unit_id STRING OPTIONS(description="Unit Identifier. For example E01 for Engine 1 or T01 for Truck 1."),
  incident_number INT64 OPTIONS(description="A unique 8-digit number assigned by DEM to this Fire incident."),
  call_type STRING OPTIONS(description="Type of call the incident falls into. See the list below."),
  call_date DATE OPTIONS(description="Date the call is received at the 911 Dispatch Center. Used for reporting purposes."),
  watch_date DATE OPTIONS(description="Watch date when the call is received. Watch date starts at 0800 each morning and ends at 0800 the next day."),
  received_timestamp DATETIME OPTIONS(description="Date and time of call is received at the 911 Dispatch Center."),
  entry_timestamp DATETIME OPTIONS(description="Date and time the 911 operator submits the entry of the initical call information into the CAD system"),
  dispatch_timestamp DATETIME OPTIONS(description="Date and time the 911 operator dispatches this unit to the call."),
  response_timestamp DATETIME OPTIONS(description="Date and time this unit acknowledges the dispatch and records that the unit is en route to the location of the call."),
  on_scene_timestamp DATETIME OPTIONS(description="Date and time the unit records arriving to the location of the incident"),
  transport_timestamp DATETIME OPTIONS(description="If this unit is an ambulance, date and time the unit begins the transport unit arrives to hospital"),
  hospital_timestamp DATETIME OPTIONS(description="If this unit is an ambulance, date and time the unit arrives to the hospital."),
  call_final_disposition STRING OPTIONS(description="Disposition of the call (Code). For example TH2: Transport to Hospital - Code 2, FIR: Resolved by Fire Department"),
  available_timestamp DATETIME OPTIONS(description="Date and time this unit is not longer assigned to this call and it is available for another dispatch."),
  address STRING OPTIONS(description="Address of midblock point associated with incident (obfuscated address to protect caller privacy)"),
  city STRING OPTIONS(description="City of incident"),
  zipcode_of_incident STRING OPTIONS(description="Zipcode of incident"),
  battalion STRING OPTIONS(description="Emergency Response District (There are 9 Fire Emergency Response Districts)"),
  station_area STRING OPTIONS(description="Fire Station First Response Area associated with the address of the incident"),
  box STRING OPTIONS(description="Fire box associated with the address of the incident. A box is the smallest area used to divide the City. Each box is associated with a unique unit dispatch order. The City is divided into more than 2,400 boxes."),
  original_priority STRING OPTIONS(description="Initial call priority (Code 2: Non-Emergency or Code 3:Emergency)."),
  priority STRING OPTIONS(description="Call priority (Code 2: Non-Emergency or Code 3:Emergency)."),
  final_priority INT64 OPTIONS(description="Final call priority (Code 2: Non-Emergency or Code 3:Emergency)."),
  als_unit BOOL OPTIONS(description="Does this unit includes ALS (Advance Life Support) resources? Is there a paramedic in this unit?"),
  call_type_group STRING OPTIONS(description="Call types are divided into four main groups: Fire, Alarm, Potential Life Threatening and Non Life Threatening."),
  number_of_alarms INT64 OPTIONS(description="Number of alarms associated with the incident. This is a number between 1 and 5."),
  unit_type STRING OPTIONS(description="Unit type"),
  unit_sequence_in_call_dispatch INT64 OPTIONS(description="A number that indicates the order this unit was assigned to this call"),
  fire_prevention_district STRING OPTIONS(description="Bureau of Fire Prevention District associated with this address"),
  supervisor_district STRING OPTIONS(description="Supervisor District associated with this address"),
  row_id STRING OPTIONS(description="Unique identifier used for managing data updates. It is the concatenation of Call Number and Unit ID separated by a dash"),
  latitude FLOAT64 OPTIONS(description="Latitude of the address"),
  longitude FLOAT64 OPTIONS(description="Longitude of the address"),
  neighborhood_name STRING OPTIONS(description="Text name of the neighborhood in which the incident occurred"),
  location_geom GEOGRAPHY OPTIONS(description="Latitude and longitude of address obfuscated either to the midblock, intersection or call box")
);

INSERT INTO `bigquery-public-data.san_francisco_sffd_service_calls.sffd_service_calls` (call_number, unit_id, incident_number, call_type, call_date, watch_date, received_timestamp, entry_timestamp, dispatch_timestamp, response_timestamp, on_scene_timestamp, transport_timestamp, hospital_timestamp, call_final_disposition, available_timestamp, address, city, zipcode_of_incident, battalion, station_area, box, original_priority, priority, final_priority, als_unit, call_type_group, number_of_alarms, unit_type, unit_sequence_in_call_dispatch, fire_prevention_district, supervisor_district, row_id, latitude, longitude, neighborhood_name, location_geom) VALUES (162081989, 'EMS10', 16082091, 'Medical Incident', '2016-07-26', '2016-07-26', '2016-07-26 01:59:44', '2016-07-26 01:59:44', '2016-07-26 01:59:44', '2016-07-26 01:59:44', '2016-07-26 01:59:44', 'NaT', 'NaT', 'Patient Declined Transport', '2016-07-26 01:59:44', NULL, NULL, NULL, 'B99', NULL, NULL, '2', '2', 2, False, 'Non Life-threatening', 1, 'CHIEF', 1, NULL, NULL, '162081989-EMS10', nan, nan, NULL, NULL), (210280880, 'BLS841', 21012400, 'Medical Incident', '2021-01-28', '2021-01-28', '2021-01-28 09:31:12', '2021-01-28 09:31:12', '2021-01-28 09:31:12', '2021-01-28 09:31:12', '2021-01-28 09:46:19', 'NaT', 'NaT', 'Other', '2021-01-28 09:59:00', NULL, NULL, NULL, 'B12', NULL, NULL, '2', '2', 2, False, NULL, 1, 'CHIEF', 1, NULL, NULL, '210280880-BLS841', nan, nan, NULL, NULL), (53550353, 'E17', 5096637, 'Traffic Collision', '2005-12-21', '2005-12-21', '2005-12-21 07:11:16', '2005-12-21 07:14:41', '2005-12-21 07:17:51', '2005-12-21 07:18:52', '2005-12-21 07:23:32', 'NaT', 'NaT', 'Duplicate', '2005-12-21 07:27:44', NULL, 'SF', NULL, 'B07', '44', NULL, '2', '2', 2, True, NULL, 1, 'ENGINE', 1, NULL, NULL, '053550353-E17', nan, nan, NULL, NULL), (202091240, 'BLS841', 20085838, 'Medical Incident', '2020-07-27', '2020-07-27', '2020-07-27 11:51:41', '2020-07-27 11:51:41', '2020-07-27 11:51:41', '2020-07-27 11:51:41', '2020-07-27 12:00:50', 'NaT', 'NaT', 'Other', '2020-07-27 12:11:32', NULL, NULL, NULL, 'B09', NULL, NULL, '2', '2', 2, False, NULL, 1, 'CHIEF', 1, NULL, NULL, '202091240-BLS841', nan, nan, NULL, NULL), (202270778, 'BLS840', 20093146, 'Medical Incident', '2020-08-14', '2020-08-14', '2020-08-14 08:53:29', '2020-08-14 08:53:29', '2020-08-14 08:53:29', '2020-08-14 08:53:29', '2020-08-14 09:23:54', 'NaT', 'NaT', 'Other', '2020-08-14 09:50:33', NULL, NULL, NULL, 'B12', NULL, NULL, '2', '2', 2, False, NULL, 1, 'CHIEF', 1, NULL, NULL, '202270778-BLS840', nan, nan, NULL, NULL);