Package: domainmodelexaminer
Domain-Model-eXaminer (DMX)DescriptionThe goal of this process is to perform machine reading over the model codebase in order to automatically extract key metadata about:Input filesOutput filesSystem requirementsSoftware requirementsModel entry pointsModel descriptionsMaintainer informationInstallationPip packageThe domain-model-examiner library can be installed via pip:pip install domainmodelexaminerLocal installation from sourceAfter cloning the repo, the recommended installation is to create a new conda environment and then install from requirements.txt:conda create --name=dmx python=3.8
conda activate dmx
conda install -c conda-forge uvicorn
pip install -r requirements.txtDocker installation from sourceAfter cloining the repo, docker install and run:docker build -t dmx .
docker run -p 80:80 dmxThe API docs will be available athttp://0.0.0.0/docs.UsagePip PackageTheexaminefunction of moduledmxof packagedomainmodelexaminertakes the following parameters:url (str) GitHub or GitLab repo url.return_json (bool = True) Returns a JSON string if true, else a YAML string.and returns either JSON (default) or a YAML string.Theexaminefunction can be imported an executed as follows:from domainmodelexaminer import dmx
dmx_json_output = dmx.examine("https://github.com/dojo-modeling/dojo")Local installList command line optionspython dmx.py --helpProcess Local RepositoryClone or download the repository of interest. For example:cd /tmp
git clone https://github.com/jataware/dummy-model.gitNext, analyze this repo with:python dmx.py --repo="/tmp/dummy-model"Process Remote Repositorypython dmx.py --url="https://github.com/jataware/dummy-model.git"This creates and deletes a tempory folder 'tmp'.OutputThe application produces a .yaml file with prefix 'dmx-' concatenated with the repo name.Running the APIRun API:uvicorn domainmodelexaminer.api:appThe API docs will be available athttp://127.0.0.1:8000/docsDo not use theuvicorn--reloadflag, since the app will download the repo to the api folder.Testing Repositorieshttps://github.com/jataware/dummy-modelhttps://github.com/djgroen/FabFleehttps://github.com/jataware/maxhophttps://github.com/DSSAT/pythia/tree/develop[developbranch]https://github.com/mjpuma/FSC-WorldModelersNote that Pythia is a highly abstracted Python version of theDSSAT model.API ReferenceDefault port for Docker is 80.
Default port for Uvicorn is 8000.
Examples given below assume the Uvicorn server is running at port 8000.DocsGET /docse.g. http://127.0.0.1:8000/docsConfirm the API is available:GET /e.g. http://127.0.0.1:8000/Returns{"status":"running"}Examine URLGET /examine/${url}e.g. http://127.0.0.1:8000/examine/?url=https://github.com/jataware/dummy-model.gitParameterTypeDescriptionurlstringRequired. URL of GitHub reporeturn_jsonboolDefault = False. Returns JSON true, else a YAML string.ReturnsJSON or YAML-formatted string e.g.{
  "language": "Python",
  "owner": {
    "login": "dojo-modeling",
    "repo_url": "https://github.com/dojo-modeling/dojo",
    "type": "Organization",
    "name": null,
    "company": null,
    "blog": "",
    "location": null,
    "bio": null
  },
  "about": "not found",
  "docker_entrypoint": null,
  "model_types": [
    "Geospatial Data / Terrain Models"
  ],
  "imports": [
  ...