DARPA-ASKEM / data-service

Terarium Data Service
3 stars 0 forks source link

Refactor `Code` model #328

Closed brandomr closed 1 year ago

brandomr commented 1 year ago

This PR addresses #327

Note: it does not implement a tree but instead relies on the keys of files which are the full path of the file relative to the root of the repo to describe the tree structure.

An example Code object might look like:

{
   "name":"Example Model Code",
   "description":"Example of a Python-based code object for a model",
   "files":{
      "README.md":{
         "language":"markdown"
      },
      "src/model.py":{
         "language":"python",
         "dynamics":{
            "name":"Main Dynamics",
            "description":"Dynamics section for the ODE.",
            "block":"L205-L213"
         }
      }
   },
   "repo_url":"https://github.com/user/repo.git",
   "commit":"abcd1234",
   "branch":"main",
   "metadata":{

   }
}

The HMI can obtain the tree by grabbing the keys of files:

README.md
src/model.py

This implies that README.md is at the top level of the repo whereas model.py is in the src directory.