From 27236e6070e3fb54c352e80a9d64e3ccf76530e1 Mon Sep 17 00:00:00 2001 From: Riccardo Boero <ribo@nilu.no> Date: Tue, 2 Apr 2024 12:43:44 +0200 Subject: [PATCH] Fixed jobs for states and Hawaai unreachable by road. --- src/FACT_jobs.jl | 9 ++++++++- src/FACT_road.jl | 12 ++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/FACT_jobs.jl b/src/FACT_jobs.jl index 22cf334..da921e5 100644 --- a/src/FACT_jobs.jl +++ b/src/FACT_jobs.jl @@ -88,8 +88,15 @@ function us_qcew(conn::MySQL.Connection, selection::Dict) end # infer Agglvl_code -- because of Agglvl_code codification: agglvl_code += (agg_level+2) + # fix id for states + if length(id) == 2 + full_id = string(id, "000") + else + full_id = id + end + # prepare query - query = "SELECT Naics as industry, (Jan_jobs+Feb_jobs+Mar_jobs+Apr_jobs+May_jobs+Jun_jobs+Jul_jobs+Aug_jobs+Sep_jobs+Oct_jobs+Nov_jobs+Dec_jobs)/12 as jobs FROM QCEW WHERE Year = "*string(year)*" AND GeoID = '"*id*"' AND Agglvl_code = "*string(agglvl_code)*";" + query = "SELECT Naics as industry, (Jan_jobs+Feb_jobs+Mar_jobs+Apr_jobs+May_jobs+Jun_jobs+Jul_jobs+Aug_jobs+Sep_jobs+Oct_jobs+Nov_jobs+Dec_jobs)/12 as jobs FROM QCEW WHERE Year = "*string(year)*" AND GeoID = '"*full_id*"' AND Agglvl_code = "*string(agglvl_code)*";" # execute result = query_connection(conn, query) # add geo_id col diff --git a/src/FACT_road.jl b/src/FACT_road.jl index d9bbf22..e850f9f 100644 --- a/src/FACT_road.jl +++ b/src/FACT_road.jl @@ -27,6 +27,18 @@ function travel_time_in_minutes(ws_host_port::String, selection::Dict) # getting valuable info from dictionary geo_id = selection["geo_id"] shape_obj = selection["shape_obj"] + + # filter out Hawaii + # Convert geo_id to integers + geo_id_int = parse.(Int, geo_id) + + # Apply the range condition + condition = (geo_id_int .>= 15000) .& (geo_id_int .< 16000) + + # Overwrite the original arrays with the filtered results + geo_id = geo_id[.!condition] + shape_obj = shape_obj[.!condition] + # Arrays to store column data o_geo_ids = String[] d_geo_ids = String[] -- GitLab