This article shows you how to load additional data columns into your TRC sheets. TRC calls additional data columns “semantics”. This article explains the concepts behind semantics and how to upload them in TRC.
Format for semantics
Semantics are CSV files. This is a universal format and makes it easy to generate from other tools.
They’re either 1 or 2 columns. The first column is always the primary key and used to merge in with the “RecId” of the target sheet.
A semantic can be a 2-column CSV file where the first column is the primary key and second column is data:
If a semantic is truly Boolean (“who voted in an election”), you can compress it to a single column of just the ‘active’ RecIds. This can be easy for other tools to generate and reduces upload size.
Merging into your sheets
Once you’ve uploaded a semantic to the server, you can merge it into any of your TRC sheets. TRC will merge based on the primary key column (“RecIds”). The order of columns doesn’t matter.
For example, suppose you had a sheet,S1, with 3 rows (R1,R2,R3). And you had additional data specifying scores for those recIds. You could then add that semantic to the sheet as addititional column, and TRC would merge it in like so:
You could add the semantic to the sheet and get a new column, “Scores”, with values from the semantics. Since R3 is not in the semantic, it is left blank.
Conceptually, you can think of a semantic merge like Excel’s VLookup function.
You can store “Scores” as a CSV on your Dropbox and refresh it at will. TRC can then pull the updates and refresh your sheet with updated scores. You can merge in multiple semantics and use semantics in filtering and tagging.
Sharing and Security
Semantics are stored and merged on the server.
Generally, each TRC user gets their own directory to store their semantics to avoid conflicting with other users. For example, if you’re user “TU_123” and you upload a semantic named “Scores”, it may get a fully-qualified name (fqn) “users/tu_123/scores”. Then if multiple users both have the same name, the fqn won’t conflict.
You can also share your semantics with others. For example, you may have a microtargeting model for voters, upload that as a semantic, and then share out with a group of candidates using TRC. You might compute the model statewide and have 4 million rows in it; whereas each candidate is only pulling the 80,000 rows that overlap their district. Furthermore, during the final few weeks of the election, you may be recomputing that model daily and pushing out updated models to your field staff daily. TRC sheets can be refreshed daily.
Using the DataUploader plugin
You can upload additional data (semantics) via the “DataUploader” plugin, which you can find on the plugin menu. It looks like this:
The “upload” section lets you select a CSV file from Dropbox (see format above) and upload it to TRC. This means your can create the CSV locally using your own tools, write to dropbox via your local file system, and then easily share with TRC. You can update the file and refresh them.
The middle section shows you a) the list of semantics you have access to. If you want to add them to the current sheet, check the box next to the semantic and click “add to sheet”.