Assume that all the files have been git cloned to a directory, we want to extract data from these projects by using the Javascript API provided by Accord Project, firstly we want to convert the CTO model files to JSON.
[x] 1. Write a Coffeescript function which iterates over all projects in the directory and returns a JSON structure which contains the location of each project path and the CTO files inside each project. Like this.
[x] 2. Write a Coffeescript function which when given the data from 1. as a parameter it can generate all the JSON data files which represent the CTO model files converted to JSON. It must return the JSON back to the caller. CTO to JSON file https://docs.accordproject.org/docs/ergo-api.html#Commands.parseCTOtoFile
[ ] 4. Make a function which combines all above together to output a JSON file for a single project directory and make it possible to run this from command line, eg. like: run export accordprojectdirectory output.json
[x] 5. Check that output.json file contains most information about the project as gained through the API's.
[ ] 6. Make sure that async await is used correctly so that all is done asynchronously without blocking.
Hi ! Please read and understand what this file does before starting any task https://github.com/contractpendev/contractpen_node_client/blob/master/src/services/SetupClient.coffee and also better to read and understand the existing code base. Refer to Accord Project https://www.accordproject.org/ Ergo API https://docs.accordproject.org/docs/ergo-api.html Cicero API https://docs.accordproject.org/docs/cicero-api.html
At https://github.com/accordproject/cicero-template-library/tree/master/src there are many projects which also contain CTO models.
For example here is a CTO model https://github.com/accordproject/cicero-template-library/blob/master/src/payment-upon-delivery/models/model.cto
Assume that all the files have been git cloned to a directory, we want to extract data from these projects by using the Javascript API provided by Accord Project, firstly we want to convert the CTO model files to JSON.
Here is the Javascript API for Accord Cicero https://docs.accordproject.org/docs/cicero-api.html and here is the API for Accord Ergo https://docs.accordproject.org/docs/ergo-api.html
In the Ergo API we can see there is Commands.parseCTOtoFile(ctoPath) which can parse a CTO file and output JSON data, a CTO file is a model definition file for data models. There are many CTO files such as https://github.com/accordproject/cicero-template-library/blob/master/src/payment-upon-delivery/models/model.cto
Template can be loaded from directory https://docs.accordproject.org/docs/cicero-api.html#templatefromdirectorypath-options-code-promise-code
The task here is to write code to iterate over all the projects and extract data from each folder in the form of JSON data.
Assume that https://github.com/accordproject/cicero-template-library has been downloaded and extracted to a directory.
[x] 2. Write a Coffeescript function which when given the data from 1. as a parameter it can generate all the JSON data files which represent the CTO model files converted to JSON. It must return the JSON back to the caller. CTO to JSON file https://docs.accordproject.org/docs/ergo-api.html#Commands.parseCTOtoFile
[x] 3. Write Coffeescript function to Convert ALL Metadata to JSON. https://docs.accordproject.org/docs/cicero-api.html#module_cicero-core.Metadata
[ ] 4. Make a function which combines all above together to output a JSON file for a single project directory and make it possible to run this from command line, eg. like: run export accordprojectdirectory output.json
[x] 5. Check that output.json file contains most information about the project as gained through the API's.
[ ] 6. Make sure that async await is used correctly so that all is done asynchronously without blocking.