summaryrefslogtreecommitdiffstats
path: root/glucometerutils/common.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add missing SPDX-FileCopyrightText throughout the project.Diego Elio Pettenò2020-03-271-0/+1
| | | | This is following the advice provided in https://matija.suklje.name/how-and-why-to-properly-write-copyright-statements-in-your-code
* The big typing cleanup.Diego Elio Pettenò2020-03-271-2/+9
| | | | | | | | Now that Python 3.7 is the minimum Python version, typing can be done inline, which makes it easier for mypy to know the files to check. Indeed, all the files are now typechecked, which uncovered a few minor bugs and mistakes here and there.
* Use PEP526 declarations rather than `attr.ib()` calls all over.Diego Elio Pettenò2020-03-271-38/+32
| | | | | This simplifies type annotations a bit, and makes it easier figure out why attrs is still required (validators).
* Fix errors identified by flake8.Diego Elio Pettenò2020-03-261-1/+1
|
* Fix version information formatting.Diego Elio Pettenò2020-03-141-1/+3
| | | | The order of operations is a bit different with f-strings so the amount of padding is different.
* Now that Python 3.6 is the minimum supported version, use f-strings.Diego Elio Pettenò2020-03-141-12/+5
| | | | | | | | | | | The f-strings formatted strings are generally simpler to write, read and debug, with a few exceptions. Keep the logging strings lazy, keep the CSV-building with %-formatting, as it makes it more readable. In fsoptium, keep `'$%s\r\n'` as a %-format, to avoid making it `f'${command}\r\n'` that would make it easy to mistake for a Shell variable.
* format code with blackBen2020-03-081-34/+53
|
* Remove try/except around typing imports.Diego Elio Pettenò2019-09-241-5/+1
| | | | Since Python 3.4 is no longer supported, there's no reason for typing not to be there.
* Use type= parameters in attr.ib() declarations.Diego Elio Pettenò2019-09-021-16/+18
| | | | | This should work just as well and makes it read a little better. Also, replace Text references with str, since we don't support Python 2 anyway.
* Replace the device_id attribute with a more generic extra_data dictionary.Diego Elio Pettenò2019-09-021-3/+3
| | | | This will allow providing other information, for other non-fslibre drivers.
* add internal device id to glucose measurements (and other entries) to prepare for better sortingBen2019-09-021-0/+3
|
* fslibre: expose patient name if the device knows it.Diego Elio Pettenò2019-07-071-2/+9
| | | | | This includes extension of the base info command to report this when asked on the command line.
* Fix type annotations.Diego Elio Pettenò2019-07-011-4/+4
|
* common: Correctly show ketone sample type in csvAndreas Sandberg2019-05-191-1/+1
|
* add time adjustments to fslibre dumpBen2019-05-051-0/+17
|
* Replace epydoc metadata with SPDX identifiers.Diego Elio Pettenò2019-02-081-5/+2
| | | | | | | | | | Most of the epydoc metadata (author, copyright, email) is duplicate in the package's setup.py or README. These copies are more likely to get out of date, and increase the amount of work to keep them in line. The license information should rather be provided with an SPDX identifier, which is more similar to what the Linux kernel and other projects, such as pyserial, do.
* Replace flameeyes.eu with flameeyes.com.Diego Elio Pettenò2019-02-081-1/+1
| | | | | | | | Due to EURid threatening to suspend my domain, make sure that the references are updated to point at the right stable domain. This includes changes to the files as well as a mailmap to update the author references in the log.
* Fix most of the pylint output, and hide away some that is not needed.Diego Elio Pettenò2018-12-121-6/+3
| | | | Again, this is not ready for CI yet unfortunately :(
* Sprinkle more type annotations throughout the codebase.Diego Elio Pettenò2018-12-121-5/+8
|
* Fix indentation of common.py.Diego Elio Pettenò2018-12-121-83/+86
|
* Make GlucoseReading and KetoneReading use attrs, too.Diego Elio Pettenò2018-12-121-44/+24
| | | | This also adds more type annotations for them.
* Use [attrs](http://www.attrs.org/) instead of namedtuple for MeterInfo.Diego Elio Pettenò2018-12-121-18/+18
| | | | This avoids having the separate _MeterInfoBase class, and reads much nicer.
* Fix error in meter info output, after conversion of Unit to enum.Diego Elio Pettenò2017-12-291-1/+1
|
* accucheck_reports: fix bug for mg/dL native meters.Diego Elio Pettenò2017-12-281-5/+5
| | | | | This was mixing up the units in the conversion. While fixing the bug, remove the confusing two-parameter form of convert_glucose_unit.
* Use Python3 Enum class for measurement methods.Diego Elio Pettenò2017-12-281-6/+7
| | | | This makes the code more idiomatic and less brittle.
* Use Python3 Enum class for meal flags.Diego Elio Pettenò2017-12-281-6/+7
| | | | This makes the code more idiomatic and less brittle.
* Use Python3 Enum class for glucose units.Diego Elio Pettenò2017-12-281-17/+9
| | | | This makes the code more idiomatic and less brittle.
* common: introduce the KetoneReading classSamuel Martin2017-09-251-3/+32
| | | | | This change also remove the meal field from the _ReadingBase class and moves it only where it belongs, i.e. in the GlucoseReading class.
* common: rename Reading class into GlucoseReading classSamuel Martin2017-09-251-2/+2
| | | | This renaming prepares for the ketone class introduction.
* common: add measure_method field to _ReadingBase classSamuel Martin2017-09-251-5/+10
| | | | | This new measure_method stores origin of the measure (either blood sample or from a CGM sensor).
* common: add constants for measure methodsSamuel Martin2017-09-251-0/+4
|
* Remove unused constants.Diego Elio Pettenò2017-04-151-4/+0
|
* Move the readings-to-csv conversion to the Reading class.Diego Elio Pettenò2017-01-151-0/+6
|
* Wrap the meter information to a namedtuple, instead of a string.Diego Elio Pettenò2017-01-151-0/+34
| | | | | | This matches the gdef MeterInfo message, and produces a similar (though not identical) string as before. Importantly, it allows providing semantic information.
* otultra2: make the before/after meal constants in common module.Diego Elio Pettenò2016-02-151-1/+6
| | | | This will lead the way to providing meal information with future drivers.
* common: fix namedtuple usage to allow for optional parameters.Diego Elio Pettenò2014-01-291-3/+3
| | | | The otultraeasy does not provide comments or meal indications.
* Clean up the code to remove methods that should be functions and imports.Diego Elio Pettenò2013-12-111-2/+2
|
* Allow sorting the dumped data; sort by date by default.Diego Elio Pettenò2013-12-111-5/+7
| | | | | This changes the dump output for otultra2 devices as they would dump data in record format, last reading first.
* Change all the internal representations to mg/dL for compatibility with LifeScan.Diego Elio Pettenò2013-12-111-10/+8
| | | | | | While mmol/L is the international standard unit, at least LifeScan uses mg/dL in all their devices, and since they are the ones for which we have protocols for, we might as well use the same.
* Generalise the meal/comment handling to the Reading object.Diego Elio Pettenò2013-12-111-2/+12
| | | | | While not all readers implement before/after meal notes, it's possible to implement an heuristics for that.
* otultra2: implement decoding of meal and comment codes.Diego Elio Pettenò2013-12-081-1/+2
| | | | This also dumps the comment with the dump command.
* Read more data out of the OTUltra2 dump lines. Return data in a Reading object.Diego Elio Pettenò2013-09-291-0/+19
| | | | | The Reading object will be extended to cater for flags, comments and other device-specific information.
* Relicense everything under MIT license.Diego Elio Pettenò2013-08-031-1/+1
| | | | | There is no reason for me to use GPLv3 now that I'm not using the CRC32-Sick code, so I'll go with the most liberal license out there.
* Update function names to follow PEP8.Diego Elio Pettenò2013-08-031-1/+1
|
* Add utf-8 encoding specification to all files.Diego Elio Pettenò2013-08-031-0/+1
|
* Initial import of the raw data.Diego Elio Pettenò2013-08-031-0/+48