Skip to content
Snippets Groups Projects
Commit 9f004860 authored by geant-release-service's avatar geant-release-service
Browse files

Finished release 0.40.

parents b537148e 46cf43a1
Branches
Tags 0.40
No related merge requests found
...@@ -16,7 +16,9 @@ import PolicyPage from "./pages/Policy"; ...@@ -16,7 +16,9 @@ import PolicyPage from "./pages/Policy";
import TrafficVolumePage from "./pages/TrafficVolumePerNren"; import TrafficVolumePage from "./pages/TrafficVolumePerNren";
import ConnectedInstitutionsURLs from "./pages/ConnectedInstitutionsURLs"; import ConnectedInstitutionsURLs from "./pages/ConnectedInstitutionsURLs";
import ServicesPage from "./pages/Services"; import ServicesPage from "./pages/Services";
import { ServiceCategory } from "./Schema"; import {ConnectivityCategory, ServiceCategory} from "./Schema";
import ConnectivityPage from "./pages/Connectivity";
import ConnectedProportionPage from "./pages/Connectivity";
const router = createBrowserRouter([ const router = createBrowserRouter([
{ path: "/budget", element: <BudgetPage /> }, { path: "/budget", element: <BudgetPage /> },
...@@ -31,6 +33,13 @@ const router = createBrowserRouter([ ...@@ -31,6 +33,13 @@ const router = createBrowserRouter([
{ path: "/traffic-volume", element: <TrafficVolumePage /> }, { path: "/traffic-volume", element: <TrafficVolumePage /> },
{ path: "/data", element: <CompendiumData /> }, { path: "/data", element: <CompendiumData /> },
{ path: "/institutions-urls", element: <ConnectedInstitutionsURLs /> }, { path: "/institutions-urls", element: <ConnectedInstitutionsURLs /> },
{ path: "/connected-proportion", element: <ConnectedProportionPage connectivity_category={ConnectivityCategory.ConnectedProportion} /> },
{ path: "/connectivity-level", element: <ConnectivityPage connectivity_category={ConnectivityCategory.ConnectivityLevel} /> },
{ path: "/connectivity-growth", element: <ConnectivityPage connectivity_category={ConnectivityCategory.ConnectivityGrowth} /> },
{ path: "/connection-carrier", element: <ConnectivityPage connectivity_category={ConnectivityCategory.ConnectionCarrier} /> },
{ path: "/connectivity-load", element: <ConnectivityPage connectivity_category={ConnectivityCategory.ConnectivityLoad} /> },
{ path: "/commercial-charging-level", element: <ConnectivityPage connectivity_category={ConnectivityCategory.CommercialChargingLevel} /> },
{ path: "/commercial-connectivity", element: <ConnectivityPage connectivity_category={ConnectivityCategory.CommercialConnectivity} /> },
{ path: "/network-services", element: <ServicesPage category={ServiceCategory.network_services} /> }, { path: "/network-services", element: <ServicesPage category={ServiceCategory.network_services} /> },
{ path: "/isp-support-services", element: <ServicesPage category={ServiceCategory.isp_support} /> }, { path: "/isp-support-services", element: <ServicesPage category={ServiceCategory.isp_support} /> },
{ path: "/security-services", element: <ServicesPage category={ServiceCategory.security} /> }, { path: "/security-services", element: <ServicesPage category={ServiceCategory.security} /> },
......
...@@ -129,3 +129,47 @@ export interface Service extends NrenAndYearDatapoint { ...@@ -129,3 +129,47 @@ export interface Service extends NrenAndYearDatapoint {
official_description: string, official_description: string,
additional_information: string, additional_information: string,
} }
export enum ConnectivityCategory {
ConnectedProportion="proportion",
ConnectivityLevel="level",
ConnectionCarrier="carrier",
ConnectivityLoad="load",
ConnectivityGrowth="growth",
CommercialConnectivity="charging",
CommercialChargingLevel="commercial",
}
export interface ConnectedProportion extends NrenAndYearDatapoint {
// strategic_plan: string,
user_category: string,
coverage: string,
number_connected: number,
market_share: number,
users_served: number,
}
export interface ConnectivityLevel extends NrenAndYearDatapoint {
user_category: string
typical_speed: number,
highest_speed: number,
highest_speed_proportion: number,
}
export interface ConnectionCarrier extends NrenAndYearDatapoint {
user_category: string,
carry_mechanism: string
}
export interface ConnectivityLoad extends NrenAndYearDatapoint {
user_category: string,
average_load_from_institutions: number,
average_load_to_institutions: number,
peak_load_from_institutions: number,
peak_load_to_institutions: number
}
export interface ConnectivityGrowth extends NrenAndYearDatapoint {
user_category: string,
growth: number
}
\ No newline at end of file
import React, { useState } from 'react';
import { Col, Row } from 'react-bootstrap';
import { AiOutlineClose, AiOutlinePlus } from 'react-icons/ai';
interface CollapsibleBoxProps {
title: string;
children: React.ReactNode;
startCollapsed?: boolean;
}
const CollapsibleConnectivityBox: React.FC<CollapsibleBoxProps> = ({ title, children, startCollapsed }) => {
const [isCollapsed, setIsCollapsed] = useState(!!startCollapsed);
return (
<div className='collapsible-box-connect p-0'>
<Row>
<Col>
<h1 className="bold-caps-16pt dark-teal pt-3 ps-3">{title}</h1>
</Col>
<Col className='flex-grow-0 flex-shrink-1'>
<div className="toggle-btn-connect p-3" onClick={() => setIsCollapsed(!isCollapsed)}>
{isCollapsed ?
<AiOutlinePlus style={{fontWeight:"bold", color: 'black', paddingBottom: "3px", marginTop: "3px", marginLeft: "3px", scale: "1.3"}} /> :
<AiOutlineClose style={{ fontWeight:"bold", color: 'black', paddingBottom: "3px", marginTop: "3px", marginLeft: "3px", scale: "1.3"}} />}
</div>
</Col>
</Row>
{!isCollapsed && <div className='collapsible-content'>
{children}
</div>}
</div>
);
};
export default CollapsibleConnectivityBox;
...@@ -7,6 +7,11 @@ const ConnectedUsersSidebar = () => { ...@@ -7,6 +7,11 @@ const ConnectedUsersSidebar = () => {
return ( return (
<Sidebar> <Sidebar>
<h5>Connected Users</h5> <h5>Connected Users</h5>
<Row>
<Link to="/connected-proportion" className="link-text-underline">
<span>Connected Proportion</span>
</Link>
</Row>
<Row> <Row>
<Link to="/institutions-urls" className="link-text-underline"> <Link to="/institutions-urls" className="link-text-underline">
<span>Connected Institutions URLs</span> <span>Connected Institutions URLs</span>
......
...@@ -317,3 +317,22 @@ export function createMatrixDataLookup<Datatype extends NrenAndYearDatapoint>(da ...@@ -317,3 +317,22 @@ export function createMatrixDataLookup<Datatype extends NrenAndYearDatapoint>(da
}); });
return dataLookup; return dataLookup;
} }
export function createConnectivityDataLookup<Datatype extends NrenAndYearDatapoint>(data: Datatype[], columnProperty: string){
const dataLookup = new Map<string, Map<string, Map<number, Datatype>>>();
data.forEach(entry => {
let serviceEntry = dataLookup.get(entry[columnProperty]);
if (!serviceEntry) {
serviceEntry = new Map<string, Map<number, Datatype>>();
}
let nrenEntry = serviceEntry.get(entry.nren);
if (!nrenEntry) {
nrenEntry = new Map<number, Datatype>();
}
nrenEntry.set(entry.year, entry);
serviceEntry.set(entry.nren, nrenEntry);
dataLookup.set(entry[columnProperty], serviceEntry);
});
return dataLookup;
}
import React, { useContext } from "react";
import {Col, Row, Table} from "react-bootstrap";
import {ConnectedProportion, ConnectivityCategory, Service, ServiceCategory} from "../Schema";
import {createConnectivityDataLookup, createMatrixDataLookup} from "../helpers/dataconversion";
import DataPage from "../components/DataPage";
import Filter from "../components/graphing/Filter";
import { ExportType, Sections } from "../helpers/constants";
import { FilterSelectionContext } from "../helpers/FilterSelectionProvider";
import ChartContainer from "../components/graphing/ChartContainer";
import { useData } from "../helpers/useData";
import CollapsibleConnectivityBox from "../components/CollapsibleConnectivityBox";
interface inputProps {
connectivity_category: ConnectivityCategory
}
function ConnectedProportionPage({ connectivity_category }: inputProps): React.ReactElement {
const { filterSelection, setFilterSelection } = useContext(FilterSelectionContext);
const { data: connectedProportion, years, nrens } = useData<ConnectedProportion>('/api/connectivity/proportion', setFilterSelection);
const selectedData = (connectedProportion).filter(data =>
filterSelection.selectedYears.includes(data.year)
&& filterSelection.selectedNrens.includes(data.nren)
);
const connectedProportionDict = {};
selectedData.forEach(connectedProportion => {
connectedProportionDict[connectedProportion.user_category] = connectedProportion.user_category;
});
const connectedProportionList = Object.entries(connectedProportionDict).sort((a, b) => a[0].toLowerCase() < b[0].toLowerCase() ? -1 : 1);
const dataLookup = createConnectivityDataLookup(selectedData, 'user_category');
if(connectivity_category==ConnectivityCategory.ConnectedProportion.toString()){
console.log("Need to get filter data for ",dataLookup)
}
const filterNode = <Filter
filterOptions={{ availableYears: [...years], availableNrens: [...nrens.values()] }}
filterSelection={filterSelection}
setFilterSelection={setFilterSelection}
/>
const showYears = [...filterSelection.selectedYears.filter(year => years.has(year))].sort();
return (
<DataPage title="Connected User"
description="Hover over the elements for additional information."
category={Sections.ConnectedUsers} filter={filterNode}>
<>
{/*<DownloadDataButton data={serviceData} filename="nren_services.csv" exportType={ExportType.CSV} />*/}
{/*<DownloadDataButton data={serviceData} filename="nren_services.xlsx" exportType={ExportType.EXCEL} />*/}
{/*<DownloadImageChartButton filename="nren_services" />*/}
<ChartContainer>
<div style={{fontSize:"16px",marginBottom:"10px",fontWeight:"bold"}}>
An estimate of portion of institiute of different type which are provided with IP Connectivity by their NREN,
Including information on the remit of the NREN, actual number of institution connected, market share and number of user.
</div>
<div className="connectivity-border">
{Array.from(dataLookup.entries()).map(([userCategory, userCategoryMap]) => (
<CollapsibleConnectivityBox title={userCategory} startCollapsed >
<div className="table-responsive">
<Table className="connectivity-table" bordered >
<colgroup>
<col span={1} style={{width: "10%"}}/>
</colgroup>
<thead>
<tr>
<th></th>
{Array.from(userCategoryMap.entries()).map(([nrens,nrensMap])=>(
<th key={nrens} colSpan={filterSelection.selectedYears.length}>
{nrens}
</th>
))}
</tr>
<tr>
<th></th>
{Array.from(userCategoryMap.entries()).map(([nrens,nrensMap])=>(
Array.from(nrensMap.entries()).map(([yearRef,entry])=>(
<th key={yearRef}>
{yearRef}
</th>
))
))}
</tr>
</thead>
<tbody>
<tr>
<th>Remit cover connectivity</th>
{Array.from(userCategoryMap.entries()).map(([nrens,nrensMap])=>(
Array.from(nrensMap.entries()).map(([yearRef,entry])=>(
<td key={yearRef}>
{entry.coverage}
</td>
))
))}
</tr>
<tr>
<th>Number of institutions connected</th>
{Array.from(userCategoryMap.entries()).map(([nrens,nrensMap])=>(
Array.from(nrensMap.entries()).map(([yearRef,entry])=>(
<td key={yearRef}>
{entry.number_connected}
</td>
))
))}
</tr>
<tr>
<th>Percentage market share of institutions connected</th>
{Array.from(userCategoryMap.entries()).map(([nrens,nrensMap])=>(
Array.from(nrensMap.entries()).map(([yearRef,entry])=>(
<td key={yearRef}>
{entry.market_share}
</td>
))
))}
</tr>
<tr>
<th>Number of users served</th>
{Array.from(userCategoryMap.entries()).map(([nrens,nrensMap])=>(
Array.from(nrensMap.entries()).map(([yearRef,entry])=>(
<td key={yearRef}>
{entry.users_served}
</td>
))
))}
</tr>
</tbody>
</Table>
</div>
</CollapsibleConnectivityBox>
))}
</div>
</ChartContainer>
</>
</DataPage>
);
}
export default ConnectedProportionPage;
...@@ -59,4 +59,24 @@ nav.no-sidebar { ...@@ -59,4 +59,24 @@ nav.no-sidebar {
.toggle-btn-wrapper { .toggle-btn-wrapper {
padding: 0.5rem; padding: 0.5rem;
padding-top: 0.7rem; padding-top: 0.7rem;
}
.toggle-btn-connect {
@extend .bold-caps-16pt;
background-color: white;
color: white;
height: 3.5rem;
cursor: pointer;
padding-left: 1rem;
pointer-events: auto;
// prevent text selection
-webkit-user-select: none; /* Safari */
-ms-user-select: none; /* IE 10 and IE 11 */
user-select: none; /* Standard syntax */
}
.toggle-btn-wrapper-connect {
padding: 0.5rem;
padding-top: 0.7rem;
} }
\ No newline at end of file
...@@ -68,6 +68,14 @@ ...@@ -68,6 +68,14 @@
max-width: 50vw; max-width: 50vw;
} }
.collapsible-box-connect {
margin: 1rem;
border: 2px solid lightblue;
padding: 10px;
width: 90rem;
max-width: 68vw;
}
.collapsible-content { .collapsible-content {
display: flex; display: flex;
} }
...@@ -208,7 +216,20 @@ $year-colors: ( ...@@ -208,7 +216,20 @@ $year-colors: (
text-align: center; text-align: center;
} }
.charging-struct-table td { .connectivity-table tbody tr td:first-child {
position: sticky;
left: 0;
}
.connectivity-table tbody tr:nth-of-type(even) {
background-color: rgb(210,235,243);
}
.connectivity-table tbody tr:nth-of-type(odd) {
background-color: white;
}
.connectivity-table td {
text-align: center; text-align: center;
} }
...@@ -334,4 +355,8 @@ $funding-source-colors: ( ...@@ -334,4 +355,8 @@ $funding-source-colors: (
.bottom-tooltip:hover::before { .bottom-tooltip:hover::before {
display: block; display: block;
}
.connectivity-border {
border: 15px solid #00A0C6;
} }
\ No newline at end of file
...@@ -17,6 +17,7 @@ from compendium_v2.routes.response import routes as response_routes ...@@ -17,6 +17,7 @@ from compendium_v2.routes.response import routes as response_routes
from compendium_v2.routes.traffic import routes as traffic_routes from compendium_v2.routes.traffic import routes as traffic_routes
from compendium_v2.routes.institutions_urls import routes as institutions_urls_routes from compendium_v2.routes.institutions_urls import routes as institutions_urls_routes
from compendium_v2.routes.nren_services import routes as nren_services_routes from compendium_v2.routes.nren_services import routes as nren_services_routes
from compendium_v2.routes.connectivity import routes as connectivity
routes = Blueprint('compendium-v2-api', __name__) routes = Blueprint('compendium-v2-api', __name__)
routes.register_blueprint(budget_routes, url_prefix='/budget') routes.register_blueprint(budget_routes, url_prefix='/budget')
...@@ -33,6 +34,7 @@ routes.register_blueprint(response_routes, url_prefix='/response') ...@@ -33,6 +34,7 @@ routes.register_blueprint(response_routes, url_prefix='/response')
routes.register_blueprint(traffic_routes, url_prefix='/traffic') routes.register_blueprint(traffic_routes, url_prefix='/traffic')
routes.register_blueprint(institutions_urls_routes, url_prefix='/institutions-urls') routes.register_blueprint(institutions_urls_routes, url_prefix='/institutions-urls')
routes.register_blueprint(nren_services_routes, url_prefix='/nren-services') routes.register_blueprint(nren_services_routes, url_prefix='/nren-services')
routes.register_blueprint(connectivity, url_prefix='/connectivity')
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
......
import logging
from typing import Any
from flask import Blueprint, jsonify
from compendium_v2.db.presentation_model_enums import CarryMechanism
from compendium_v2.db.presentation_models import ConnectedProportion
from compendium_v2.db.presentation_models import ConnectivityLevel
from compendium_v2.db.presentation_models import ConnectionCarrier
from compendium_v2.db.presentation_models import ConnectivityLoad
from compendium_v2.db.presentation_models import ConnectivityGrowth
from compendium_v2.db.presentation_models import CommercialConnectivity
from compendium_v2.db.presentation_models import CommercialChargingLevel
from compendium_v2.db.presentation_models import ConnectivityCoverage
from compendium_v2.routes import common
routes = Blueprint('connectivity', __name__)
logger = logging.getLogger(__name__)
CONNECTED_PROPORTION_RESPONSE_SCHEMA = {
'$schema': 'http://json-schema.org/draft-07/schema#',
'definitions': {
'policy': {
'type': 'object',
'properties': {
'nren': {'type': 'string'},
'nren_country': {'type': 'string'},
'year': {'type': 'integer'},
'strategic_plan': {'type': 'string'},
'user_category': {'type': 'string'},
'coverage': {'type': 'string'},
'number_connected': {'type': 'integer'},
'market_share': {'type': 'integer'},
'users_served': {'type': 'integer'},
},
'required': ['nren', 'nren_country', 'year', 'user_category', 'coverage', 'number_connected',
'market_share', 'users_served'],
'additionalProperties': False
}
},
'type': 'array',
'items': {'$ref': '#/definitions/connected/proportion'}
}
CONNECTIVITY_LEVEL_RESPONSE_SCHEMA = {
'$schema': 'http://json-schema.org/draft-07/schema#',
'definitions': {
'policy': {
'type': 'object',
'properties': {
'nren': {'type': 'string'},
'nren_country': {'type': 'string'},
'year': {'type': 'integer'},
'strategic_plan': {'type': 'string'},
'user_category': {'type': 'string'},
'coverage': {'type': 'string'},
'number_connected': {'type': 'integer'},
'market_share': {'type': 'integer'},
'users_served': {'type': 'integer'},
},
'required': ['nren', 'nren_country', 'year', 'user_category', 'coverage', 'number_connected',
'market_share', 'users_served'],
'additionalProperties': False
}
},
'type': 'array',
'items': {'$ref': '#/definitions/connected/proportion'}
}
CONNECTION_CARRIER_RESPONSE_SCHEMA = {
'$schema': 'http://json-schema.org/draft-07/schema#',
'definitions': {
'policy': {
'type': 'object',
'properties': {
'nren': {'type': 'string'},
'nren_country': {'type': 'string'},
'year': {'type': 'integer'},
'strategic_plan': {'type': 'string'},
'user_category': {'type': 'string'},
'coverage': {'type': 'string'},
'number_connected': {'type': 'integer'},
'market_share': {'type': 'integer'},
'users_served': {'type': 'integer'},
},
'required': ['nren', 'nren_country', 'year', 'user_category', 'coverage', 'number_connected',
'market_share', 'users_served'],
'additionalProperties': False
}
},
'type': 'array',
'items': {'$ref': '#/definitions/connected/proportion'}
}
CONNECTIVITY_LOAD_RESPONSE_SCHEMA = {
'$schema': 'http://json-schema.org/draft-07/schema#',
'definitions': {
'policy': {
'type': 'object',
'properties': {
'nren': {'type': 'string'},
'nren_country': {'type': 'string'},
'year': {'type': 'integer'},
'strategic_plan': {'type': 'string'},
'user_category': {'type': 'string'},
'coverage': {'type': 'string'},
'number_connected': {'type': 'integer'},
'market_share': {'type': 'integer'},
'users_served': {'type': 'integer'},
},
'required': ['nren', 'nren_country', 'year', 'user_category', 'coverage', 'number_connected',
'market_share', 'users_served'],
'additionalProperties': False
}
},
'type': 'array',
'items': {'$ref': '#/definitions/connectivity/load'}
}
CONNECTIVITY_GROWTH_RESPONSE_SCHEMA = {
'$schema': 'http://json-schema.org/draft-07/schema#',
'definitions': {
'policy': {
'type': 'object',
'properties': {
'nren': {'type': 'string'},
'nren_country': {'type': 'string'},
'year': {'type': 'integer'},
'strategic_plan': {'type': 'string'},
'user_category': {'type': 'string'},
'coverage': {'type': 'string'},
'number_connected': {'type': 'integer'},
'market_share': {'type': 'integer'},
'users_served': {'type': 'integer'},
},
'required': ['nren', 'nren_country', 'year', 'user_category', 'coverage', 'number_connected',
'market_share', 'users_served'],
'additionalProperties': False
}
},
'type': 'array',
'items': {'$ref': '#/definitions/connected/proportion'}
}
COMMERCIAL_CONNECTIVITY_RESPONSE_SCHEMA = {
'$schema': 'http://json-schema.org/draft-07/schema#',
'definitions': {
'policy': {
'type': 'object',
'properties': {
'nren': {'type': 'string'},
'nren_country': {'type': 'string'},
'year': {'type': 'integer'},
'strategic_plan': {'type': 'string'},
'user_category': {'type': 'string'},
'coverage': {'type': 'string'},
'number_connected': {'type': 'integer'},
'market_share': {'type': 'integer'},
'users_served': {'type': 'integer'},
},
'required': ['nren', 'nren_country', 'year', 'user_category', 'coverage', 'number_connected',
'market_share', 'users_served'],
'additionalProperties': False
}
},
'type': 'array',
'items': {'$ref': '#/definitions/connected/proportion'}
}
COMMERCIAL_CHARGING_LEVEL_RESPONSE_SCHEMA = {
'$schema': 'http://json-schema.org/draft-07/schema#',
'definitions': {
'policy': {
'type': 'object',
'properties': {
'nren': {'type': 'string'},
'nren_country': {'type': 'string'},
'year': {'type': 'integer'},
'collaboration': {'type': 'string'},
'service_supplier': {'type': 'string'},
'direct_peering': {'type': 'string'}
},
'required': ['nren', 'nren_country', 'year', 'collaboration', 'service_supplier', 'direct_peering'],
'additionalProperties': False
}
},
'type': 'array',
'items': {'$ref': '#/definitions/connected/proportion'}
}
@routes.route('/proportion', methods=['GET'])
@common.require_accepts_json
def connected_proportion_view() -> Any:
"""
handler for /api/connectivity/proportion/ requests
returns policy information for each NREN/year combination
response will be formatted as:
.. asjson::
compendium_v2.routes.connectivity.CONNECTED_PROPORTION_RESPONSE_SCHEMA
:return:
"""
def _extract_data(connected_proportion: ConnectedProportion):
data = {
'nren': connected_proportion.nren.name,
'nren_country': connected_proportion.nren.country,
'year': connected_proportion.year,
'user_category': connected_proportion.user_category.value
if connected_proportion.user_category is not None else None,
'coverage': connected_proportion.coverage.value
if connected_proportion.coverage is not None else ConnectivityCoverage.unsure.value,
'number_connected': connected_proportion.number_connected,
'market_share': connected_proportion.market_share,
'users_served': connected_proportion.users_served
}
return data
entries = [_extract_data(entry) for entry in common.get_data(ConnectedProportion)]
return jsonify(entries)
@routes.route('/level', methods=['GET'])
@common.require_accepts_json
def connectivity_level_view() -> Any:
"""
handler for /api/connectivity/level/ requests
returns policy information for each NREN/year combination
response will be formatted as:
.. asjson::
compendium_v2.routes.connectivity.CONNECTIVITY_LEVEL_RESPONSE_SCHEMA
:return:
"""
def _extract_data(connectivity_level: ConnectivityLevel):
return {
'nren': connectivity_level.nren.name,
'nren_country': connectivity_level.nren.country,
'year': connectivity_level.year,
'user_category': connectivity_level.user_category.value,
'typical_speed': connectivity_level.typical_speed,
'highest_speed': connectivity_level.highest_speed,
'highest_speed_proportion': connectivity_level.highest_speed_proportion,
}
entries = [_extract_data(entry) for entry in common.get_data(ConnectivityLevel)]
return jsonify(entries)
@routes.route('/carrier', methods=['GET'])
@common.require_accepts_json
def connectection_carrier_view() -> Any:
"""
handler for /api/connectivity/carrier/ requests
returns policy information for each NREN/year combination
response will be formatted as:
.. asjson::
compendium_v2.routes.connectivity.CONNECTION_CARRIER_RESPONSE_SCHEMA
:return:
"""
def _extract_data(connection_carrier: ConnectionCarrier):
return {
'nren': connection_carrier.nren.name,
'nren_country': connection_carrier.nren.country,
'year': connection_carrier.year,
'user_category': connection_carrier.user_category.value,
'carry_mechanism': connection_carrier.carry_mechanism.value
if connection_carrier.carry_mechanism is not None else CarryMechanism.other.value,
}
entries = [_extract_data(entry) for entry in common.get_data(ConnectionCarrier)]
return jsonify(entries)
@routes.route('/load', methods=['GET'])
@common.require_accepts_json
def connectivity_load_view() -> Any:
"""
handler for /api/connectivity/load/ requests
returns policy information for each NREN/year combination
response will be formatted as:
.. asjson::
compendium_v2.routes.connectivity.CONNECTIVITY_LOAD_RESPONSE_SCHEMA
:return:
"""
def _extract_data(connectivity_load: ConnectivityLoad):
return {
'nren': connectivity_load.nren.name,
'nren_country': connectivity_load.nren.country,
'year': connectivity_load.year,
'user_category': connectivity_load.user_category.value,
'average_load_from_institutions': connectivity_load.average_load_from_institutions,
'average_load_to_institutions': connectivity_load.average_load_to_institutions,
'peak_load_from_institutions': connectivity_load.peak_load_from_institutions,
'peak_load_to_institutions': connectivity_load.peak_load_to_institutions,
}
entries = [_extract_data(entry) for entry in common.get_data(ConnectivityLoad)]
return jsonify(entries)
@routes.route('/growth', methods=['GET'])
@common.require_accepts_json
def connectivity_growth_view() -> Any:
"""
handler for /api/connectivity/growth/ requests
returns policy information for each NREN/year combination
response will be formatted as:
.. asjson::
compendium_v2.routes.connectivity.CONNECTIVITY_GROWTH_RESPONSE_SCHEMA
:return:
"""
def _extract_data(connectivity_growth: ConnectivityGrowth):
return {
'nren': connectivity_growth.nren.name,
'nren_country': connectivity_growth.nren.country,
'year': connectivity_growth.year,
'user_category': connectivity_growth.user_category.value,
'growth': connectivity_growth.growth,
}
entries = [_extract_data(entry) for entry in common.get_data(ConnectivityGrowth)]
return jsonify(entries)
@routes.route('/commercial', methods=['GET'])
@common.require_accepts_json
def commercial_connectivity_view() -> Any:
"""
handler for /api/connectivity/commercial/ requests
returns policy information for each NREN/year combination
response will be formatted as:
.. asjson::
compendium_v2.routes.connectivity.COMMERCIAL_CONNECTIVITY_RESPONSE_SCHEMA
:return:
"""
def _extract_data(commercial_connectivity: CommercialConnectivity):
return {
'nren': commercial_connectivity.nren.name,
'nren_country': commercial_connectivity.nren.country,
'year': commercial_connectivity.year,
'commercial_r_and_e': commercial_connectivity.commercial_r_and_e.value
if commercial_connectivity.commercial_r_and_e is not None else None,
'commercial_general': commercial_connectivity.commercial_general.value
if commercial_connectivity.commercial_general is not None else None,
'commercial_collaboration': commercial_connectivity.commercial_collaboration.value
if commercial_connectivity.commercial_collaboration is not None else None,
'commercial_service_provider': commercial_connectivity.commercial_service_provider.value
if commercial_connectivity.commercial_service_provider is not None else None,
'university_spin_off': commercial_connectivity.university_spin_off.value
if commercial_connectivity.university_spin_off is not None else None,
}
entries = [_extract_data(entry) for entry in common.get_data(CommercialConnectivity)]
return jsonify(entries)
@routes.route('/charging', methods=['GET'])
@common.require_accepts_json
def commercial_charging_level_view() -> Any:
"""
handler for /api/connectivity/charging/ requests
returns policy information for each NREN/year combination
response will be formatted as:
.. asjson::
compendium_v2.routes.connectivity.COMMERCIAL_CHARGING_LEVEL_RESPONSE_SCHEMA
:return:
"""
def _extract_data(commercial_charging_level: CommercialChargingLevel):
return {
'nren': commercial_charging_level.nren.name,
'nren_country': commercial_charging_level.nren.country,
'year': commercial_charging_level.year,
'collaboration': commercial_charging_level.collaboration.value
if commercial_charging_level.collaboration is not None else None,
'service_supplier': commercial_charging_level.service_supplier.value
if commercial_charging_level.service_supplier is not None else None,
'direct_peering': commercial_charging_level.direct_peering.value
if commercial_charging_level.direct_peering is not None else None,
}
entries = [_extract_data(entry) for entry in common.get_data(CommercialChargingLevel)]
return jsonify(entries)
This diff is collapsed.
...@@ -2,7 +2,7 @@ from setuptools import setup, find_packages ...@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup( setup(
name='compendium-v2', name='compendium-v2',
version="0.39", version="0.40",
author='GEANT', author='GEANT',
author_email='swd@geant.org', author_email='swd@geant.org',
description='Flask and React project for displaying ' description='Flask and React project for displaying '
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment