Skip to content

Commit

Permalink
towards task autmation for CSH
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Gebhardt authored and Tom Gebhardt committed Oct 25, 2023
1 parent f3267e2 commit 0368ef1
Show file tree
Hide file tree
Showing 8 changed files with 343 additions and 76 deletions.
9 changes: 0 additions & 9 deletions app/csh_schemas/v3.0.json

This file was deleted.

2 changes: 0 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from fastapi.middleware.cors import CORSMiddleware

from app.routers.router import base_router
from app.routers.csh_router import csh_router
from app.metrics.assessments_lifespan import get_tasks_definitions
from app.dependencies.settings import get_settings

Expand Down Expand Up @@ -50,7 +49,6 @@
lifespan=get_tasks_definitions,
)
app.include_router(base_router)
app.include_router(csh_router)

config = get_settings()
origins = config.allowed_origins
Expand Down
14 changes: 11 additions & 3 deletions app/metrics/assessments_lifespan.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ async def get_tasks_definitions(app: FastAPI):
config = get_settings()

def parse_line(line):
sub_group = regex_csh.search(line["TaskName"]).groups()[0]
sub_group = regex_csh.search(line["TaskName"])
if sub_group is None:
return
sub_group = sub_group.groups()[0]
task_group = sub_group[0]
return {
line["TaskName"]: models.Indicator(
Expand All @@ -39,8 +42,13 @@ def parse_line(line):
}

# Get the list of tasks and their definitions from internal file
with open(config.csh_indicators_path, "r") as file_handler:
with open(config.indicators_path, "r") as file_handler:
csv_reader = DictReader(file_handler, dialect="unix")
[fair_indicators.update(parse_line(line)) for line in csv_reader]
for line in csv_reader:
parsed_line = parse_line(line)
if parsed_line is not None:
print(parsed_line)
fair_indicators.update(parsed_line)
#[fair_indicators.update(parse_line(line)) for line in csv_reader]

yield
2 changes: 2 additions & 0 deletions app/metrics/metrics.csv
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,5 @@
"CA-RDA-R1.3-02MM","Essential","Metadata of model is expressed in compliance with a machine-understandable community standard","This indicator requires that the model metadata follows a community standard that has a machine-understandable expression","This indicator can be evaluated by verifying that the community standard used f or the metadata has a machine-understandable expression"
"CA-RDA-R1.3-03MA","Important","Metadata of archive is expressed in compliance with a machine-understandable cross-community standard","This indicator requires that the archive metadata follows a cross-community standard that has a machine-understandable expression","This indicator can be evaluated by verifying that the cross-community standard used f or the metadata has a machine-understandable expression"
"CA-RDA-R1.3-03MM","Important","Metadata of model is expressed in compliance with a machine-understandable cross-community standard","This indicator requires that the model metadata follows a cross-community standard that has a machine-understandable expression","This indicator can be evaluated by verifying that the cross-community standard used f or the metadata has a machine-understandable expression"
"CSH-RDA-F1-01","Important","Is a unique identifier assigned to the study","This indicator is the inital test indicator for evaluating elemts from the CSH","And some more details","??"
"CSH-RDA-F2-01","Essential","Something else","And some more details","??"
58 changes: 0 additions & 58 deletions app/models/csh.py

This file was deleted.

5 changes: 5 additions & 0 deletions app/models/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,10 @@ def _get_default_task_status(self, indicator: str) -> tuple[TaskStatus, bool]:

if indicator in config.pmr_indicator_status and self.user_input.is_pmr:
return TaskStatus(config.pmr_assessment_status[indicator]), True

if indicator in config.csh_metadata_status:
print("+++++++HUHU++++++")
return TaskStatus(config.csh_metadata_status[indicator]), True

if indicator in config.assessment_dependencies:
dependency_dict = config.assessment_dependencies[indicator]
Expand Down Expand Up @@ -577,6 +581,7 @@ def start_automated_tasks(self):
"""Starts the assessment of automated tasks"""
for task_id in self.indicator_tasks.values():
task = self.session_model.get_task(task_id)
print(task)
if isinstance(task, AutomatedTask):
task.do_evaluate(self.assessed_data.dict())

Expand Down
1 change: 0 additions & 1 deletion app/routers/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

base_router = APIRouter()

print("TESTSTSTS")
@base_router.post("/session", tags=["Sessions"])
def create_session(
subject: SessionSubjectIn = Depends(SessionSubjectIn.as_form),
Expand Down
Loading

0 comments on commit 0368ef1

Please sign in to comment.