API#

The FAIR Data Station also has API functionality. Currently this includes metadata management, validation, as well as looking up terms. You can find several API calls on the FAIR Data Station itself, which you can try out yourself. To use the same functionality within this tutorial, boot up your own instance of the FAIR Data Station.

Validator#

To validate a filled in Excel file you can use the following command (you can download an example file here, and adjust the command path to your system):

curl -X POST http://localhost:8083/api/upload \
  -F "file=@/c/Users/path/to/ValidationDemo.xlsx"

This example uses Bash, but the API can be called from any language that supports HTTP requests.

It returns either an RDF file (on success) or a validation error message.

The value "missing" of "collection date" in the "Sample" sheet  does not match the pattern of {date} regex (\d{4}-\d{2}-\d{2}(?:\s*T?\s*(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d)?|unknown|restricted access) such as in example "2018-05-14 00:00:00"

Terms#

To retrieve all terms that are used in the FAIR Data Station you can use the following command:

curl http://localhost:8083/api/terms    

This will return a JSON response with all the terms that are used in the FAIR Data Station.

{
  "total": 893,
  "terms": {
    "plant body site": {
      "label": "plant body site",
      "syntax": null,
      "example": null,
      "preferredUnit": null,
      "definition": "name of body site that the sample was obtained from. For Plant Ontology (PO) (v 20) terms, see http://purl.bioontology.org/ontology/PO",
      "ontology": null,
      "regex": ".*",
      "file": false,
      "date": false,
      "dateTime": false,
      "url": "http://fairbydesign.nl/ontology/plant_body_site"
    },
    "study title": {
      "label": "study title",
      "syntax": "{text}{10,}",
      "example": "Cultivation and characterization of anaerobic Dehalobacter-enriched microbial cultures that dechlorinate monochlorobenzene to benzene ",
      "preferredUnit": null,
      "definition": "Title describing the study",
      "ontology": null,
      "regex": ".*{10,}",
      "file": false,
      "date": false,
      "dateTime": false,
      "url": "http://schema.org/title"
    },
    ...
  }
}

Packages#

The FAIR Data Station is built using several packages. These packages are constantly being developed and added. To get an overview of the current packages used in your local FAIR Data Station you can use the following command:

curl http://localhost:8083/api/package

This will return a JSON file with all the packages that are used in the FAIR Data Station.

{"message":"No package name specified. Available packages listed below.","packages":["ENA Tara Oceans","Amplicon library","human oral","COMPARE-ECDC-EFSA pilot food-associated reporting standard","ENA virus pathogen reporting standard checklist","pig_faeces","Tree of Life Checklist","pig","ENA Marine Microalgae Checklist","Amplicon demultiplexed","Crop Plant sample enhanced annotation checklist","human vaginal","Nanopore","pig_histology","Plant Sample Checklist","2 ENA Global Microbial Identifier Proficiency Test (GMI PT) checklist","Illumina","human associated","unlock","pig_blood","water","sediment","human gut","microbial mat biolfilm","miscellaneous natural or artificial environment","person","LS454","ENA parasite sample checklist","ENA binned metagenome","wastewater sludge","ENA sewage checklist","GSC MIUVIGS","ENA mutagenesis by carcinogen treatment checklist","PacBio","ENA Micro B3","Metabolomics","built environment","ENA Global Microbial Identifier reporting standard checklist GMI_MDM:1.1","soil","air","COMPARE-ECDC-EFSA pilot human-associated reporting standard","host associated","default","ENA prokaryotic pathogen minimal sample checklist","HoloFood Checklist","GSC MIMAGS","pig_health","plant associated","PDX Checklist","UniEuk_EukBank","GSC MISAGS","ENA Shellfish Checklist","miappe","Proteomics","human skin","ENA default sample checklist","Genome","ENA Influenza virus reporting standard checklist","MIFE"],"example":"/api/package?name=soil"}

To retrieve a specific package, add the package name to the API call, see the following command:

curl -X GET "http://localhost:8083/api/package?name=pig_health"

This will output the metadata of the specific package in JSON format:

{"metadata":[{"definition":null,"level":"Sample","packageName":"pig_health","requirement":"MANDATORY","label":"health score","term":{"label":"health score","syntax":"(0|1|2)","example":"2","preferredUnit":"","definition":"Health condition: 1=Normal, 2=Depressed/sad, 3=Very much affected","ontology":null,"regex":"(0|1|2)","file":false,"date":false,"dateTime":false,"url":"https://edepot.wur.nl/645851"}}],"packageName":"pig_health","itemCount":1}