diff --git a/compendium_v2/__init__.py b/compendium_v2/__init__.py index 23c4f0a41110cfc62d869f34b6c18ac15d0ec1bf..ad265a9b8ab03285741c96033afc18648cb11a26 100644 --- a/compendium_v2/__init__.py +++ b/compendium_v2/__init__.py @@ -43,9 +43,6 @@ def create_app() -> Flask: from compendium_v2.routes import 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') environment.setup_logging() diff --git a/compendium_v2/routes/service_matrix.py b/compendium_v2/routes/service_matrix.py deleted file mode 100644 index 798db6ec75cb2e914d75dd2162785a10915fc653..0000000000000000000000000000000000000000 --- a/compendium_v2/routes/service_matrix.py +++ /dev/null @@ -1,84 +0,0 @@ -""" -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 diff --git a/test/test_service_matrix.py b/test/test_service_matrix.py deleted file mode 100644 index ef5347497e569cf950ef496de6de14730cf59b3e..0000000000000000000000000000000000000000 --- a/test/test_service_matrix.py +++ /dev/null @@ -1,25 +0,0 @@ -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) diff --git a/webapp/src/Schema.tsx b/webapp/src/Schema.tsx index b66f038b990e75a90341f5fca516ec5629f8a061..d2f88d70e5ef607aab24df452c2a39d01cfa586c 100644 --- a/webapp/src/Schema.tsx +++ b/webapp/src/Schema.tsx @@ -1,10 +1,3 @@ -export interface ServiceMatrix { - key: string, - nrens: Nren[], - services: Service[][] -} - - export interface Nren { name: string nren_id: number @@ -33,7 +26,7 @@ export interface Budget { id: number } -export interface FundingSource{ +export interface FundingSource { CLIENT_INSTITUTIONS: string, COMMERCIAL: string, EUROPEAN_FUNDING: string, @@ -44,24 +37,24 @@ export interface FundingSource{ id: number } -export interface FS{ +export interface FS { data: [FundingSource] } export interface FundingGraphMatrix { - labels: string[], - datasets: { - label: string, - data: string[], - backgroundColor: string - borderRadius:number, - borderSkipped: boolean , - barPercentage:number, - borderWidth: number, - categoryPercentage:number - stack: string - }[] + labels: string[], + datasets: { + label: string, + data: string[], + backgroundColor: string + borderRadius: number, + borderSkipped: boolean, + barPercentage: number, + borderWidth: number, + categoryPercentage: number + stack: string + }[] } export interface DataEntrySection {