Describe the submission
A submission gathers data of a node and the description a repository expects of them. Each repository has its own fields: madbot fills them with what it already knows (your name, the title, the description of the node), and madbot-cli fields gives the ones left to fill, in the format of the file.
-
Give your token of the demo of Recherche Data Gouv, in the terminal, as
madbot-cli plugins recherche_data_gouvshowed:Fenêtre de terminal export RECHERCHE_DATA_GOUV_CREDENTIALS='{"token": "<your token of the demo>"}'The token never goes in the file: the file only names the variable that holds it. So you can version the file, or have your platform write it, without leaving a secret in it.
-
Add the submission to the node, with the block given by
plugins, filled for the demo:depot.yaml version: 1workspace: madbot CLI workshopsources:zenodo:plugin: zenodoshared_params:url: https://zenodo.org/nodes:- title: Stream water qualitydescription: A year of water quality measurements in a stream, read on Zenodo.data:- source: zenodobrowse:path: [24343971]names: [README.md, stations.csv, mesures.csv]submissions:- title: Stream water qualityrepository:plugin: recherche_data_gouvshared_params:url: https://demo.recherche.data.gouv.frcredentials_env: RECHERCHE_DATA_GOUV_CREDENTIALSsettings:target_collection: tpmetadata_language: enaccess_condition: {"access_condition": "open", "license": {"name": "etalab 2.0", "uri": "https://spdx.org/licenses/etalab-2.0.html"}}data:all: trueurl: the demo, not the production repository;target_collection: the Travaux Pratiques collection of the demo, whose alias istp;access_condition: the Open form with the etalab 2.0 license, copied from theas:line underaccess_condition, in the output ofmadbot-cli plugins recherche_data_gouv;data: all: true: the submission takes every data of the node.
-
Create the submission:
Fenêtre de terminal madbot-cli plan depot.yamlmadbot-cli apply depot.yamlapplycreates the submission, adds the three data to it, then madbot prepares the metadata the repository expects. The submission stays a draft: mandatory values are missing, andapplytells which command gives them.Done: 4 changes, 0 failures, 0 submissions sent.node 'Stream water quality': 3 data readsubmission 'Stream water quality': draft, 3 mandatory values missingNext:madbot-cli fields depot.yaml 'Stream water quality' --level mandatorywrites the 3 values missing, to fill in the file -
Read the mandatory fields:
Fenêtre de terminal madbot-cli fields depot.yaml "Stream water quality" --level mandatorymetadata:general:recherche_data_gouv__general__author: [{"name": "Formation, Camille"}] # mandatory: Authorrecherche_data_gouv__general__contact: "" # mandatory: Point of contactrecherche_data_gouv__general__ds_description: [{"value": "A year of water quality measurements in a stream, read on Zenodo."}] # mandatory: Descriptionrecherche_data_gouv__general__kind_of_data: # mandatory: Data typekind_of_data: "" # required, a listother_kind_of_data: "" # a textrecherche_data_gouv__general__subject: "" # mandatory: Subjectrecherche_data_gouv__general__title: "Stream water quality" # mandatory: Titlemadbot already filled the author (your name, from your profile), the description (the one of the node) and the title (the one of the submission). Left empty: the point of contact, the data type and the subject.
-
Find out what a field accepts, before filling it:
Fenêtre de terminal madbot-cli field recherche_data_gouv__general__contactmadbot-cli field recherche_data_gouv__general__kind_of_datamadbot-cli field recherche_data_gouv__general__subject --search earthEach command gives the form of the value (a text, a list, an object of several parts), the allowed values, then an example to paste.
--searchfilters a long list of values. -
Fill the three fields in the file, under the submission, after
data:depot.yaml data:all: truemetadata:general:recherche_data_gouv__general__contact:- name: Formation, Camilleaffiliation: IFBemail: camille.formation@example.orgrecherche_data_gouv__general__kind_of_data:kind_of_data: [Dataset]recherche_data_gouv__general__subject: [Earth and Environmental Sciences]Put your name, your institution and your address in the contact. No need to copy the fields madbot already filled: a value missing from the file clears nothing.
Optional The object types of a submission
general is an object type of Recherche Data Gouv: a dataset has only one. Other repositories have several: at the ENA, a study, samples and reads. Values written under a type apply to all its objects; a value specific to one object is written under by_alias, under the name of that object. fields puts each value in the right place.
Optional What the command does, on the API side
apply creates the submission (POST /api/submissions), adds the data to it (POST /api/submissions/{id}/data), then asks madbot to prepare its metadata (POST /api/submissions/{id}/actions with generate_metadata). fields reads the objects so prepared and their values (GET /api/submissions/{id}/metadata_objects), and the definition of the fields (GET /api/metadata_fields). The values of the file are then written object by object, on …/metadata_objects/{id}/metadata.
Checkpoint
Section titled “Checkpoint”If you are stuck
Section titled “If you are stuck”- “! no credentials: set RECHERCHE_DATA_GOUV_CREDENTIALS”: the variable is not set in this terminal. Run the
exportof step 1 again, with single quotes around the JSON. - The token of the demo is refused: it must be the one of the demo instance, created once signed in on demo.recherche.data.gouv.fr, API Token page. A token of the production repository does not work on the demo.
- A
<…>value pasted as is, such as<Data Type>: the example offieldleaves each value to choose that way. Replace it with one of the values it lists, hereDataset. Leaveother_kind_of_dataaside: it only goes with Other. - “The file gives values madbot would refuse; nothing was written”:
planlists each refused value, with the path of the field in the file, then the command that explains what it accepts. Nothing is written as long as a value is refused.- “is not an allowed value; closest: …”: the value is not in the list of the field. Take one of the values offered, to the letter.
- “the repository … has no field ‘…’; closest: …”: the slug is copied wrong. Take the slug offered, or copy it from the output of
fields. - The form does not fit: a list is written between brackets (
[Dataset]) or as lines starting with-; an object, with its parts indented.madbot-cli field <slug>gives an example.
- “‘metadata’ is not expected here”: the
metadatakey goes under the submission, at the same level asrepositoryanddata, not under the node. applydoes not create the submission and says “left for the next apply”: a data of the node is not read yet. Runapplyagain a minute later.

