/StaticNarrative

A dynamic service for creating and managing Static Narratives

Primary LanguagePythonMIT LicenseMIT

Static Narrative Service


Introduction

This service is used for creating and managing Static Narratives. These are Narratives that are meant to be available for public viewing. They are:

  1. Viewable anonymously through a shareable link.
  2. Non-functional, in that they cannot execute jobs or check on job status.
  3. Non-updateable, each given version of a Static Narrative is tied to a specific version of the original working Narrative that was used to create it.
  4. Partially interactive, while some elements (mainly the App Cells) have most of their interactivity in common with the Narrative Interface, other visualizer cells do not, and link back to their Narrative.

Usage


...

API


Create Static Narrative

...

Contributing


This is a KBase module generated by the KBase Software Development Kit (SDK).

You will need to have the SDK installed to use this module if you want to make any changes to the spec or the API. However, other development work does not require the SDK and can be done locally.

Learn more about the SDK and how to use it.

Set up

The StaticNarrative repo has been developed and tested using Python 3.12. There are three sets of dependencies for the repo:

  • requirements.txt - packages required for runtime
  • requirements-test.txt - packages used in testing and generating coverage
  • requirements-dev.txt - includes a range of extra tools for formatting and linting code.

The contents of the three files are mutually exclusive, so all three should be installed for the full development environment.

Pip is not always completely reliable at pulling in package dependencies, so it is recommended that you install packages one at a time as follows:

$ cat requirements.txt | sed -e '/^\s*#.*$/d' -e '/^\s*$/d' | xargs -n 1 pip install

...substituting in the appropriate requirements file name.

Tests

Tests do not require the use of the SDK or a test token. They can be run using the shell script test/run_tests.sh, or directly from the command line:

$ export PYTHONPATH=$PYTHONPATH:$(pwd)/lib
$ pytest test

API changes

If you make changes to the spec (and thus the API) of the StaticNarrative app, you will need to recompile the app to generate updated versions of StaticNarrativeImpl.py, StaticNarrativeServer.py, and the compilation report, compile_report.json. These updated files must be committed to the GitHub repo.

Note that there is a bug in some versions of the SDK that assumes the wrong location for the baseclient.py and authclient.py files. To fix it, after compilation, edit the StaticNarrativeServer.py file to amend the following lines:

find (around line 19):

from biokbase import log
from StaticNarrative.authclient import KBaseAuth as _KBaseAuth

replace with:

from biokbase import log
from installed_clients.authclient import KBaseAuth as _KBaseAuth

Deployment

This is deployed as all other KBase dynamic services, with a hitch. This needs an extra configured directory mount to put the generated static narratives. This is set internally to the module in deploy.cfg as static-file-root, but must be mounted in the running service externally.

Help

You may find the answers to your questions in our FAQ or Troubleshooting Guide.