New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generic, user customizable events #217
Comments
To add some links to relevant issues:
|
This is an interesting idea. I certainly would not be opposed to it. This is kind of how I envision the "Notes" model right now so maybe we could just expand on that... If this generic model itself is configurable (as you outline in the "some more custom-y fields that can be relevant" list) that will definitely ramp up the complexity both from a maintenance and UX perspective. It would be nice if we could, as you say, identify some of these common factors and then maybe add just one system-wide configurable field "category" (or something) that would be a select list on the generic. For example a user could configure categories of "Bathing", "Nail trimming", "Pumping", etc. and would select one of those options for the entry. That would probably make it easier to pivot data for things like display, data viz, and API retrieval. So if we wanted to just repurpose notes for this we could:
Then it would just be a matter of refactoring the current behaviors to support those fields. |
Just to go into a little more detail about how my suggestion above would work from a technical PoV. Data model
Description model
At runtime, all values are written / fetched from the So in a DB-table view, this would look like: Description model table
Data model table
Additionally, one could introduce custom I'm not aware of the inner workings of BabyBuddy and or Django, so I don't know if the above would clash with basic principles. From a short glimpse into the Django docs, I guess that there should be no major hurdles (might be different for custom dropdowns?). The advantages I see are that a) each user can define their things to track, b) there are only generic models at work in the background (no issues with updates / migration), c) the generic / custom-y fields allow to represent and analyze user-defined data (value As I understand your post, my thoughts above are quite similar to what you suggest with the extended notes, plus the generic fields. What you call categories kinda maps to my "description model", and the generic fields are simply a further extension. One might be able to tackle it in smaller steps - extended notes first, generic fields later. So much for the moment. Does this make sense to you? |
Yep. Makes sense and I am on board. But it’s a pretty big enhancement. There may be existing tooling for Django that would make this much easier. Here’s a potentially relevant (if outdated) SO discussion: https://stackoverflow.com/questions/7933596/django-dynamic-model-fields |
Great! While the SO discussion is a little dated, I guess that the basic principles of the top answer are still valid. My Google-Fu did not turn up many additional interesting results. Quick summary:
Further, there seems to be some implementation in django-payslip to add fields to models, but this is hand-coded and not a ready-for-use tool. django-user-defined-fields seems to be built on top of The problem I see with all solutions that make use of something json-like, i.e. storing multiple, arbitrary key-value-pairs in one field, is that of consistency. Each record is saved with the latest defined schema, but stored fields are not updated when the schema changes. Let's say I were to set up my So currently, I'd vote for a solution as described above, that enforces consistency by always interpreting everything based on the latest description/schema. I fear that this would mean "hand-written" code instead of existing tooling, but would be happy to learn about other options! |
I am currently using baby buddy and am feeling the pain of not having this functionality right now. |
Yep! Definitely open to PRs here. |
Browsing through the issues, there are multiple requests for specific additional tasks/things to keep track of (medication, baby height, ...).
Most of them have almost the same requirements:
fluid
vs.hard
with the diaper change)Rather than implementing explicit models for all of the requested features, I'd propose adding a generic
CustomEvent
model that offers the generic fields listed above. The user could then first add the tasks they want to track in an admin menu and potentially define which of the available fields are relevant. These tasks would then be available in the frontend as usual, maybe under a new "custom tasks" item.In my opinion, this would significantly extend the functionality (what you can jot down on a piece of paper, you could then also track in Baby Buddy) without bloating the interface with various things that some users might never care about (as it only offers what you configured).
Also, having everything in the same model would make it easy(-ish) for example to extend the sleep pattern style view to display additional tracked things.
Thoughts? Opinions?
The text was updated successfully, but these errors were encountered: