Coder Social home page Coder Social logo

dantali0n / radloggerpy Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 696 KB

Radiation monitoring solution for a variety of instrument types.

License: Apache License 2.0

Python 99.90% Shell 0.10%
radiation radiation-sensor radiation-monitor logger geiger-counter monitoring ionization-chamber radiation-detector geiger-muller background-radiation

radloggerpy's Introduction

radloggerpy's People

Contributors

dantali0n avatar

Watchers

 avatar  avatar

radloggerpy's Issues

Refactor database object methods to reduce duplicate code

Many of the database objects methods share a lot of code that could potentially be reduced.

    def find(session, reference, allow_multiple=True):
        reference._build_object()

        """Only look for serial devices"""
        reference.m_device.interface = DeviceInterfaces.SERIAL

        base_filters = reference._filter(reference.m_device)

        """Check if reference is base or child type when setting filters"""
        if hasattr(reference, 'm_serial_device'):
            filters = reference._filter(reference.m_serial_device)
        else:
            filters = {}

        query = session.query(Device).filter_by(**base_filters)\
            .join(SerialDevice).filter_by(**filters)
    def delete(session, reference, allow_multiple=False):
        reference._build_object()

        filters = reference._filter(reference.m_device)
        query = session.query(Device).filter_by(**filters)

Change current DeviceTypes into DeviceInterfaces

DeviceTypes in terms of radiological devices is quite vague and does not clearly indicate that it implies the communication interface for a device. Instead DeviceInterfaces would be a better indicator which would than subsequently allow DeviceTypes to be used more effectively.

For instance, DeviceTypes could be used to distinguish between geiger counters, proportional counters, scintillation devices or semiconductor based counters. This distinction is quite important as it allows to associate certain types of radiation measurements with devices.

As an example, Geiger counters can not accurately measure absorbed dose as they do not proportionally measure the energy of each count (event). While a dosimeter will sometimes only measure effective and or equivalent dose and not have any way to report absorbed dose.

Hide StateMachine to external Device users

The Device abstract class inherits StateMachine which allows external access to the transition method. This is undesirable, instead Device should keep an instance of StateMachine as internal object and only expose get_state.

Storage location of SQLite database file should be agnostic to working directory

Currently the placement and location of the SQLite database file is depending upon working directory of the user, this is very error prone and unsuitable for daemon like applications.

Instead, the placement of the SQLite database should default to a subfolder in the user directory unless it is specified at an alternative location in the configuration files.

Centralize fields and attribute variables across device CLI

The device CLI has many duplicates of the fields tuple and similarly reuses the same tuple of attributes often. These variables could be part of base classes similar to the pattern used for the arguments property in combination with the _arguments variable.

class Example(metaclass=abc.ABCMeta):
    """Arguments property is extensible by child classes"""

    _arguments = None

    @property
    def arguments(self):
        if self._arguments is None:
            self._arguments = dict()
            self._arguments.update({
                '--id': Argument(
                    '-i', help="Example argument attribute",
                    type=int)
            })
        return self._arguments

Silent mode to disable any unwanted output

Sometimes it might be desired to execute a command and store the results in a file. In this case it is undesirable to output any additional messages as these would globber the file being generated.

A special silent mode needs to be added that will disable any unwanted output. The silent mode should be enabled by default when the -f parameter is supplied in radloggercli

  • Implement silent mode
  • Enable silent mode when -f is set

Use of TypeVar(... bound=Example) vs Type[Example]

From the Python documentation it is clear that using TypeVar(... bound=Example) will constraint the type to a subclass of Example.

What is unclear is how:

_U = TypeVar('_U', bound=Example)
Type[_U]

Is different from:

Type[Example]

Is there any reason to prefer one over the other? and what are the consequences of these differences?

Cliff CLI should log any uncaught exceptions

Make this somewhat smart where it uses LOG.error for error exceptions and LOG.warning if the exception inherits Warning.

Only CLI should be allowed to actually raise a Warning.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.