Skip to main content

A library to perform machine reading over a model codebase in order to automatically extract key metadata.

Project description

Domain-Model-eXaminer (DMX)

Description

The goal of this process is to perform machine reading over the model codebase in order to automatically extract key metadata about:

  • Input files
  • Output files
  • System requirements
  • Software requirements
  • Model entry points
  • Model descriptions
  • Maintainer information

Installation

Pip package

The domain-model-examiner library can be installed via pip:

pip install domainmodelexaminer

Local installation from source

After 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.txt

Docker installation from source

After cloining the repo, docker install and run:

docker build -t dmx .
docker run -p 80:80 dmx

The API docs will be available at http://0.0.0.0/docs.

Usage

Pip Package

The examine function of module dmx of package domainmodelexaminer takes 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.

The examine function can be imported an executed as follows:

from domainmodelexaminer import dmx
dmx_json_output = dmx.examine("https://github.com/dojo-modeling/dojo")

Local install

List command line options

python dmx.py --help

Process Local Repository

Clone or download the repository of interest. For example:

cd /tmp
git clone https://github.com/jataware/dummy-model.git

Next, analyze this repo with:

python dmx.py --repo="/tmp/dummy-model"

Process Remote Repository

python dmx.py --url="https://github.com/jataware/dummy-model.git"

This creates and deletes a tempory folder 'tmp'.

Output

The application produces a .yaml file with prefix 'dmx-' concatenated with the repo name.

Running the API

Run API:

uvicorn domainmodelexaminer.api:app

The API docs will be available at http://127.0.0.1:8000/docs

Do not use the uvicorn --reload flag, since the app will download the repo to the api folder.

Testing Repositories

Note that Pythia is a highly abstracted Python version of the DSSAT model.

API Reference

Default port for Docker is 80. Default port for Uvicorn is 8000. Examples given below assume the Uvicorn server is running at port 8000.

Docs

  GET /docs
  e.g. http://127.0.0.1:8000/docs

Confirm the API is available:

  GET /
  e.g. http://127.0.0.1:8000/

Returns

{"status":"running"}

Examine URL

  GET /examine/${url}
  e.g. http://127.0.0.1:8000/examine/?url=https://github.com/jataware/dummy-model.git
Parameter Type Description
url string Required. URL of GitHub repo
return_json bool Default = False. Returns JSON true, else a YAML string.

Returns

JSON 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": [
  ...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

domainmodelexaminer-0.1.1.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

domainmodelexaminer-0.1.1-py2.py3-none-any.whl (23.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file domainmodelexaminer-0.1.1.tar.gz.

File metadata

  • Download URL: domainmodelexaminer-0.1.1.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/3.10.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.8

File hashes

Hashes for domainmodelexaminer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5027a2d0b0671c4b785352bfbbf8a50c39de5f00dcc62cd9b1ec8860c1c5c0fc
MD5 8651f0741745044b90af2c9d729f8b48
BLAKE2b-256 a003ba94cebb0c57c3b688b865a2b68a04c1233a5fb96901e89d56065901881a

See more details on using hashes here.

File details

Details for the file domainmodelexaminer-0.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: domainmodelexaminer-0.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/3.10.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.8

File hashes

Hashes for domainmodelexaminer-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 93185deb2cc9000dba7f7effb0c60dfc0c3956ab8b24c59be366057d97f4196c
MD5 059545fe751788ad298e9ece37cb6707
BLAKE2b-256 c203cffd5c551960a0f7f7b3ae484b83c1e399ad580a17f68324abaf0d8d2d58

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page