1. Your own tables, no template¶
Overview
Questions
- How do I build a project and a dashboard from scratch, when no template exists for my data?
- How do I tell Depictio that each folder is one run?
- How do I use columns from two tables in one dashboard?
Objectives
- Define two data collections over three run folders in the Project Builder, preview them, create the project.
- Join the two tables on
individual_idwith Add join. - Build a dashboard of four components: a card, a figure, a table and a filter.
Before you use the command line, you build a project and a dashboard from scratch, with no template: the way you would start for a workflow that Depictio does not know yet.
The data is the Palmer Penguins of the browser course. Each field season is one run folder, just as a pipeline writes one folder per run: season_2007, season_2008 and season_2009. In each run there are two tables: physical_features.csv (the measurements) and demographic_data.csv (who each bird is, with its sex). Both carry individual_id. Together: 342 penguins.
The Project Builder reads a folder in a bucket (s3://…), not files from your laptop. The location of the penguins folder is given in the chat; below it is written s3://<workshop-bucket>/penguins.
Hands-on 1 · Step 1: the source and the project¶
- Open Projects, New project, Add data, pick 2 Custom workflows, then Open the Project Builder (or open
/projects/buildon the server). - Under Data root, paste
s3://<workshop-bucket>/penguins. If the switch This bucket needs credentials turns on, fill in the Endpoint, Access key and Secret from the chat and click Test connection. It reads Connected, then Depictio lists the folder: 3 folders, 0 files at the top. The three folders are the three runs. - Under Project, give a Project name of your own (it must be unique on the server), leave Public project off, and click Next.
Step 2: tell Depictio that each folder is a run¶
You are now on 1. Describe the workflows. A workflow is the process behind the files; here, one called main.
- Keep the Name
mainand the EnginePython. - Under How the folders are laid out, open Structure and pick Sequencing runs. Flat would treat all files as one run; Sequencing runs says that each folder under the data root is a run.
- Runs regex fills in by itself:
^season_\d{4}$, 3 of 3 are runs. The panel 3 runs taken in reads Same layout in every run, and listsdemographic_data.csvandphysical_features.csvas in every run.
Step 3: two collections, then create¶
- Open 2. Pick files. In the file tree, open
season_2007and clickphysical_features.csv: a preview shows its columns and types. The same file inseason_2008andseason_2009lights up: one scan will cover the three runs. - Keep the tag
physical_featuresand the type Table, and click Add to main. Clickdemographic_data.csv, keep the tagdemographic_data, and Add to main again. Click Review & create. - The review reads 1 workflow · 2 data collections, each a scan of 3 files. On the right, PROJECT DEFINITION shows the Project file that the builder has written (see the first Bonus).
- Click Preview the ingestion: a dry run, nothing is created. It reads 2 collections ready, with 3 files found for each. Then click Create project.
- The dialog Project created reads Ingestion completed in 0:12: 2 ingested. Click Open the project: the project page shows RUNS 3 and 2 data collections.
Step 4: join the two tables¶
Joins are usually written in the project file, and the command line makes them when it ingests. But, as in a database, you can also join two tables on the project page: the result is a new table, a view that is rebuilt whenever one of its two tables changes. The measurements are in one table and the sex in the other, so you need it.
- On the project page, in Cross-DC links, click Add join. In Create table join, the Left table is
physical_featuresand the Right table isdemographic_data. Set Join column(s) toindividual_id. - Set Join type to Inner: Keep only the rows found in both tables.
- Read the Preview before you create anything: physical_features: 342 rows · demographic_data: 342 rows → joined: 342 rows · 12 columns. A yellow note says that
species,islandandyearare in both tables: the copies fromdemographic_dataare kept asspecies_right,island_rightandyear_right. - Click Create join. The Joins table lists it (inner, 342 rows) and the project has a third collection:
joined_physical_features_demographic_data.
Inner or left? Here they give the same 342 rows (all four join types give 342), because every bird is in both tables. They differ only when a bird is missing from the right table: a left join keeps it, with empty demographic values; an inner join drops it. Inner is the simplest choice for this exercise.
Step 5: a dashboard with four components¶
- Click Create a dashboard at the top of the project page. New Dashboard opens with the project already chosen: type a title (for example
Penguins study) and click Create Dashboard. You stay on the Dashboards list: click your new dashboard to open it. -
Click Start editing, then the + button. Pick Component, then Manual. For each component below, click its type tile, open the list under Data Source, pick
joined_physical_features_demographic_data, click Next Step, set the options, then click Create component. Add the four, then click Save.Type Options Card Card title Penguins; Select your columnindividual_id. Leave the aggregation as it is: it fills in Count.Figure Visualization type Scatter Plot; X axis flipper_length_mm; Y axisbody_mass_g; Color bysex.Table Nothing to set. Interactive Select your column species. -
In the left panel Filters, Select on species now filters the three other components.
The figure uses flipper_length_mm and body_mass_g from physical_features and sex from demographic_data: without the join, one figure could not use both. The card reads 342; the table reads 1 to 100 of 342 (4 pages).
Check your understanding
The join is an Inner join and gives 342 rows. What would a Left join give here, and when would the two differ? Where does the column species_right come from?
Answer
Also 342 rows: every bird of physical_features has a row in demographic_data. They differ when a bird is missing from the right table: a left join keeps it with empty demographic values, an inner join drops it. species_right is the copy of species from demographic_data, renamed because physical_features has a species column too.
Challenge: the Chinstrap penguins
In the Filters panel, open Select on species and pick Chinstrap. How many Chinstrap penguins are there? On which island? Then pick Gentoo instead: how many?
Key points
- The Project Builder reads a folder in a bucket and lets you say what each file is, without a template.
- Sequencing runs tells it that each folder is a run, as a pipeline would write one folder per run.
- One scan over the runs makes one collection with the rows of every run.
- Preview the ingestion is a dry run: nothing is created until Create project.
- A join on the project page makes a new table from two tables on a shared column; its preview counts the rows before anything is created.
- A dashboard component reads one collection: the joined table lets a figure use columns from both tables.
Bonus · Read the project file the builder wrote
In the review step of Step 3, PROJECT DEFINITION shows the Project file: your project, written for you (Download YAML saves it). Here it is for the three seasons:
name: <your-project-name> # [[1]]
is_public: false # [[1]]
workflows:
- name: main
engine:
name: python
data_location:
structure: sequencing-runs # [[2]]
locations:
- s3://<workshop-bucket>/penguins # [[2]]
runs_regex: ^season_\d{4}$ # [[2]]
data_collections:
- data_collection_tag: physical_features # [[3]]
config:
type: Table # [[3]]
metatype: Aggregate # [[3]]
scan:
mode: s3_prefix # [[3]]
scan_parameters:
prefix: s3://<workshop-bucket>/penguins/
pattern: ^(?:[^/]+/)*physical_features\.csv$ # [[3]]
pattern_syntax: regex
dc_specific_properties:
format: csv
Exercise. (a) Which lines make the three season folders three runs? (b) How does a collection find its file in every run? (c) In the review, click Template (any folder): which lines change?
Solution
- The project (band 1): its name and the visibility you left off.
- (a) The runs (band 2):
structure: sequencing-runsandruns_regex: ^season_\d{4}$are what you set in Step 2; the location is the data root of Step 1. - (b) A collection (band 3): its tag,
Table,Aggregate(the rows of every run add up in one table), and a scan of the bucket prefix. The regular expression^(?:[^/]+/)*physical_features\.csv$accepts the file at any depth, so it matchesseason_2007/physical_features.csvand the same file in the two other seasons. The file holds one such block fordemographic_datatoo.
(c) The Template (any folder) switch shows the same project as a template: a template: block on top with a DATA_ROOT variable, '{DATA_ROOT}' in place of the location, and mode: recursive with no prefix. Run it on any folder with the same layout: depictio ingest <folder> --template <file>.
Bonus · A second figure: compare the islands
On the same dashboard, click the pencil, then add a Figure on joined_physical_features_demographic_data. Choose Box Plot, X axis island, Y axis body_mass_g, Color by species. Which species live on which island? Which species is the heaviest?









