 
 
 --
--- Name: deprecated_YU_energy_to_houses_without_PV_copy; Type: VIEW; Schema: public; Owner: yuma
---
-
-CREATE VIEW "deprecated_YU_energy_to_houses_without_PV_copy" AS
-    SELECT "LocationRecords".device_util_id, "LocationRecords".service_point_util_id, "LocationRecords".service_pt_longitude, "LocationRecords".service_pt_latitude, "LocationRecords".address1, "LocationRecords".premise_util_id, "Interval".end_time, "Reading".value AS "energy to house kWh" FROM (("LocationRecords" LEFT JOIN "MSG_PV_Data" ON ((("LocationRecords".device_util_id)::text = ("MSG_PV_Data".util_device_id)::text))) JOIN "MeterData" ON ((("LocationRecords".device_util_id)::bpchar = "MeterData".util_device_id))), "Interval", "Reading" WHERE (("MSG_PV_Data".util_device_id IS NULL) AND ("Reading".channel = 1));
-
-
-ALTER TABLE public."deprecated_YU_energy_to_houses_without_PV_copy" OWNER TO yuma;
-
---
--- Name: deprecated_meter_ids_for_houses_without_pv_with_locations; Type: VIEW; Schema: public; Owner: postgres
---
-
-CREATE VIEW deprecated_meter_ids_for_houses_without_pv_with_locations AS
-    SELECT "LocationRecords".device_util_id, "LocationRecords".service_pt_longitude, "LocationRecords".service_pt_latitude, "LocationRecords".address1 FROM ("LocationRecords" LEFT JOIN "MSG_PV_Data" ON ((("LocationRecords".device_util_id)::text = ("MSG_PV_Data".util_device_id)::text))) WHERE ("MSG_PV_Data".util_device_id IS NULL);
-
-
-ALTER TABLE public.deprecated_meter_ids_for_houses_without_pv_with_locations OWNER TO postgres;
-
---
--- Name: VIEW deprecated_meter_ids_for_houses_without_pv_with_locations; Type: COMMENT; Schema: public; Owner: postgres
---
-
-COMMENT ON VIEW deprecated_meter_ids_for_houses_without_pv_with_locations IS '@DEPRECATED. Meter IDs for houses that do not have PV while including locations. @author Daniel Zhang (張道博)';
-
-
---
--- Name: deprecated_dz_energy_voltages_for_houses_without_pv; Type: VIEW; Schema: public; Owner: daniel
---
-
-CREATE VIEW deprecated_dz_energy_voltages_for_houses_without_pv AS
-    SELECT meter_ids_for_houses_without_pv_with_locations.device_util_id, view_readings_with_meter_id_unsorted.end_time, max(CASE WHEN (view_readings_with_meter_id_unsorted.channel = (1)::smallint) THEN view_readings_with_meter_id_unsorted.value ELSE NULL::real END) AS "Energy to House kwH", zero_to_null(max(CASE WHEN (view_readings_with_meter_id_unsorted.channel = (4)::smallint) THEN view_readings_with_meter_id_unsorted.value ELSE NULL::real END)) AS "Voltage", max(meter_ids_for_houses_without_pv_with_locations.service_pt_longitude) AS service_pt_longitude, max(meter_ids_for_houses_without_pv_with_locations.service_pt_latitude) AS service_pt_latitude, max((meter_ids_for_houses_without_pv_with_locations.address1)::text) AS address1 FROM (deprecated_meter_ids_for_houses_without_pv_with_locations meter_ids_for_houses_without_pv_with_locations JOIN readings_unfiltered view_readings_with_meter_id_unsorted ON (((meter_ids_for_houses_without_pv_with_locations.device_util_id)::bpchar = view_readings_with_meter_id_unsorted.meter_name))) WHERE ((view_readings_with_meter_id_unsorted.channel = (1)::smallint) OR (view_readings_with_meter_id_unsorted.channel = (4)::smallint)) GROUP BY meter_ids_for_houses_without_pv_with_locations.device_util_id, view_readings_with_meter_id_unsorted.end_time;
-
-
-ALTER TABLE public.deprecated_dz_energy_voltages_for_houses_without_pv OWNER TO daniel;
-
---
--- Name: VIEW deprecated_dz_energy_voltages_for_houses_without_pv; Type: COMMENT; Schema: public; Owner: daniel
---
-
-COMMENT ON VIEW deprecated_dz_energy_voltages_for_houses_without_pv IS 'Return energy and voltages for houses without PV. @author Daniel Zhang (張道博)';
-
-
---
--- Name: deprecated_get_kwh_meter_locations; Type: VIEW; Schema: public; Owner: postgres
---
-
-CREATE VIEW deprecated_get_kwh_meter_locations AS
-    SELECT "MeterData".meter_name, "MeterData".util_device_id, "MeterData".mac_id, "MeterData".meter_data_id, "Reading".value, "Reading".uom, "Reading".channel, "IntervalReadData".start_time, "IntervalReadData".end_time, "LocationRecords".service_pt_longitude, "LocationRecords".service_pt_latitude, "LocationRecords".service_pt_height, "LocationRecords".device_status FROM (((("MeterData" JOIN "IntervalReadData" ON (("MeterData".meter_data_id = "IntervalReadData".meter_data_id))) JOIN "Interval" ON (("IntervalReadData".interval_read_data_id = "Interval".interval_read_data_id))) JOIN "Reading" ON (("Interval".interval_id = "Reading".interval_id))) JOIN "LocationRecords" ON ((("LocationRecords".device_util_id)::bpchar = "MeterData".util_device_id))) WHERE ("Reading".channel < 4);
-
-
-ALTER TABLE public.deprecated_get_kwh_meter_locations OWNER TO postgres;
-
---
--- Name: deprecated_get_meter_readings_locations; Type: VIEW; Schema: public; Owner: postgres
---
-
-CREATE VIEW deprecated_get_meter_readings_locations AS
-    SELECT "MeterData".meter_name, "MeterData".util_device_id, "MeterData".mac_id, "MeterData".meter_data_id, "Reading".value, "Reading".uom, "Reading".channel, "LocationRecords".service_pt_longitude, "LocationRecords".service_pt_latitude, "Interval".end_time FROM (((("MeterData" JOIN "IntervalReadData" ON (("MeterData".meter_data_id = "IntervalReadData".meter_data_id))) JOIN "Interval" ON (("IntervalReadData".interval_read_data_id = "Interval".interval_read_data_id))) JOIN "Reading" ON (("Interval".interval_id = "Reading".interval_id))) JOIN "LocationRecords" ON (((("LocationRecords".device_util_id)::bpchar = "MeterData".util_device_id) AND (("LocationRecords".device_util_id)::bpchar = "MeterData".util_device_id)))) WHERE ("Reading".channel < 4);
-
-
-ALTER TABLE public.deprecated_get_meter_readings_locations OWNER TO postgres;
-
---
--- Name: deprecated_new_energy_readings_with_location_address; Type: VIEW; Schema: public; Owner: postgres
---
-
-CREATE VIEW deprecated_new_energy_readings_with_location_address AS
-    SELECT "LocationRecords".service_pt_latitude, "LocationRecords".service_pt_longitude, "LocationRecords".service_pt_height, "LocationRecords".device_util_id, "LocationRecords".device_serial_no, "LocationRecords".device_status, "MeterData".util_device_id, "MeterData".meter_name, "IntervalReadData".end_time, "Reading".channel, "Reading".uom, "Reading".value, "LocationRecords".address1 FROM (((("LocationRecords" JOIN "MeterData" ON (((("LocationRecords".device_util_id)::bpchar = "MeterData".util_device_id) AND (("LocationRecords".device_util_id)::bpchar = "MeterData".util_device_id)))) JOIN "IntervalReadData" ON (("MeterData".meter_data_id = "IntervalReadData".meter_data_id))) JOIN "Interval" ON (("IntervalReadData".interval_read_data_id = "Interval".interval_read_data_id))) JOIN "Reading" ON (("Interval".interval_id = "Reading".interval_id))) WHERE ("Reading".channel < 4);
-
-
-ALTER TABLE public.deprecated_new_energy_readings_with_location_address OWNER TO postgres;
-
---
--- Name: deprecated_readings_by_meter_location_history; Type: VIEW; Schema: public; Owner: daniel
---
-
-CREATE VIEW deprecated_readings_by_meter_location_history AS
-    SELECT "MeterLocationHistory".meter_name, "MeterLocationHistory".service_point_id, "MeterLocationHistory".service_point_latitude, "MeterLocationHistory".service_point_longitude, "MeterLocationHistory".location, "MeterLocationHistory".address, "MeterLocationHistory".latitude, "MeterLocationHistory".longitude, "MeterLocationHistory".installed, "MeterLocationHistory".uninstalled, "Reading".channel, "Reading".raw_value, "Reading".value, "Reading".uom, "Interval".end_time FROM (((("MeterLocationHistory" JOIN "MeterData" ON ((("MeterLocationHistory".meter_name)::bpchar = "MeterData".meter_name))) JOIN "IntervalReadData" ON (("MeterData".meter_data_id = "IntervalReadData".meter_data_id))) JOIN "Interval" ON (("IntervalReadData".interval_read_data_id = "Interval".interval_read_data_id))) JOIN "Reading" ON (((("Interval".interval_id = "Reading".interval_id) AND ("Interval".end_time >= "MeterLocationHistory".installed)) AND CASE WHEN ("MeterLocationHistory".uninstalled IS NULL) THEN true ELSE ("Interval".end_time <= "MeterLocationHistory".uninstalled) END)));
-
-
-ALTER TABLE public.deprecated_readings_by_meter_location_history OWNER TO daniel;
-
---
--- Name: VIEW deprecated_readings_by_meter_location_history; Type: COMMENT; Schema: public; Owner: daniel
---
-
-COMMENT ON VIEW deprecated_readings_by_meter_location_history IS 'Readings limited by Meter Location History. @author Daniel Zhang (張道博)';
-
-
---
 -- Name: meter_ids_for_houses_without_pv; Type: VIEW; Schema: public; Owner: postgres
 --
 

ALTER TABLE public.cd_energy_voltages_for_houses_with_pv OWNER TO eileen;

--
-- Name: count_of_event_duplicates; Type: VIEW; Schema: public; Owner: daniel
--


    house_service_point_id character varying,
    "PV_Mod_size_kW" double precision,
    inverter_model character varying,
    "size_kW" real,
    "system_cap_kW" real,
    bat character varying,
    sub character varying,
    circuit smallint,
    date_uploaded timestamp without time zone,
    has_meter smallint,
    has_separate_pv_meter smallint,
    "add_cap_kW" real,
    upgraded_total_kw real,
    street character varying,
    city character varying,
    state character varying,
    zip integer
);


