alexcorvi / apexo

A web/desktop application to manage your dental clinic practice.
https://apexo.app
MIT License
84 stars 46 forks source link

Can we reduce additional space from DB #169

Closed mohamadRoc closed 4 years ago

mohamadRoc commented 4 years ago

Hi Alex, I noticed in the last release the generated documents got a long Id E.g. "34d9530c-9bd2-4488-bd10-2e5a20958dfd", but at some early point it was only 12 chars, is there a chance to have conflict on 12 chars,

and I wonder if we can shrink space by eliminating unused keys from each document E.g. in patient document, usually we don't use or change the following keys, the majority of our patients got this same key-values: "avatar": "", "birthYear": 0, "gender": "male", "tags": "", "address": "", "email": "", "phone": "", "medicalHistory": [], "gallery": [], "teeth": [], "labels": [],

what if we remove these keys from each object and use some kind of adapter in the UI that we read the patient document object through it, and it return the default values if it doesn't exist like gender = male, birth Year = 0 and teeth = [], I think this will reduce the DB size by 75%, if it's possible.

alexcorvi commented 4 years ago

The supported version already does this along with encryption. Since encrypting those objects will cause larger data size and require more computing power I have already implemented a document modifier that removes all the fields that have default values. I was planning to implement it into the community version, in the next minor release. Be sure to check it out once it's out

mohamadRoc commented 4 years ago

@alexcorvi sure, thank you

alexcorvi commented 4 years ago

Done in 4.0.1