Skip to content
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

Database consolidation support #131

Closed
dgets opened this issue Jul 6, 2019 · 8 comments
Closed

Database consolidation support #131

dgets opened this issue Jul 6, 2019 · 8 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@dgets
Copy link
Owner

dgets commented Jul 6, 2019

Much the same as this issue already implemented in the mobile app along the same lines, we're going to implement database consolidation for when some of the administrations were implemented over a short period of time and should be consolidated into single entries. I think instead of deleting the aforementioned records, as was originally implemented in the mobile app, we are going to mark them invalid in this case, thus keeping track of the original unconsolidated entries in case they are required for some purpose. I'm actually going to add that feature to the mobile version, as well. Too bad I didn't think of it sooner.

@dgets dgets added the enhancement New feature or request label Jul 6, 2019
@dgets dgets added this to the next alpha milestone Jul 6, 2019
@dgets dgets self-assigned this Jul 6, 2019
dgets added a commit that referenced this issue Jul 6, 2019
dgets added a commit that referenced this issue Jul 6, 2019
… entry fields to administrations. En route to #131.
dgets added a commit that referenced this issue Jul 7, 2019
…ed it! Needs more modularization, too. En route to #131.
@dgets
Copy link
Owner Author

dgets commented Jul 7, 2019

Ugh forgot to check and see if the ones that I'm looking at are currently valid. :|

dgets added a commit that referenced this issue Jul 7, 2019
@dgets
Copy link
Owner Author

dgets commented Jul 7, 2019

Also, the conditional that attempts to consolidate 3 entries will have to be massaged for correct calculation and comparison of the timedelta as I had to do with the consolidate_two method.

@dgets
Copy link
Owner Author

dgets commented Jul 7, 2019

After all of this is done we'll have to add filtering for valid entries in applicable locations throughout the code. :|

@dgets
Copy link
Owner Author

dgets commented Jul 8, 2019

Got to make a list of wiped & inserted entries in order to display a status page after completion.

@dgets
Copy link
Owner Author

dgets commented Jul 8, 2019

Trial run (debugging):

New Consolidated Records
None: caffeine (1,3,7-Trimethylxanthine Theine) (14.000) administered to: sprite at 2019-07-07 03:37:15+00:00
None: caffeine (1,3,7-Trimethylxanthine Theine) (8.000) administered to: sprite at 2019-07-07 03:37:03+00:00
None: caffeine (1,3,7-Trimethylxanthine Theine) (8.000) administered to: sprite at 2019-07-07 03:36:57+00:00
Old Invalid Entries
34: caffeine (1,3,7-Trimethylxanthine Theine) (10.000) administered to: sprite at 2019-07-07 03:39:39+00:00
32: caffeine (1,3,7-Trimethylxanthine Theine) (2.000) administered to: sprite at 2019-07-07 03:37:15+00:00
34: caffeine (1,3,7-Trimethylxanthine Theine) (10.000) administered to: sprite at 2019-07-07 03:39:39+00:00
32: caffeine (1,3,7-Trimethylxanthine Theine) (2.000) administered to: sprite at 2019-07-07 03:37:15+00:00
31: caffeine (1,3,7-Trimethylxanthine Theine) (2.000) administered to: sprite at 2019-07-07 03:37:03+00:00
32: caffeine (1,3,7-Trimethylxanthine Theine) (2.000) administered to: sprite at 2019-07-07 03:37:15+00:00
31: caffeine (1,3,7-Trimethylxanthine Theine) (2.000) administered to: sprite at 2019-07-07 03:37:03+00:00
33: caffeine (1,3,7-Trimethylxanthine Theine) (4.000) administered to: sprite at 2019-07-07 03:36:57+00:00
31: caffeine (1,3,7-Trimethylxanthine Theine) (2.000) administered to: sprite at 2019-07-07 03:37:03+00:00

Trial run (non-debugging):

