Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export to FS DB format. #43

Closed
philderbeast opened this issue Nov 9, 2019 · 10 comments
Closed

Export to FS DB format. #43

philderbeast opened this issue Nov 9, 2019 · 10 comments
Assignees

Comments

@philderbeast
Copy link
Member

https://github.com/kuaka/airscore/blob/6456bb9d69e9a4fefd280a746bf977ffbf3e3e51/cgi-bin/fsdb.py#L3-L4

If we had export to *.fsdb, the XML of FS, then we could do visual comparisons to a reference implementation of GAP, geoffwong/airscore#3 (comment)

The *.fsdb file contains inputs and outputs (the scores) as well as some other data of interest in checking the scores. If you are able to export from airscore to this FS XML format then flare-timing can be used to visually check those scores, as I've done for the 2018 XC Dalmatian Paragliding Open. For that comp, if you select a task, then under the [Score] tab you'll see tables and in these the black columns show values picked up from the *.fsdb file and the difference to those same values as calculated by flare-timing, acting here as a reference implementation.

@biuti
Copy link
Collaborator

biuti commented Nov 11, 2019

I create a class to deal with FSDB.
It was some time ago tho and a lot of things changed since I created it.

I will update in new_code branch that file, changing the import function if needed, and creating the export one.

On a side note, task JSON files created from AirScore contain almost the same infos with very similar names to FSDB, so for comparing porpoise, they could be useful meanwhile.

@biuti
Copy link
Collaborator

biuti commented May 19, 2020

FSDB export should be fixed with commit abcb7f3

Still needs a frontend link.
From console, if comp_id is comp ID:

from fsdb import FSDB
f = FSDB.read(comp_id)
f.to_file()

creates fsdb file in results folder

@kuaka
Copy link
Collaborator

kuaka commented May 28, 2020

Trying to get this working for the front end but it seems to give an error with the comps that I have tried:

f = FSDB.read(52)
Traceback (most recent call last):
File "", line 1, in
File "/app/airscore/core/fsdb.py", line 62, in read
tree = ET.parse(fp)
File "src/lxml/etree.pyx", line 3521, in lxml.etree.parse
File "src/lxml/parser.pxi", line 1862, in lxml.etree._parseDocument
TypeError: cannot parse from 'int'

also FSDB.to_file needs a docstring. I started writing it but I am not familiar enough to write a decent one. (for example what is the filename? does it overwrite if file exists?)

@biuti
Copy link
Collaborator

biuti commented May 28, 2020

My fault, the correct sequence is:

from fsdb import FSDB
f = FSDB.create(comp_id)
f.to_file()

docstring updated in commit 2ff1d6c

@kuaka
Copy link
Collaborator

kuaka commented May 29, 2020

Still not working with comp 45 (HG worlds). latest result files attached.
HGworlds.zip

File "core/compUtils.py", line 105, in is_ext
ext = db.session.query(C.external).filter_by(comp_id=comp_id).one().scalar()
AttributeError: 'result' object has no attribute 'scalar'

@biuti
Copy link
Collaborator

biuti commented May 29, 2020

Fixed with commit ee86cbe

@kuaka
Copy link
Collaborator

kuaka commented May 30, 2020

Have you tested this from start to finish?
I am still not able to make a file:
from fsdb import FSDB
f=FSDB.create(45)
f.to_file()
Traceback (most recent call last):
File "", line 1, in
File "/app/airscore/core/fsdb.py", line 459, in to_file
'penalty': 0 if not [n for n in res.notifications
File "/app/airscore/core/fsdb.py", line 460, in
if n.percentage_penalty > 0] else max(
AttributeError: 'dict' object has no attribute 'percentage_penalty'

@biuti
Copy link
Collaborator

biuti commented May 30, 2020

Sorry I was working on a quite different branch.
Now (should be) fixed with 26e09a5

@kuaka
Copy link
Collaborator

kuaka commented Jun 2, 2020

This has been added to the front end with commit 430478e however the actual fsdb files need testing or verifying that they work.

@biuti
Copy link
Collaborator

biuti commented Jun 2, 2020

The routine looks for the active comp result json file, so it returns None if event has not been scored yet.
In my opinion this is correct, unless we want to be able to export, for example, registered pilots list in FSDB format.
I don't think this should be a priority, but it would be possible to implement.

@kuaka kuaka closed this as completed Jun 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants