# Get started with Topos

From an empty Topos to a table with data in it and a first decision, step by step.

This page takes you from an empty Topos to a table with data and a first decision. Steps 1 to 4 need the **Owner** role. Everyone can follow along by reading.

## Before you start

- Mestra Topos must be on for your organisation. See the [overview](https://withmestra.com/docs/topos/).
- For the decision in step 6, you need a campaign with dynamic variants and approved rules. See [Dynamic variants](https://withmestra.com/docs/how-to/dynamic-variants/).

## 1. Open Topos

Open `topos.withmestra.com`, or choose **Mestra Topos** in the app switcher. A new organisation sees **Start here** with three steps. Select **Upload a file** to start.

## 2. Upload a file

Make a CSV file called `menu.csv` with a header row:

```csv
item,price,available
Flat white,4.50,true
Cheese scone,5.95,true
Long black,4.00,false
```

1. On the **Data** page, select **Upload a file**.
2. In step 1 of 3, drop `menu.csv` on the drop zone or choose it. Mestra reads it and shows its columns.
3. In step 2 of 3, check what Mestra read. Enter a **Dataset name**, such as `Menu`. The **Dataset key** fills in as `menu`. You can change the key. It must start with a lower-case letter.
4. Look at each column. **Keep** is ticked, and the type is guessed: `item` is **Text**, `price` is **Number**, `available` is **True/false**. Choose the key column, here `item`, so each row is identified by its item name. With **No key: use the row number**, a row is identified by its place in the file.
5. Under **When the file is uploaded again**, choose **Add and update** or **Replace everything**. The choice is kept with the connector. See [Upload a file](https://withmestra.com/docs/topos/upload-a-file/).
6. Select **Create dataset**.

Step 3 of 3 shows what happened: **Applied**, **Unchanged**, **Gone** and **Refused**. For this file it shows 3 applied and 0 refused. Select **Done**.

Money is different. If a column holds prices, set its type to **Money**, enter a three-letter currency such as `AUD`, and make the cells whole cents: `450`, not `4.50`. A cell with a decimal in a money column is refused. See [Tables](https://withmestra.com/docs/topos/tables/#column-types).

## 3. Look at the table

Select **Menu** on the **Data** page. The table viewer shows the rows. Select a row to see it in full. Use **Filters**, **Sort** and **Columns** to change the view. See [Tables](https://withmestra.com/docs/topos/tables/#the-table-viewer).

## 4. Keep it up to date

A file upload makes a table and a connector of the same name, and it reads the file once. The Topos pages don't offer a way to upload a later file into the same table. To keep a table up to date, add a connector that brings data in on its own:

- Your system sends data to Mestra: [Send data to Mestra](https://withmestra.com/docs/topos/send-data/).
- Mestra fetches a web address every so often: [Fetch data on a schedule](https://withmestra.com/docs/topos/fetch-data/).

On the **Ingest** page, select **Add a connector** and follow the five steps: **Type**, **Connector**, **Configure**, **Test** and **Save and schedule**. See [Connectors](https://withmestra.com/docs/topos/connectors/#add-a-connector).

## 5. Check that it works

Open the connector. **Past runs** lists every run with its outcome and how many rows it brought in. **What has landed** lists each payload that arrived. A connector that works shows **Healthy** on the **Ingest** page. See [Runs, history and replay](https://withmestra.com/docs/topos/runs-and-replay/).

## 6. Write a first decision

A decision chooses which variant of a campaign a screen shows. You can start with one that always shows the default variant, and then change it.

1. Open **Decisions** and select **New decision**.

2. Enter a **Key**, such as `morning`, and a **Name**. Choose the **Campaign**. A decision stays with its campaign.

3. The editor starts with:

   ```python
   def decide(ctx):
       # Choose a row with show(row_id, "why"). ctx.default is the default row.
       return show(ctx.default, "the default")
   ```

4. Change it to show a variant on weekday mornings. Replace `breakfast` with the id of one of your campaign's variants:

   ```python
   def decide(ctx):
       if in_window(ctx.time, "06:00-11:00") and in_days(ctx.day, "mon,tue,wed,thu,fri"):
           return show("breakfast", "Weekday morning")
       return show(ctx.default, "Default")
   ```

5. Select **Save**. Mestra says "Saved as version 1." A saved version isn't live yet.

6. Under **Test**, optionally choose a **Screen** and a **Time**, and select **Run test**. Mestra shows the **Row chosen**, the reasons, and what the decision saw.

7. Under **Versions**, select **Make live** on version 1, and confirm. Screens follow it from now on.

To stop, select **Take down** on the live version. Screens go back to the table. See [Test, go live and read the log](https://withmestra.com/docs/topos/decision-live/).

## Next

- [Tables](https://withmestra.com/docs/topos/tables/)
- [The decision language](https://withmestra.com/docs/topos/decision-language/)
- [Errors and refusals](https://withmestra.com/docs/topos/troubleshooting/)