New Consolidated Records
36: caffeine (1,3,7-Trimethylxanthine Theine) (14.000) administered to: sprite at 2019-07-07 03:37:15+00:00
37: caffeine (1,3,7-Trimethylxanthine Theine) (8.000) administered to: sprite at 2019-07-07 03:37:03+00:00
38: caffeine (1,3,7-Trimethylxanthine Theine) (8.000) administered to: sprite at 2019-07-07 03:36:57+00:00
Old Invalid Entries
34: caffeine (1,3,7-Trimethylxanthine Theine) (10.000) administered to: sprite at 2019-07-07 03:39:39+00:00
32: caffeine (1,3,7-Trimethylxanthine Theine) (2.000) administered to: sprite at 2019-07-07 03:37:15+00:00
34: caffeine (1,3,7-Trimethylxanthine Theine) (10.000) administered to: sprite at 2019-07-07 03:39:39+00:00
32: caffeine (1,3,7-Trimethylxanthine Theine) (2.000) administered to: sprite at 2019-07-07 03:37:15+00:00
31: caffeine (1,3,7-Trimethylxanthine Theine) (2.000) administered to: sprite at 2019-07-07 03:37:03+00:00
32: caffeine (1,3,7-Trimethylxanthine Theine) (2.000) administered to: sprite at 2019-07-07 03:37:15+00:00
31: caffeine (1,3,7-Trimethylxanthine Theine) (2.000) administered to: sprite at 2019-07-07 03:37:03+00:00
33: caffeine (1,3,7-Trimethylxanthine Theine) (4.000) administered to: sprite at 2019-07-07 03:36:57+00:00
31: caffeine (1,3,7-Trimethylxanthine Theine) (2.000) administered to: sprite at 2019-07-07 03:37:03+00:00

@dgets
Copy link
Owner Author

dgets commented Jul 9, 2019

In order to avoid processing entries that have already been consolidated multiple times, it would be necessary to go back into applicable_usages and mark them invalid in that array, as well. Of course this would also necessitate testing to make sure that the usages are valid when checking them for timespan inclusion relevance, as well.

dgets added a commit that referenced this issue Jul 9, 2019
…mit; there is, however, still one bug which will be detailed in the issue comments. En route to #131.
@dgets
Copy link
Owner Author

dgets commented Jul 9, 2019

As can be seen in the following debugging output, there is still an unexpected issue causing potential problems here. Other than this, I've finally got the behavior that I've been looking for. This doesn't complete all of the consolidation at once (multiple loops through the entries to consolidate completely may still be necessary), but it's what I'm going to go with for now until I implement a looping structure around this (in a new issue).

Debugging output follows:

Condition 1:
Saving: None: caffeine (1,3,7-Trimethylxanthine Theine) (14.000) administered to: sprite at 2019-07-07 03:37:15+00:00
Marking invalid: 34: caffeine (1,3,7-Trimethylxanthine Theine) (10.000) administered to: sprite at 2019-07-07 03:39:39+00:00
32: caffeine (1,3,7-Trimethylxanthine Theine) (2.000) administered to: sprite at 2019-07-07 03:37:15+00:00
31: caffeine (1,3,7-Trimethylxanthine Theine) (2.000) administered to: sprite at 2019-07-07 03:37:03+00:00
Nothing to consolidate here
Nothing to consolidate here
Nothing to consolidate here

Something unexpected happened here!

Wiped: [<Usage: 34: caffeine (1,3,7-Trimethylxanthine Theine) (10.000) administered to: sprite at 2019-07-07 03:39:39+00:00>, <Usage: 32: caffeine (1,3,7-Trimethylxanthine Theine) (2.000) administered to: sprite at 2019-07-07 03:37:15+00:00>, <Usage: 31: caffeine (1,3,7-Trimethylxanthine Theine) (2.000) administered to: sprite at 2019-07-07 03:37:03+00:00>]
New: [<Usage: None: caffeine (1,3,7-Trimethylxanthine Theine) (14.000) administered to: sprite at 2019-07-07 03:37:15+00:00>]

@dgets
Copy link
Owner Author

dgets commented Jul 9, 2019

I've broken up the remaining tasks into separate issues. Consolidation is implemented and this issue is getting long. Moving to the other issues now.

@dgets dgets closed this as completed Jul 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant