maykinmedia / commonground-api-common Goto Github PK
View Code? Open in Web Editor NEWThis project forked from vng-realisatie/vng-api-common
Shared functions between Common Ground API components
This project forked from vng-realisatie/vng-api-common
Shared functions between Common Ground API components
Should be tackled in notifications-api-common (partially) - but the interaction is definitely relevant.
We now have Audit trail, notification and cache mixins/decorators that all operate on the viewset action serializer (instance). Often these mixins query the involved object and/or construct a fresh serializer instance. Serializing each of these instances of the same serializer class results in bad query performance because it repeats queries that were done already, especially to serialize the response data.
This whole mixin approach needs to be revisited for a better/more granular approach giving more control for re-use of instances that can leverage their own caches, so that performance is maximized without dirty tricks.
Additionally, the @transaction.atomic
behaviour should either be configurable or managed in the downstream project - now often mixins create stacks of savepoints/savepoint releases that introduce unnecessary query IO.
We can rely 100% on zgw-consumers instead of having this mixed approach based on a vanilla gemma-zds-client implementation.
zgw-consumers is richer and provides django support. The core mechanisms (get_auth
etc.) should be adapted to build on top of zgw-consumers.
For example: ETag updates
On create/update of resources we schedule etag (re-)calculations that are currently done in the request-response cycle. Since the caching decorator only emits this header for detail resources (retrieve action), this does not have to commit in that cycle - meaning we can delegate that to celery.
This can seriously boost performance, especially if the involved resource is input for many other resources that may need to be recalculated (e.g. zaak-status).
Alternatively, we should investigate a mechanism to better avoid queries that don't matter anyway and/or better de-duplicate etag updates.
Possibly it must be possible per operation/endpoint/viewset to specify whether the update should be sync or async.
After 1.9.0 the refactor from upstream to drf-spectacular has been started/done, so we should take a critical look at that before adopting it.
Once this fork is on 1.9.0, we can swap out vng-api-common in Open Zaak with commonground-api-common and continue development independently.
Currently the GegevensGroepSerializer
works by invoking multiple setattr
calls on the instance after calling the parent create()
or update()
methods. This is done in an atomic DB transaction, which has some drawbacks:
.save
callThe performance problems have been observed in the Zaak create endpoint in Open Zaak, see open-zaak/open-zaak#1271
This should instead be reworked according to the following ideas/principles:
source="*"
and the correct nested serializer field mapping via foo = serializser.Field(source="some_prefix_foo")
(see the ModelTranslationSerializer
in Open Forms for an example)models.CheckConstraint
for data integrity purposestransaction.atomic
- refactoring in proper serializer fields with source
attributes should automatically do the attribute assignment, which allows us to drop the custom create
and update
implementation. This also removes the need for the mixin.The following patterns are outdated or obsolete and should no longer be supported:
(will require a bump to 2.0 to stick to semver)
vng_api_common.mocks
, downstream needs to use requests-mock or similar instead. Lots of overlap with zgw-consumers, so possibly introduce that as dependency?vng_api_common.notifications
- make sure migrations have been executed to notifications-api-commonA declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.