Materials-Consortia / optimade-python-tools

Tools for implementing and consuming OPTIMADE APIs in Python
https://www.optimade.org/optimade-python-tools/
MIT License
69 stars 42 forks source link

Internal validator failures #1272

Closed jjmortensen closed 2 years ago

jjmortensen commented 2 years ago

See: https://gitlab.com/jensj/ase-optimade/-/jobs/2709917839

ml-evs commented 2 years ago

Thanks for the report @jjmortensen, could you paste the response to the failing query on your local server? Looks like /structures?filter=id%20%3E%20%221%22. It is probably caused by one of your structure entries having a missing type field and by this point of validation we assume it is present.

jjmortensen commented 2 years ago
{
    "data": [
        {
            "id": "2",
            "attributes": {
                "cartesian_site_positions": [
                    [
                        0.0,
                        0.0,
                        0.0
                    ],
                    [
                        0.0,
                        0.0,
                        0.0
                    ]
                ],
                "species_at_sites": [
                    "C",
                    "O"
                ],
                "species": [
                    {
                        "name": "C",
                        "chemical_symbols": [
                            "C"
                        ],
                        "concentration": [
                            1.0
                        ]
                    },
                    {
                        "name": "O",
                        "chemical_symbols": [
                            "O"
                        ],
                        "concentration": [
                            1.0
                        ]
                    }
                ],
                "lattice_vectors": [
                    [
                        0.0,
                        0.0,
                        0.0
                    ],
                    [
                        0.0,
                        0.0,
                        0.0
                    ],
                    [
                        0.0,
                        0.0,
                        0.0
                    ]
                ],
                "dimension_types": [
                    1,
                    1,
                    1
                ],
                "last_modified": "2022-07-12T13:32:57Z",
                "elements": [
                    "C",
                    "O"
                ],
                "elements_ratios": [
                    0.5,
                    0.5
                ],
                "structure_features": [],
                "id": "2",
                "chemical_formula_descriptive": "x",
                "chemical_formula_reduced": "CO",
                "chemical_formula_anonymous": "AB",
                "chemical_formula_hill": "CO",
                "nsites": 2,
                "nelements": 2,
                "nperiodic_dimensions": 3
            }
        }
    ],
    "meta": {
        "query": {
            "representation": "/info?"
        },
        "api_version": "1.1.0",
        "more_data_available": false,
        "data_returned": 1,
        "provider": {
            "name": "OASE",
            "description": "OPTIMADE for ASE",
            "prefix": "cmr",
            "homepage": "https://gitlab.com/jensj/ase-optimade"
        },
        "data_available": 1,
        "implementation": {
            "name": "oase",
            "version": "22.7.0",
            "source_url": "https://gitlab.com/jensj/ase-optimade",
            "maintainer": {
                "email": "jjmo@dtu.dk"
            }
        },
        "time_stamp": "2022-07-12 15:33:01.980485"
    }
}
jjmortensen commented 2 years ago

Indeed, adding "type": "structures" fixes it!

jjmortensen commented 2 years ago

Thanks!

ml-evs commented 2 years ago

Great, we've tried to wrap other internal errors like this as validation failures so I think it's useful to keep this open as a non-urgent issue and I will get around to tweaking it for the next release.