useeior icon indicating copy to clipboard operation
useeior copied to clipboard

Write models objects to JSON

Open WesIngwersen opened this issue 1 year ago • 2 comments

JSON files for model objects are already used in useeio.js but they are retrieved from the USEEIO_API.

Alternative is to write JSON objects directly from useeior.

WesIngwersen avatar May 24 '24 16:05 WesIngwersen

Currently the following relevant writing is occurring:

  1. Matrices are written to binary in writeModelMatrices Recommend modifying to accept a "json" option for to_format

  2. Model metadata is written to csv in writeModelMetadata

  3. Model demands are already written to JSON in writeModelDemandstoJSON No changes recommended. The JSON writing here should be used as a template to modify other functions. for instance use jsonlite

  4. The Sector Crosswalk is written to csv in writeSectorCrosswalk Add to_format parameter with code to handle "json" option

Then create a wrapper function analogous to writeModeltoExcel() but rather it will be writeModeltoJSON()

WesIngwersen avatar May 24 '24 17:05 WesIngwersen

to validate the output the resulting JSON needs to be compared to the JSON for a model retrieved from the USEEIO_API via useeio.js or useeio-widgets

WesIngwersen avatar May 24 '24 17:05 WesIngwersen