Futsch1 / medTimer

MedTimer Android app
MIT License
123 stars 14 forks source link

Pill count and refill reminder #250

Open SATISHDEEPU opened 2 months ago

SATISHDEEPU commented 2 months ago

Can you please add a option to get the count of pills remaining and refill alert. It would be great if you could add this feature

Futsch1 commented 2 months ago

This was already asked some time ago and would be a major new feature. I currently have no time to work on this, but I'll keep it open to track potential progress and discussion about it.

Blend3rman commented 1 month ago

@Futsch1 could you perhaps outline the steps needed to implement this feature? From what I can gather, they would be:

Futsch1 commented 1 month ago

@Blend3rman your points would summarize the basic ideas.

In terms of database, there would be two aspects to consider: One is the remaining amount of the medicine - this should be added to the Medicine table. To start easy, it might be enough to only have one refill reminder setting per medicine (like on/off and reminder threshold). This way, no new table is required and these settings can also be added to the Medicine table.

The decrement feature would be a bit more tricky. What I could think of is to have a second amount field where the user can add the actual value the medicine amount is decreased per dosage (like you would have the amount as "1 tbl spoon", you would set the decrease amount to "10" representing 10 ml). If the amount is a number, this decrease amount could be filled automatically. However, the alternative using units is also possible, albeit more complex I guess.

Regarding the UX, you would have to work with the layout XMLs. The app uses Android navigation (https://developer.android.com/guide/navigation) and fragments classes associated with each screen. I have not worked with ViewModels a lot, since most of the fragments are just pure configuration screens and the state of the data does not change by itself. So the classes corresponding to the fragments contain the logic to put the database fields into the UI fields and back.

Concerning testing, unit tests are used for the core business logic and some helpers. For UI centric features, Android test via Espresso is the way to go.

In terms of code quality, SonarQube is used and should be added to AndroidStudio as a plugin.

Blend3rman commented 1 month ago

@Futsch1 Thank you for the details! I'll try figuring this out slowly.