Skip to content
Snippets Groups Projects
Commit 80c2db21 authored by Bjarke Madsen's avatar Bjarke Madsen
Browse files

Remove service matrix references

parent 950c33c9
Branches
Tags
No related merge requests found
...@@ -43,9 +43,6 @@ def create_app() -> Flask: ...@@ -43,9 +43,6 @@ def create_app() -> Flask:
from compendium_v2.routes import api from compendium_v2.routes import api
app.register_blueprint(api.routes, url_prefix='/api') app.register_blueprint(api.routes, url_prefix='/api')
from compendium_v2.routes import service_matrix
app.register_blueprint(service_matrix.routes, url_prefix='/service-matrix')
logging.info('Flask app initialized') logging.info('Flask app initialized')
environment.setup_logging() environment.setup_logging()
......
"""
Service Matrix Endpoints
=========================
These endpoints are intended for getting service matrix.
.. contents:: :local:
/service-matrix
---------------------
.. autofunction:: compendium_v2.routes.service_matrix
"""
import json
import logging
import os
from flask import Blueprint
from compendium_v2.routes import common
SERVICE_MATRIX_SCHEMA = {
'$schema': 'http://json-schema.org/draft-07/schema#',
'type': 'object',
'properties': {
'key': {
'type': 'string'
},
'nrens': {
'type': 'array',
'items': {
'type': 'object',
'properties': {
'name': {
'type': 'string'
},
'nren_id': {
'type': 'integer'
},
'tags': {
'type': 'array',
'items': {}
}
},
'required': [
'name',
'nren_id',
'tags'
],
'additionalProperties': True
}
}
}
}
DUMMY_DATA_FILENAME = os.path.abspath(os.path.join(
os.path.dirname(__file__),
'..',
'datasources',
'dummy-service-matrix.json'
))
routes = Blueprint('compendium-v2-service-matrix', __name__)
logger = logging.getLogger(__name__)
file_name = open(DUMMY_DATA_FILENAME)
service_matrix_response = json.loads(file_name.read())
@routes.route('', methods=['GET'])
@common.require_accepts_json
def get_service_matrix():
"""
handler for /service-matrix requests
response will be formatted as:
.. asjson::
compendium_v2.routes.api.THING_LIST_SCHEMA
:return:
"""
return service_matrix_response
import json
import jsonschema
import pytest
from compendium_v2.routes.service_matrix import SERVICE_MATRIX_SCHEMA
@pytest.mark.parametrize(
'endpoint',
['service-matrix'])
def test_bad_accept(endpoint, client):
rv = client.get(
endpoint,
headers={'Accept': ['text/html']})
assert rv.status_code == 406
def test_service_matrix(client):
rv = client.get(
'service-matrix',
headers={'Accept': ['application/json']})
assert rv.status_code == 200
result = json.loads(rv.data.decode('utf-8'))
jsonschema.validate(result, SERVICE_MATRIX_SCHEMA)
export interface ServiceMatrix {
key: string,
nrens: Nren[],
services: Service[][]
}
export interface Nren { export interface Nren {
name: string name: string
nren_id: number nren_id: number
...@@ -33,7 +26,7 @@ export interface Budget { ...@@ -33,7 +26,7 @@ export interface Budget {
id: number id: number
} }
export interface FundingSource{ export interface FundingSource {
CLIENT_INSTITUTIONS: string, CLIENT_INSTITUTIONS: string,
COMMERCIAL: string, COMMERCIAL: string,
EUROPEAN_FUNDING: string, EUROPEAN_FUNDING: string,
...@@ -44,24 +37,24 @@ export interface FundingSource{ ...@@ -44,24 +37,24 @@ export interface FundingSource{
id: number id: number
} }
export interface FS{ export interface FS {
data: [FundingSource] data: [FundingSource]
} }
export interface FundingGraphMatrix { export interface FundingGraphMatrix {
labels: string[], labels: string[],
datasets: { datasets: {
label: string, label: string,
data: string[], data: string[],
backgroundColor: string backgroundColor: string
borderRadius:number, borderRadius: number,
borderSkipped: boolean , borderSkipped: boolean,
barPercentage:number, barPercentage: number,
borderWidth: number, borderWidth: number,
categoryPercentage:number categoryPercentage: number
stack: string stack: string
}[] }[]
} }
export interface DataEntrySection { export interface DataEntrySection {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment