You can add data from JSON, CSV and TSV files.
Items can be very simple - all that is required is a text
value.
A text
column or key is required.
So the simplest thing to load is a csv that looks like this:
Text |
---|
Apple |
Orange |
Pear |
Banana |
Here is an excerpt of the tsv that was loaded in for the priority example:
text | category | priority | website | logo |
---|---|---|---|---|
All City | Frame manufacturer | 100 | http://allcitycycles.com | https://files.bikeindex.org/uploads/Ma/371/all-city.png |
Salsa | Frame manufacturer | 250 | http://salsacycles.com/ | |
Sunday | Frame manufacturer | 10 | http://www.sundaybikes.com | |
SRAM | Manufacturer | 250 | http://www.sram.com | |
Surly | Frame manufacturer | 500 | http://surlybikes.com |
A result from sh-example-priority.herokuapp.com, the place where the above data is loaded, looks like:
{
"text": "Surly",
"category":"Frame manufacturer",
"website":"http://surlybikes.com",
"logo":null
}
Soulheart uses line delineated JSON streams, so it doesn’t have to load the whole file into memory. Which just means - put each object onto a seperate line.
Here is the above example as a json stream:
{"text": "All City", "category": "Frame manufacturer", "priority": 100, "website": "http://allcitycycles.com", "logo": "https://files.bikeindex.org/uploads/Ma/371/all-city.png"}
{"text": "Salsa", "category": "Frame manufacturer", "priority": 250, "website": "http://salsacycles.com/"}
{"text": "Sunday", "category": "Frame manufacturer", "priority": 10, "website": "http://www.sundaybikes.com"}
{"text": "SRAM", "category": "Manufacturer", "priority": 250, "website": "http://www.sram.com" }
{"text": "Surly", "category": "Frame manufacturer", "priority": 500, "website": "http://surlybikes.com"}
You can also include aliases in the data you load. Soulheart will match across those aliases.
For example, some people incorrectly refer to bicycle stems as “Goose neck” or “handlebar clamp”. In the categories demo if you enter “goose neck” or “handlebar clam” you will see “stem” as an option.
Aliases are an array, so when loading an .json
, make them an array:
{"text":"stem","category":"Component Types", "aliases": ["Goose neck", "handlebar clamp"]}
If you’re loading data with a .tsv
, separate them with commas:
text | category | aliases |
---|---|---|
stem | Component Types | Goose neck, handlebar clamp |