Open Data Services Sphinx Base¶
Examples¶
Table without horizonal scrollbar:
A |
B |
C |
D |
---|---|---|---|
Lorem |
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec dictum urna non purus tristique pharetra. |
Yes |
False |
Ipsum |
Mauris et lobortis nibh. Nullam vitae velit turpis. Vestibulum facilisis sit amet sapien nec maximus. |
No |
True |
Dolor |
Pellentesque sit amet sapien tincidunt, fringilla dui id, porttitor purus. Nam tincidunt ac ex id porttitor. Praesent varius lectus nisl, ac luctus erat lacinia vitae. |
Yes |
True |
Markdown inside an admonition¶
Admonition
Some markdown a URL, single backtick literals
.
(from https://sphinxcontrib-opendataservices.readthedocs.io/en/latest/misc/)
JSONSchema¶
Title |
Description |
Type |
Format |
Required |
---|---|---|---|---|
id |
string |
Required |
||
Identifier |
An identifier |
|||
foo |
integer |
|||
Foo bar |
Foo bar baz bar baz bar baz bar baz. Bar foo baz foo bar. Baz bar foo bar foo bar foo bar foo. |
|||
when |
string |
date-time |
Required |
|
When |
When did this thing happen |
|||
lorem |
string |
|||
Lorem ipsum |
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur porttitor urna in diam ornare luctus. Donec accumsan sit amet velit id auctor. Sed commodo elit ut tempor suscipit. Fusce volutpat malesuada felis, accumsan molestie nisi aliquet non. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. |
|||
subthings |
array[object] |
|||
SubThing |
Description of SubThing |
|||
subthings/0/id |
string |
Required |
||
Identifier |
An identifier for this subthing |
|||
subthings/0/example |
string |
|||
Example |
An example field |
JSONSchema with docson¶
For more examples see https://sphinxcontrib-opendataservices.readthedocs.io/en/latest/jsonschema/
Contents¶
Coding Style¶
To create consistent and readable code please follow the guides:
Python¶
Before committing python code make sure to run python-black via
$ black
Style:
variable_names = "things"
class ClassNames(object):
pass
def function_names():
return 1
JS¶
Indent with 2 spaces
variables and function names camelCase
Style:
function abcdAlpha(param){
}
let obj = {
propertyA: 1,
propertyB: 2
}
Core components¶
Main¶
The main application is the django framework which loads the three django applications which make up standards lab.
ui
api
processor
The django framework is configured using:
settings/<settings file>
urls.py
wsgi.py
manage.py
UI¶
The UI application is further separated into two applications depending on responsibility.
The Django UI application is responsible for:
URL routing
Http Requests
Templates
Views
Common data templates’ context
The VueJS application is responsible for:
Interactivity within the web page
Rendering and two way bindings of in-page VueJS templates with data from the API
Sending and receiving data from the API
API¶
The API provides endpoints primarily for the VueJS application. All responses are JSON
format.
/api/
project/<project-name>
GET: returns project configuration
POST: (
JSON
) updates or creates the project configuration (edit mode only)
project/<project-name>/upload
POST: Upload data to the project. (
FormData
)FILE
required propertiesuploadType
values"schema"
or"data"
for the different upload types.
project/<project-name>/download/<file-name>
GET: Returns project file. Optional property
attach=true
determines if the file should be sent to the browser as an attachment or as data. Default not present.
project/<project-name>/process
GET: Returns the status(es) and results of any Processor running for specified project
POST: (
JSON
) required propertiesaction
value"start"
,processName
value"<name-of-processor>"
Processor¶
The processor is responsible for starting, defining and communicating with processing jobs. Each processor implements a start
function and a monitor
function.
Utils¶
Utility functions that are common to all of the django applications.
Dependencies¶
We have a number of external dependencies for both the frontend and backend.
Updating python requirements¶
The python requirements are defined in requirements.in
and requirements_dev.in
these are used to generate requirements.txt
and requirements_dev.txt
using pip-compile
.
Using pip-compile in docker¶
(Re)Generate the requirements files:
$ docker run --rm -v $(pwd):/code standards-lab_standards-lab pip-compile
Upgrade the requirements:
$ docker-compose run --rm -v $(pwd):/code standards-lab-web pip-compile --upgrade <selected requirements.in file>
Using pip-compile locally¶
(Re)Generate the requirements files:
$ pip-compile <selected requirements.in file>
Upgrade the requirements:
$ pip-compile --upgrade <selected requirements.in file>
Javascript dependencies¶
We currently use:
VueJS
Bootstrap
JQuery
v-jsoneditor¶
This is VueJS wrapper for jsoneditor. To build v-jsoneditor:
# In the top level directory with the `package-lock.json`.
$ npm install
The minified javascript used in standards_lab/ui/static/v-jsoneditor/js/
is then output to
./node_modules/v-jsoneditor/dist/
.