Materials-Consortia / Materials-Consortia/optimade-python-tools
Add a 'production' mode that circumvents pydantic validation with .construct()
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 91
- Forks
- 54
- PR merge metrics
- No merged PRs in 30d
Description
Now that our implementations are fairly well settled, perhaps we should add a 'production' mode in the config that does not perform pydantic validation for every enrtry in every request.
We can use .construct() for this (see Creating models without validation) which offers ~x35 speed-up when initializing models (excluding the extra overhead of applying our mappers).
Ideally, this could be combined with some methods that add validation on data ingestion (via e.g. EntryCollection.insert(...)), which people have probably written custom code for already.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the configuration described in the issue and the EntryCollection.insert(...) ingestion entry point. Review how entries are currently validated and mapped, then determine the scope of a production mode and ingestion-time validation. Done should include an agreed configuration behavior and validation coverage, but the issue names no files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend-api-design, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100