Drives categorization - TeslamateJournal #2087
Replies: 3 comments
-
Hi, Wouldn't it must more flexible to just apply these rules (basically a set of filters) dynamically on the drives report and generate the overview directly from the database? Then, at any point in time you could change the filter-settings and generate a new report to see the data for another "category" of drives. It would be nice if you then could save these rules as different "presets" (that would correspond to your "categories" ) so you could easily switch between those presets and to get different overviews. With your solution, if you wanted to change the rules for a category later, that would not be possible, as the category for a drive is only determined once by the microservice, I assume after finishing the drive. |
Beta Was this translation helpful? Give feedback.
-
Hi, Well the easy answer is that I'm familiar with Elixir and Grafana, even if I've now started to grasp some of it after browsing through the code here. As answer to your question regarding re-categorization that can be solved easily also with a micro service, I've not yet implemented it as a configurable option but it is in the code already to re-categorize all drives, specific drive, or drives between certain dates (implemented it so that I could re-run everything easiy during development :) ). Reason I want to store it in the database is that my main purpose was produce a report that can be used when it comes to reimbursement from e.g. employer, tax authorities etc. Then I want to have it stored so that it is not easily changed. However if you have other needs the rules are easy to change, they are all configurable and the rules are re-loaded before each run. |
Beta Was this translation helpful? Give feedback.
-
Ah, Ok yes if you want to have this quite fixed in the database for reporting, even if the rules change later, your solution looks more fit. For my purpose however, I'm still interested in a relative simple solution that does not require adding additional columns to the database or installing an additional microservice. As you seem to be familiar with Grafana, and probably already had to figure out which SQL-queries to use for the microservice, would it be hard for you to provide a custom version for the "Drives" dashboard with some additional filter options? It already has filters for minimum distance and distance. I would be really helped if there would also be filters for Start and End address (perhaps with wildcards, while you are at it ;-) ) For your use case you could use that for trying out the filter rules to check if the report is like you expect, before actually applying them for the categories ;-) |
Beta Was this translation helpful? Give feedback.
-
Hi all,
I've developed a micro service that I call TeslamateJournal. It categorizes your drives after rules that you define, currently there are support for rules based on destimation(s) (Geofences) and Start and/or End time.
The service can be used to create an automatic logbook of your drives divided in e.g. Private and Business.
So far this service is based on that a new column is added to the drives table where the derived category will be saved, and this is where I would need some assistance, guidance, feedback etc on how to add this new column. I've never worked with Elixir but after looking through the files here, I think I've understood how it is supposed to be done. But any assistance would be very much appreciated.
The column that I've added manually in my development database is called "category" and of text datatype. I'm not sure this is the best suitable datatype but I picked what seems to be most common character datatype in the database.
I've not yet added this project to github since I want to have this "problem" solved first. Once the database thingy is solved I will add the project to github as well as a docker image to docker hub.
If you want to gain access to this first version to try it out please let me know and we will find a way. However please note that you would need to do the database change manually.
The service is thought of running in a separate docker instance and there are both a docker-compose file available as well as necessary files for kubernetes deployment via kubectl.
Beta Was this translation helpful? Give feedback.
All reactions