2017-25 © Pedro Peláez
 

library easy-smta-toolkit

FAO SMTA api toolkit

image

endlessdreams/easy-smta-toolkit

FAO SMTA api toolkit

  • Wednesday, June 27, 2018
  • by kal
  • Repository
  • 0 Watchers
  • 0 Stars
  • 23 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

FAO SMTA API post submiter

Intended use for Gene banks, (*1)

Easysmta is a http post utillity program to register your institute's SMTAs (Standard Material Transfer Agreements). To make it work, you need to have the following:, (*2)

  1. An account at FAO's Planttreaty site.
  2. Two database tables or dataviews with SMTA and SMTA material data.
  3. Make the configuration in this application's config file.
  4. run bin/easysmta post command. The command uses parameters to limit which SMTAs you are intended to post/register.

Installation

In order to install this library via composer run the following command in the console:, (*3)

composer require endlessdreams/easy-smta-toolkit

or add the package manually to your composer.json file in the require section:, (*4)

"endlessdreams/easy-smta-toolkit": "^1.0"

or globally:, (*5)

composer global require endlessdreams/easy-smta-toolkit

This will install easysmta into the ~/.composer/vendor/ directory and, most importantly, the easysmta CLI tool are installed into ~/.composer/vendor/bin/., (*6)

Simply add this directory to your PATH in your ~/.bash_profile (or ~/.bashrc) like this:, (*7)

export PATH=~/.composer/vendor/bin:$PATH

and easysmta is now available on your command line., (*8)

To keep your tools up to date, you simply do this:, (*9)

composer global update
composer global install

To remove a package, you edit ~/.composer/composer.json and then run composer global update., (*10)

Configuration

Configuration file is located in easysmta application folder: config/local.php. In this file you will see the following structure:, (*11)


return [ 'database' => [ 'driver' => getenv('EASYSMTA_DRIVER'), 'database' => getenv('EASYSMTA_DATABASE'), 'username' => getenv('EASYSMTA_USERNAME'), 'password' => getenv('EASYSMTA_PASSWORD'), 'hostname' => getenv('EASYSMTA_HOSTNAME'), ], 'map' => [ 'table_order' => 'easysmta', 'table_item' => 'easysmtaitem', 'columns_order' => [ 'id' => 'id', 'symbole' => 'symbole', 'date' => 'date', 'type' => 'type', 'language' => 'language', 'shipName' => 'shipname', 'recipient_type' => 'recipient_type', 'recipient_pid' => 'recipient_pid', 'recipient_name' => 'recipient_name', 'recipient_address' => 'recipient_address', 'recipient_country' => 'recipient_country', 'document_location' => 'document_location', 'document_retInfo' => 'document_retinfo' ], 'columns_item' => [ 'crop' => 'crop', 'sampleid' => 'sampleid', 'pud' => 'pud', 'ancestry' => 'ancestry' ], ], 'provider' => [ 'type' => 'or', 'pid' => getenv('PROVIDER_INSTITUTE_CODE') ?? 'YOUR INSTITUTE CODE', 'name' => getenv('PROVIDER_INSTITUTE_NAME') ?? 'YOUR INSTITUTE NAME', 'address' => getenv('PROVIDER_INSTITUTE_ADDRESS') ?? 'YOUR INSTITUTE ADDRESS', 'country' => getenv('PROVIDER_INSTITUTE_COUNTRY_CODE') ?? 'XXX', 'email' => getenv('PROVIDER_INSTITUTE_EMAIL') ?? 'contact@any.institute' ], 'fao' => [ 'username' => getenv('EASYSMTA_FAO_USERNAME'), 'password' => getenv('EASYSMTA_FAO_PASSWORD'), ], ];

To set database and FAO HTTPS API credentials in the config file or exporting environment variables in ~/.bash_profile (or ~/.bashrc)., (*12)

Usage

The examples are written as if your working directory is bin or the application is globally installed., (*13)

To test generate xml to terminal., (*14)

easysmta xml-dry-run

To test generate all smta xml to 2018-01-01. (No https credentials needed here, only to your database), (*15)

easysmta xml-dry-run --to=2018-01-01

To test post all SMTA's until 2018-01-01., (*16)

easysmta register --to=2018-01-01 -t

To test post all SMTA's from 2017-01-01 until 2018-01-01., (*17)

easysmta register --from=2017-01-01 --to=2018-01-01 -t

To actual post all SMTA's until 2018-01-01. (No testing), (*18)

easysmta register --to=2018-01-01

Credits

ir. R (Roel) Hoekstra and dr.ir. TJL (Theo) van Hintum at Centrum voor Genetische Bronnen Nederland for letting me look at their dos cmd toolkit., (*19)

Mr Marco Marsella at FAO, Climate, Biodiversity, Land and Water Department, IT for great support., (*20)

The Versions