Skip to content
Snippets Groups Projects
Commit 1e106c45 authored by Riccardo Boero's avatar Riccardo Boero :innocent:
Browse files

Added management of missing data in all employment data queries

parent 93571b74
No related branches found
No related tags found
No related merge requests found
...@@ -139,9 +139,9 @@ function eu_lfs(conn::MySQL.Connection, selection::Dict) ...@@ -139,9 +139,9 @@ function eu_lfs(conn::MySQL.Connection, selection::Dict)
# execute # execute
result = query_connection(conn, query) result = query_connection(conn, query)
if !("industry" in names(result)) if !("industry" in names(result))
println("No data returned for query with GeoID = $id and Year = $year.") println("No data returned for query with GeoID = $id and Year = $year.")
# Initialize `result` with the expected columns but no rows # Initialize `result` with the expected columns but no rows
#result = DataFrame(industry = String[], jobs = Float64[], geo_id = String[], agg_level = Int[]) result = DataFrame(industry = String[], jobs = Float64[], geo_id = String[], agg_level = Int[])
end end
# add geo_id col # add geo_id col
result[!, :geo_id] = fill(id, nrow(result)) result[!, :geo_id] = fill(id, nrow(result))
...@@ -178,6 +178,11 @@ function eu_sbs(conn::MySQL.Connection, selection::Dict) ...@@ -178,6 +178,11 @@ function eu_sbs(conn::MySQL.Connection, selection::Dict)
query = "SELECT Nace as industry, Employment as jobs FROM SBS WHERE Year = "*string(year)*" AND GeoID = '"*id*"';" query = "SELECT Nace as industry, Employment as jobs FROM SBS WHERE Year = "*string(year)*" AND GeoID = '"*id*"';"
# execute # execute
result = query_connection(conn, query) result = query_connection(conn, query)
if !("industry" in names(result))
println("No data returned for query with GeoID = $id and Year = $year.")
# Initialize `result` with the expected columns but no rows
result = DataFrame(industry = String[], jobs = Float64[], geo_id = String[], agg_level = Int[])
end
# add geo_id col # add geo_id col
result[!, :geo_id] = fill(id, nrow(result)) result[!, :geo_id] = fill(id, nrow(result))
# add agg level # add agg level
...@@ -213,6 +218,11 @@ function eu_rea(conn::MySQL.Connection, selection::Dict) ...@@ -213,6 +218,11 @@ function eu_rea(conn::MySQL.Connection, selection::Dict)
query = "SELECT Nace as industry, EmpTh*1000 as jobs FROM REA WHERE Year = "*string(year)*" AND GeoID = '"*id*"';" query = "SELECT Nace as industry, EmpTh*1000 as jobs FROM REA WHERE Year = "*string(year)*" AND GeoID = '"*id*"';"
# execute # execute
result = query_connection(conn, query) result = query_connection(conn, query)
if !("industry" in names(result))
println("No data returned for query with GeoID = $id and Year = $year.")
# Initialize `result` with the expected columns but no rows
result = DataFrame(industry = String[], jobs = Float64[], geo_id = String[], agg_level = Int[])
end
# add geo_id col # add geo_id col
result[!, :geo_id] = fill(id, nrow(result)) result[!, :geo_id] = fill(id, nrow(result))
# add agg level # add agg level
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment