How to customize upload validation

Hi invenio community,
I’m investigating invenio for a data center in astronomy. I would like to implement an additional validation on files uploaded not only based on file extension but also on an analysis of the data (based on a Python API).
Is it possible to do make a customized extension (on upload process) in the server side?and how todo?

Regards

Hello,

do you refer to InvenioRDM?

Yes it is possible, and we would also be interested in having such pluggable contribution documented for others :slight_smile:

It highly depends on you would like to block the submission/publishing of a record before your check runs or not.

One way could be to implement an async check that will run after submission (the record is not yet published, only an inclusion request is created), however this is not part of InvenioRDM v14, you need the latest development version. You can find an example [here]( zenodo-rdm/site/zenodo_rdm/checks/funding.py at master · zenodo/zenodo-rdm · GitHub ) and some doc [here](feat: async and subcommunity curation checks by mairasalazar · Pull Request #984 · inveniosoftware/docs-invenio-rdm · GitHub).

Another way would be to implement a [component]( Building services - Turn-key research data management repository ) that will trigger a celery task and work with your file.

I hope it helps, feel free to jump on our chat for faster answers.

Hi,
thank for the response, the solution of the dev version seems promising.
For the moment I can install the development version. I still have a problem with redis cache…

“ImportError: module ‘flask_caching.backends’ has no attribute ‘redis’”

If you start using the dev version, I recommend asking in the chat, where InvenioRDM maintainers can answer.
Regarding your topic, they recently fixed it, see one PR here. They can help and guide how to upgrade the modules and overcome the issue.