Skip to content

Connect the source

Everything madbot-cli creates starts from a deposit file, in YAML: you describe in it what you want to find in madbot, and madbot-cli puts it there. It holds the objects of the interface:

  • the workspace;
  • the sources: where the data come from, each declared once under a name of your choice;
  • the nodes: the parts of the project, each with its data. madbot links them to their source with datalinks, without copying them.
  1. Create the file depot.yaml in a working folder, with this content:

    depot.yaml
    version: 1
    workspace: madbot CLI workshop
    sources:
    zenodo:
    plugin: zenodo
    shared_params:
    url: https://zenodo.org/
    nodes:
    - title: Stream water quality
    description: A year of water quality measurements in a stream, read on Zenodo.

    The source is called zenodo in this file; it uses the zenodo plugin on the server https://zenodo.org/, as madbot-cli plugins zenodo showed. It has no credentials_env: without credentials, madbot reads public records.

  2. Find the dataset on Zenodo, by its DOI. The first time, --connect creates the workspace and connects your account to the source; it says what it created, and writes nothing else:

    Fenêtre de terminal
    madbot-cli browse depot.yaml zenodo --search "10.5281/zenodo.24343971" --connect
    created workspace 'madbot CLI workshop'
    connected source zenodo, without credentials: public data only
    source zenodo, search '10.5281/zenodo.24343971' in the whole source: 1 result:
    madbot introduction workshop – synthetic water quality measurements of a headwater stream, 2025/ 24343971

    The last column gives the identifier of the record in the source: 24343971. The next commands no longer need --connect.

  3. Open the record by this identifier, to see its files:

    Fenêtre de terminal
    madbot-cli browse depot.yaml zenodo 24343971
    source zenodo, 24343971:
    README.md 24343971/README.md
    dictionnaire.csv 24343971/dictionnaire.csv
    mesures.csv 24343971/mesures.csv
    stations.csv 24343971/stations.csv

    Each line gives the name of a file, then its external_id, the identifier madbot will know it by. The files of the record have French names.

  4. Link three files to the node. Add a data key to the node, at the end of the file:

    depot.yaml
    version: 1
    workspace: madbot CLI workshop
    sources:
    zenodo:
    plugin: zenodo
    shared_params:
    url: https://zenodo.org/
    nodes:
    - title: Stream water quality
    description: A year of water quality measurements in a stream, read on Zenodo.
    data:
    - source: zenodo
    browse:
    path: [24343971]
    names: [README.md, stations.csv, mesures.csv]

    The entry says: in the zenodo source, open the record 24343971 (path), and take these three files there (names). The fourth one, dictionnaire.csv, is for the optional block.

Optional Three ways to name a data

A data entry names its files in one of these ways:

Entry Takes
external_id: 24343971/README.md this file, as browse gives its identifier
browse with path and names the files of a folder, named one by one
browse with path and match: "*.csv" the files of a folder whose name matches a pattern

The external_id is the form a platform writes most easily, when it knows where it stored its files. Its form depends on the plugin: an absolute path on a file server, <record>/<file> on Zenodo.

Optional What the command does, on the API side

browse --search calls GET /api/connections/{id}/external_data/search?q=…, and opening a folder GET /api/connections/{id}/external_data?parent=…, as the data selection window of the interface does. This needs a connection of your account to the source, in the workspace: --connect creates it (POST /api/connections), without credentials for public data, and the workspace with it if it does not exist (POST /api/workspaces).

  • “The account is not connected to the source ‘zenodo’ in madbot yet”: add --connect to the browse command, once.
  • “No ‘…’ in the root of the source. It is empty”: a public record is not listed from the root of Zenodo, it opens by its identifier. Check the identifier, 24343971, or find it again with --search.
  • “No source ‘…’ in depot.yaml”: the name after depot.yaml is the one of the source in your file (the key under sources), not the name of the plugin. Here, zenodo.
  • A path written 24343971/README.md in browse: each element of the path is an argument of its own. browse depot.yaml zenodo 24343971 opens the record; an external_id is only written in the file.
  • “not valid YAML or JSON”, with a line and a column number: an indentation error. YAML counts spaces. data lines up with title, and each - source is indented under data. Do not use tabs.
  • “a data entry takes one of these forms … here: source, path, names”: path and names are written straight under - source, without the browse: key that holds them. Add browse: and indent them under it.
  • “rate limited” or a wait: the room saturates the Zenodo search. Wait a minute, or go on to step 3 with the identifier 24343971.