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

Raised Validation Error under 4.2.1 #93

Closed
JAC28 opened this issue Dec 5, 2022 · 4 comments
Closed

Raised Validation Error under 4.2.1 #93

JAC28 opened this issue Dec 5, 2022 · 4 comments

Comments

@JAC28
Copy link

JAC28 commented Dec 5, 2022

I am trying to implement yadg into our data-workflow. Great project!

Following the provided example from Binder for Biologic files I fail due to various problems under yadg version 4.2.1 dependent on the provided files and schema content.
As schema the structure from Binder (see below) was used. For parsing .mpt-file exported from my EC-Lab the second step was added.
Since the Binder example states "schema_version": "4.0.0" both 4.0.0 and 4.2.1 was tested. Within all tests, the example files gcpl.mpt, ocv.mpt and peis.mpr were parsed.

 {
    "metadata": {
        "provenance": "manual",
        "schema_version": "4.0.0"
    },
    "steps": [
        {
            "parser": "electrochem",
            "import": {
                "files": ["data/ocv.mpt", "data/gcpl.mpt"],
                "encoding": "windows-1252"
            },
            "parameters": {"filetype": "eclab.mpt"}
        },
		{
            "parser": "electrochem",
            "import": {
                "folders": ["data"],
				"suffix" : ".mpt",
                "encoding": "windows-1252"
            },
            "parameters": {"filetype": "eclab.mpt"}
        },
        {
            "parser": "electrochem",
            "import": {
                "folders": ["data"],
                "suffix": ".mpr"
            },
            "parameters": {"filetype": "eclab.mpr"}
        }
    ]
}

To sum up the gathered results:

schema_version individual .mpt Export Result
4.0.0 x TypeError: unsupported operand type(s) for -: 'str' and 'str', solved in #88 ?
4.0.0 o Success
4.2.1 x 126 validation errors for DataSchema, unexpected value; permitted: 'dummy'
4.2.1 o 85 validation errors for DataSchema, unexpected value; permitted: 'dummy'

The unexpected value; permitted: -message is raised for every parsers.

Since the error is independent of my .mpt file, it seems that the version of the provided schema_version cause some kind of bug.

@PeterKraus
Copy link
Contributor

PeterKraus commented Dec 5, 2022

Yes, the Pydantic parser for the schema is really not useful in figuring out where the problem is. I need to make that more user-friendly for yadg-5.0. There shouldn't be any problem using schema_version: "4.0.0" with the newest version of yadg for now, apart from getting one warning about out-of-date schema.

There are several breaking changes between the DataSchema-4.0 and DataSchema-4.2. Let me know if the docs are not helpful enough to make the switch between the two schemas.

@JAC28
Copy link
Author

JAC28 commented Dec 6, 2022

Thank you for your quick reply, I will try to work with 4.0.0

FYI:
I got

Eranges.append(E_range_max - E_range_min)
TypeError: unsupported operand type(s) for -: 'str' and 'str'

in eclabmpt.py l. 317 due to my (german) decimal seperator "," which was not parsed properly. I fixed it by addding
float(el.get("E_range_max", float("inf")).replace(',','.')) to l. 315 and 316 - however, there might be a more elegant way. :) Propbably, this problem might araise with at other places as well.

My .mpt file contains 154 for the value of I_range which results in

ValueError: element '154' for parameter 'I_range' not understood.

in eclabtechniques.py in l. 1039. I was not able to reconstruct why my Biologic exports this value and will further investigate.

@PeterKraus
Copy link
Contributor

I didn't know mpt files were localised. That's a bug. Could you please upload the mpt (and ideally the mpr, if you have it) in a new issue? I'll have to think of a solution without having to replace every float() call, and it would be good to have a test file. It should also be possible to figure out the appropriate I_range.

I made a note for myself that the DataSchema validation could be improved for yadg-5.0, and I wouldn't mind closing this one in favour of #94 if that's OK with you.

@JAC28
Copy link
Author

JAC28 commented Dec 7, 2022

Yes, closing this issue ist fine. I will create .mpr and .mpt files with my equipment that I can share and open a new issue for potential localisation problems.

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

2 participants