System Documentation - bjohanne/ig-coder Wiki

Client

The client is a React app written in TypeScript. NPM is used as a package manager.

Running the client

  1. Navigate to client/
  2. npm install
  3. npm start
  4. Visit localhost:3000 (or the URI shown in the command line output of npm start)

This will run the development server, which automatically recompiles the app on code changes. See also the README in client/.

Testing the client

To run the unit tests: npm test

To debug the tests:

Linux: node --inspect-brk node_modules/.bin/jest --runInBand

Windows: node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand

Then visit chrome://inspect (in Google Chrome) and open Node developer tools.

Data model

The data model is a class-based implementation of IG 2.0 which facilitates the building of institutional statement trees, i.e., encoding the statements in a tree structure which is unique to IG Coder.

The current version is documented here.

Server

The server is a Flask app written in Python 3.7. pip is used as a package manager.

Running the server

It is recommended to run the server in a virtual environment, which these steps explain how to do.

  1. Navigate to server/
  2. Create a virtual environment. This can be done via the venv module, and the virtual environment can be easily created and managed with an IDE such as PyCharm.
  3. Activate the virtual environment, which can be done by running source venv/bin/activate
  4. Ensure the virtual environment has an environment variable FLASK_APP with the value "app.py"
  5. Ensure the virtual environment has an environment variable FLASK_RUN_PORT with the value "5060"
  6. Ensure the virtual environment has an environment variable FLASK_ENV which should have the value "development"
  7. While still in /server/, run flask run or use the IDE's run button

API and testing

Documentation for the API is generated by Swagger. While the server is running, Swagger UI can be viewed at localhost:5060/v1/ui/ (provided that the server is running on port 5060).

To test the backend API, run pytest in the virtual environment.

Troubleshooting