Klepac-Ceraj-Lab / VKCComputing.jl

1 stars 0 forks source link

Create machinery to treat/deal with case of empty rows on an Airtable tables #25

Open Hugemiler opened 11 months ago

Hugemiler commented 11 months ago

Sometimes, it is possible that our manual edits into Airtable end up generating a fully-blank row on tables like Subject or Aliases, etc.

Current state when parsing the local-sourced JSON file is to throw error:

[ Info: Loading records from local JSON file
ERROR: ArgumentError: collection must be non-empty
Stacktrace:
  [1] first
    @ ./abstractarray.jl:466 [inlined]
  [2] #16
    @ ~/Repos/VKCComputing.jl/src/airtable_interface.jl:146 [inlined]
  [3] iterate
    @ ./generator.jl:47 [inlined]
  [4] collect_to!(dest::Vector{Tuple{String, Int64}}, itr::Base.Generator{Base.OneTo{Int64}, VKCComputing.var"#16#19"{Vector{Airtable.AirRecord}}}, offs::Int64, st::Int64)
    @ Base ./array.jl:840
  [5] collect_to_with_first!(dest::Vector{Tuple{String, Int64}}, v1::Tuple{String, Int64}, itr::Base.Generator{Base.OneTo{Int64}, VKCComputing.var"#16#19"{Vector{Airtable.AirRecord}}}, st::Int64)
    @ Base ./array.jl:818
  [6] _collect(c::Base.OneTo{Int64}, itr::Base.Generator{Base.OneTo{Int64}, VKCComputing.var"#16#19"{Vector{Airtable.AirRecord}}}, #unused#::Base.EltypeUnknown, isz::Base.HasShape{1})
    @ Base ./array.jl:812
  [7] collect_similar(cont::Base.OneTo{Int64}, itr::Base.Generator{Base.OneTo{Int64}, VKCComputing.var"#16#19"{Vector{Airtable.AirRecord}}})
    @ Base ./array.jl:711
  [8] map(f::Function, A::Base.OneTo{Int64})
    @ Base ./abstractarray.jl:3263
  [9] localairtable(tab::VKCComputing.VKCAirtable; update::Bool)
    @ VKCComputing ~/Repos/VKCComputing.jl/src/airtable_interface.jl:145
 [10] localairtable
    @ ~/Repos/VKCComputing.jl/src/airtable_interface.jl:141 [inlined]
 [11] (::VKCComputing.var"#1#4"{Dictionaries.Dictionary{String, Bool}})(t::String)
    @ VKCComputing ./none:0
 [12] iterate
    @ ./generator.jl:47 [inlined]
 [13] collect(itr::Base.Generator{NTuple{10, String}, VKCComputing.var"#1#4"{Dictionaries.Dictionary{String, Bool}}})
    @ Base ./array.jl:782
 [14] LocalBase(update::Dictionaries.Dictionary{String, Bool})
    @ VKCComputing ~/Repos/VKCComputing.jl/src/airtable_interface.jl:77
 [15] #LocalBase#13
    @ ~/Repos/VKCComputing.jl/src/airtable_interface.jl:88 [inlined]

While running Localbase().

We need to be able to handle those cases. Maybe warn() and skip, or build a more informative error message.