-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from PTST/german-headers-fix
Fix for new german headers
- Loading branch information
Showing
10 changed files
with
254 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
from typing import Dict, List | ||
from uuid import UUID | ||
from LibreView.models import Connection | ||
from LibreView.utils import API | ||
|
||
|
||
class LibreView: | ||
client: API | ||
|
||
connections_dict: Dict[UUID, Connection] | ||
|
||
def __init__(self, username: str, password: str): | ||
self.client = API(username, password) | ||
|
||
def get_connections(self) -> List[Connection]: | ||
cons = self.client.get_connections() | ||
self.connections_dict = {x.id: x for x in cons} | ||
return cons | ||
from typing import Dict, List, Optional | ||
from uuid import UUID | ||
from LibreView.models import Connection | ||
from LibreView.utils import API | ||
|
||
|
||
class LibreView: | ||
client: API | ||
|
||
connections_dict: Dict[UUID, Connection] | ||
|
||
def __init__(self, username: str, password: str, region: Optional[str] = None): | ||
self.client = API(username, password, region) | ||
|
||
def get_connections(self) -> List[Connection]: | ||
cons = self.client.get_connections() | ||
self.connections_dict = {x.id: x for x in cons} | ||
return cons |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
from dataclasses import dataclass | ||
from uuid import UUID | ||
from dataclass_wizard import JSONWizard | ||
|
||
# from LibreView.models import Sensor, GlucoseMeasurement | ||
from LibreView.models.GlucoseMeasurement import GlucoseMeasurement | ||
from LibreView.models.Sensor import Sensor | ||
|
||
|
||
@dataclass | ||
class Connection(JSONWizard): | ||
id: UUID | ||
patient_id: UUID | ||
country: str | ||
status: int | ||
first_name: str | ||
last_name: str | ||
target_low: int | ||
target_high: int | ||
uom: int | ||
sensor: Sensor | ||
glucose_measurement: GlucoseMeasurement | ||
from dataclasses import dataclass | ||
from uuid import UUID | ||
from dataclass_wizard import JSONWizard | ||
|
||
# from LibreView.models import Sensor, GlucoseMeasurement | ||
from LibreView.models.GlucoseMeasurement import GlucoseMeasurement | ||
from LibreView.models.Sensor import Sensor | ||
|
||
|
||
@dataclass | ||
class Connection(JSONWizard): | ||
id: UUID | ||
patient_id: UUID | ||
country: str | ||
status: int | ||
first_name: str | ||
last_name: str | ||
target_low: int | ||
target_high: int | ||
uom: int | ||
sensor: Sensor | ||
glucose_measurement: GlucoseMeasurement |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
from dataclasses import dataclass | ||
from uuid import UUID | ||
from dataclass_wizard import JSONWizard | ||
|
||
|
||
@dataclass | ||
class Device(JSONWizard): | ||
id: UUID | ||
nickname: str | ||
sn: UUID | ||
type: int | ||
upload_date: int | ||
from dataclasses import dataclass | ||
from uuid import UUID | ||
from dataclass_wizard import JSONWizard | ||
|
||
|
||
@dataclass | ||
class Device(JSONWizard): | ||
id: UUID | ||
nickname: str | ||
sn: UUID | ||
type: int | ||
upload_date: int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
from dataclasses import dataclass | ||
from datetime import datetime | ||
from dataclass_wizard import JSONWizard, json_field | ||
|
||
|
||
@dataclass | ||
class GlucoseMeasurement(JSONWizard): | ||
type: int | ||
value_in_mg_per_dl: int | ||
trend_arrow: int | ||
measurement_color: int | ||
glucose_units: int | ||
value: float | ||
is_high: bool | ||
is_low: bool | ||
_factory_timestamp: str = json_field("FactoryTimestamp") # type: ignore | ||
_timestamp: str = json_field("Timestamp") # type: ignore | ||
trend_message: str | None = None | ||
|
||
@property | ||
def factory_timestamp(self) -> datetime: | ||
return self.parse_dt(self._factory_timestamp) | ||
|
||
@property | ||
def timestamp(self) -> datetime: | ||
return self.parse_dt(self._timestamp) | ||
|
||
def parse_dt(self, val: str) -> datetime: | ||
splitted = val.split("/") | ||
splitted[0] = splitted[0].zfill(2) | ||
splitted[1] = splitted[1].zfill(2) | ||
return datetime.strptime("/".join(splitted), "%m/%d/%Y %I:%M:%S %p") | ||
from dataclasses import dataclass | ||
from datetime import datetime | ||
from dataclass_wizard import JSONWizard, json_field | ||
|
||
|
||
@dataclass | ||
class GlucoseMeasurement(JSONWizard): | ||
type: int | ||
value_in_mg_per_dl: int | ||
trend_arrow: int | ||
measurement_color: int | ||
glucose_units: int | ||
value: float | ||
is_high: bool | ||
is_low: bool | ||
_factory_timestamp: str = json_field("FactoryTimestamp") # type: ignore | ||
_timestamp: str = json_field("Timestamp") # type: ignore | ||
trend_message: str | None = None | ||
|
||
@property | ||
def factory_timestamp(self) -> datetime: | ||
return self.parse_dt(self._factory_timestamp) | ||
|
||
@property | ||
def timestamp(self) -> datetime: | ||
return self.parse_dt(self._timestamp) | ||
|
||
def parse_dt(self, val: str) -> datetime: | ||
splitted = val.split("/") | ||
splitted[0] = splitted[0].zfill(2) | ||
splitted[1] = splitted[1].zfill(2) | ||
return datetime.strptime("/".join(splitted), "%m/%d/%Y %I:%M:%S %p") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
from dataclasses import dataclass | ||
from uuid import UUID | ||
from dataclass_wizard import JSONWizard | ||
|
||
|
||
@dataclass | ||
class Practice(JSONWizard): | ||
id: UUID | ||
practice_id: str | ||
name: str | ||
address1: str | ||
city: str | ||
state: str | ||
zip: str | ||
phone_number: str | ||
address2: str | None = None | ||
from dataclasses import dataclass | ||
from uuid import UUID | ||
from dataclass_wizard import JSONWizard | ||
|
||
|
||
@dataclass | ||
class Practice(JSONWizard): | ||
id: UUID | ||
practice_id: str | ||
name: str | ||
address1: str | ||
city: str | ||
state: str | ||
zip: str | ||
phone_number: str | ||
address2: str | None = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
from dataclasses import dataclass | ||
from dataclass_wizard import JSONWizard | ||
|
||
|
||
@dataclass | ||
class Sensor(JSONWizard): | ||
device_id: str | ||
sn: str | ||
a: int | ||
w: int | ||
pt: int | ||
s: bool | ||
lj: bool | ||
from dataclasses import dataclass | ||
from dataclass_wizard import JSONWizard | ||
|
||
|
||
@dataclass | ||
class Sensor(JSONWizard): | ||
device_id: str | ||
sn: str | ||
a: int | ||
w: int | ||
pt: int | ||
s: bool | ||
lj: bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
from dataclasses import dataclass | ||
from typing import Any, List, Dict | ||
from uuid import UUID | ||
from dataclass_wizard import JSONWizard | ||
from LibreView.models import Device, Practice | ||
|
||
|
||
@dataclass | ||
class User(JSONWizard): | ||
id: UUID | ||
first_name: str | ||
last_name: str | ||
email: str | ||
country: str | ||
ui_language: str | ||
communication_language: str | ||
account_type: str | ||
uom: int | ||
date_format: int | ||
time_format: int | ||
email_day: List[int] | ||
created: int | ||
last_login: int | ||
date_of_birth: int | ||
practices: Dict[UUID, Practice] | ||
devices: Dict[str, Device] | ||
from dataclasses import dataclass | ||
from typing import Any, List, Dict | ||
from uuid import UUID | ||
from dataclass_wizard import JSONWizard | ||
from LibreView.models import Device, Practice | ||
|
||
|
||
@dataclass | ||
class User(JSONWizard): | ||
id: UUID | ||
first_name: str | ||
last_name: str | ||
email: str | ||
country: str | ||
ui_language: str | ||
communication_language: str | ||
account_type: str | ||
uom: int | ||
date_format: int | ||
time_format: int | ||
email_day: List[int] | ||
created: int | ||
last_login: int | ||
date_of_birth: int | ||
practices: Dict[UUID, Practice] | ||
devices: Dict[str, Device] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
from LibreView.models.Connection import Connection | ||
from LibreView.models.Device import Device | ||
from LibreView.models.GlucoseMeasurement import GlucoseMeasurement | ||
from LibreView.models.Practice import Practice | ||
from LibreView.models.Sensor import Sensor | ||
from LibreView.models.User import User | ||
from LibreView.models.Connection import Connection | ||
from LibreView.models.Device import Device | ||
from LibreView.models.GlucoseMeasurement import GlucoseMeasurement | ||
from LibreView.models.Practice import Practice | ||
from LibreView.models.Sensor import Sensor | ||
from LibreView.models.User import User |
Oops, something went wrong.