VKCComputing.jl
Documentation for VKCComputing.
VKCComputing.LocalAirtable
VKCComputing.LocalBase
VKCComputing.VKCAirtable
VKCComputing.set_airtable_dir!
VKCComputing.set_default_preferences!
VKCComputing.set_readonly_pat!
VKCComputing.set_readwrite_pat!
VKCComputing.vkcairtable
Setup environment
VKCComputing.set_default_preferences!
— FunctionTODO:
- set airtable dir using call to scratch drivbe with user name
- throw warnings if any of the directories don't exist
VKCComputing.set_airtable_dir!
— Functionset_airtable_dir!(key)
Sets local preferences for airtable_dir
to key
(defaults to the environmental variable "AIRTABLE_DIR"
if set).
VKCComputing.set_readonly_pat!
— Functionset_readonly_pat!(key)
Sets local preferences for readonly_pat
to key
(defaults to the environmental variable "AIRTABLE_KEY"
if set).
VKCComputing.set_readwrite_pat!
— Functionset_readwrite_pat!(key)
Sets local preferences for readwrite_pat
to key
(defaults to the environmental variable "AIRTABLE_RW_KEY"
if set).
Interacting with Airtable
VKCComputing.VKCAirtable
— TypeVKCAirtable(base, name, localpath)
Connecting Airtable tables with local instances. Generally, use vkcairtable
to create.
VKCComputing.LocalAirtable
— TypeLocalAirtable(table, data, uididx)
Primary data structure for interacting with airtable-based data.
VKCComputing.LocalBase
— TypeLocalBase(; update=Month(1))
Load the airtable sample database into memory. Requires that an airtable key with read access and a directory for storing local files are set to preferences. (see set_readonly_pat!
and set_airtable_dir!
.
Updating local base files
The update
keyword argument can take a number of different forms.
- A boolean value, which will cause updates to all tables if
true
, and no tables iffalse
. - An
AbstractTime
fromDates
(egWeek(1)
), which will update any table whose local copy was last updated longer ago than this value. - A vector of
Pair
s of the form"$table_name"=> x
, wherex
is either of the options from (1) or (2) above.
For example, to update the "Biospecimens" table if it's older than a week, and to update the "Projects" table no matter what, call
julia> using VKCComputing, Dates
julia> base = LocalBase(; update=["Biospecimens"=> Week(1), "Projects"=> true]);
Indexing
Indexing into the local base can be done either with the name of a table (eg base["Biospecimens"]
), which will return a VKCAirtable
, or using a record ID hash (eg base["recUqEcu3pM8p2jzQ"]
).
Note that record ID hashes are identified based on the regular expression r"^rec[A-Za-z0-9]{14}$"
- that is, a string starting with "rec"
, followed by exactly 14 alphanumeric characters. In principle, one could name a table as something that matches this regular expression, causing it to be improperly identified as a record hash rather than a table name.
VCKAirtable
s can also be indexed with the uid
column string, so an individual record can be accessed using eg base["Projects"]["khula"]
, but a 2-argument indexing option is provided for convenience, eg base["Projects", "khula"]
.
VKCComputing.vkcairtable
— Functionvkcairtable(name::String)
Returns a VKCAirtable type based on the table name. Requires that the local preference airtable_dir
is set. See VKCComputing.set_preferences!.