-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- extract, isolate and package it in a completely independent Python module, versioned and in a way that allows releases on PyPI.org - fixed error in placeholder for secondary school (data registry defaults) - added restriction in pytest version to install - expected number of new cases fix - data registry update (schema v2.1.1) - github update - deprecate ExpertApplication and CO2Application - changes to reflect schema update 2.0.2 - version update - Fixed error with f_inf (short-range)
- Loading branch information
Showing
178 changed files
with
1,447 additions
and
785 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -303,3 +303,4 @@ | |
- name: PROJECT_NAME | ||
description: The name of this project, e.g. caimira-test | ||
required: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Copyright 2020-2021 CERN. All rights not expressly granted are reserved. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# """ | ||
# Entry point for the CAiMIRA application | ||
# """ | ||
|
||
import tornado.ioloop | ||
import tornado.web | ||
import tornado.log | ||
from tornado.options import define, options | ||
import logging | ||
|
||
from caimira.api.routes.report_routes import ReportHandler | ||
|
||
define("port", default=8088, help="Port to listen on", type=int) | ||
|
||
logging.basicConfig(format="%(message)s", level=logging.INFO) | ||
|
||
class Application(tornado.web.Application): | ||
def __init__(self): | ||
handlers = [ | ||
(r"/report", ReportHandler), | ||
] | ||
settings = dict( | ||
debug=True, | ||
) | ||
super(Application, self).__init__(handlers, **settings) | ||
|
||
if __name__ == "__main__": | ||
app = Application() | ||
app.listen(options.port) | ||
logging.info(f"Tornado server is running on port {options.port}") | ||
tornado.ioloop.IOLoop.current().start() |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import concurrent.futures | ||
import functools | ||
|
||
from caimira.calculator.validators.virus.virus_validator import VirusFormData | ||
from caimira.calculator.store.data_registry import DataRegistry | ||
import caimira.calculator.report.report_generator as rg | ||
|
||
|
||
def generate_form_obj(form_data, data_registry): | ||
return VirusFormData.from_dict(form_data, data_registry) | ||
|
||
|
||
def generate_model(form_obj): | ||
return form_obj.build_model(250_000) | ||
|
||
|
||
def generate_report_results(form_obj, model): | ||
return rg.calculate_report_data(form=form_obj, model=model, executor_factory=functools.partial( | ||
concurrent.futures.ThreadPoolExecutor, None, # TODO define report_parallelism | ||
),) | ||
|
||
|
||
def submit_virus_form(form_data): | ||
data_registry = DataRegistry | ||
|
||
form_obj = generate_form_obj(form_data, data_registry) | ||
model = generate_model(form_obj) | ||
report_data = generate_report_results(form_obj, model=model) | ||
|
||
return report_data |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import json | ||
import traceback | ||
import tornado.web | ||
|
||
from caimira.api.controller.report_controller import submit_virus_form | ||
|
||
class ReportHandler(tornado.web.RequestHandler): | ||
def set_default_headers(self): | ||
self.set_header("Access-Control-Allow-Origin", "*") | ||
self.set_header("Access-Control-Allow-Headers", "x-requested-with") | ||
self.set_header("Access-Control-Allow-Methods", "POST, GET, OPTIONS") | ||
|
||
def post(self): | ||
try: | ||
form_data = json.loads(self.request.body) | ||
report_data = submit_virus_form(form_data) | ||
|
||
response_data = { | ||
"status": "success", | ||
"message": "Results generated successfully", | ||
"report_data": report_data, | ||
} | ||
|
||
self.write(response_data) | ||
except Exception as e: | ||
traceback.print_exc() | ||
self.set_status(400) | ||
self.write({"message": str(e)}) |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ sphinx-rtd-theme==1.2.2 | |
pillow==5.4.1 | ||
mock==1.0.1 | ||
commonmark==0.9.1 | ||
recommonmark==0.5.0 | ||
recommonmark==0.5.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This module is part of CAiMIRA. Please see the repository at | ||
# https://gitlab.cern.ch/caimira/caimira for details of the license and terms of use. | ||
""" | ||
Documentation for the CAiMIRA package | ||
""" | ||
|
||
__version__ = "1.0.0" |
4 changes: 2 additions & 2 deletions
4
caimira/data/__init__.py → caimira/calculator/models/data/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.