-
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.
Include new modules: "RegistroCambio", "Notas" and "Material" (#20)
## Added - New module "RegistroCambios". - New module "Notas". - New module "Material". ## Changed - Improve the field validations with pydantic built-in methods. - Request handler allow returning a `list`. ## Fixed - Data object ""RegistroCambios" field name and potential values. - Remove unnecessary imports.
- Loading branch information
Showing
21 changed files
with
236 additions
and
31 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
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
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
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,7 +1,10 @@ | ||
"""Package: Filters for different modules.""" | ||
|
||
from .maestras import MaestrasFilter | ||
from .material import MaterialFilter | ||
from .medicamento import MedicamentoFilter | ||
from .medicamentos import MedicamentosFilter | ||
from .nota import NotaFilter | ||
from .presentaciones import PresentacionesFilter | ||
from .registro_cambios import RegistroCambiosFilter | ||
from .vmpp import VmppFilter |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"""Module for filtering the 'Materiales'.""" | ||
|
||
from ..utils.filter import Filterable, Text | ||
|
||
|
||
class NumRegistro(Text["MaterialFilter"]): | ||
def __init__(self, instance: "MaterialFilter") -> None: | ||
key: str = "nregistro" | ||
super().__init__(key=key, instance=instance) | ||
|
||
|
||
class MaterialFilter(Filterable): | ||
|
||
def __init__(self) -> None: | ||
super().__init__() | ||
|
||
@property | ||
def nregistro(self) -> "NumRegistro": | ||
return NumRegistro(instance=self) |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"""Module for filtering the 'Notas'.""" | ||
|
||
from ..utils.filter import Filterable, Text | ||
|
||
|
||
class NumRegistro(Text["NotaFilter"]): | ||
def __init__(self, instance: "NotaFilter") -> None: | ||
key: str = "nregistro" | ||
super().__init__(key=key, instance=instance) | ||
|
||
|
||
class NotaFilter(Filterable): | ||
|
||
def __init__(self) -> None: | ||
super().__init__() | ||
|
||
@property | ||
def nregistro(self) -> "NumRegistro": | ||
return NumRegistro(instance=self) |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
"""Module for filtering the 'Registro Cambios'.""" | ||
|
||
from ..utils.filter import Date, Filterable, Integer, Text | ||
|
||
|
||
class Fecha(Date["RegistroCambiosFilter"]): | ||
def __init__(self, instance: "RegistroCambiosFilter") -> None: | ||
key: str = "fecha" | ||
super().__init__(key=key, instance=instance) | ||
|
||
|
||
class NumRegistro(Text["RegistroCambiosFilter"]): | ||
def __init__(self, instance: "RegistroCambiosFilter") -> None: | ||
key: str = "nregistro" | ||
super().__init__(key=key, instance=instance) | ||
|
||
|
||
class Pagina(Integer["RegistroCambiosFilter"]): | ||
def __init__(self, instance: "RegistroCambiosFilter") -> None: | ||
key: str = "pagina" | ||
super().__init__(key=key, instance=instance) | ||
|
||
|
||
class RegistroCambiosFilter(Filterable): | ||
|
||
def __init__(self) -> None: | ||
super().__init__() | ||
|
||
@property | ||
def fecha(self) -> "Fecha": | ||
return Fecha(instance=self) | ||
|
||
@property | ||
def nregistro(self) -> "NumRegistro": | ||
return NumRegistro(instance=self) | ||
|
||
@property | ||
def pagina(self) -> "Pagina": | ||
return Pagina(instance=self) |
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,9 @@ | ||
"""Package: CIMA-related modules.""" | ||
|
||
from .material import Material | ||
from .medicamento import Medicamento | ||
from .medicamentos import Medicamentos | ||
from .notas import Notas | ||
from .presentaciones import Presentaciones | ||
from .registro_cambios import RegistroCambios | ||
from .vmpp import Vmpp |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"""Module for retrieving information from 'Materiales' endpoint.""" | ||
|
||
from typing import Any | ||
|
||
from ..filter.material import MaterialFilter | ||
from ..objects.material import MaterialModel | ||
from ..utils.module import BaseModule | ||
from ..utils.request_handler import ReqHandler | ||
|
||
|
||
class Material(BaseModule[MaterialFilter, MaterialModel]): | ||
|
||
def __init__(self, req_handler: ReqHandler) -> None: | ||
super().__init__(req_handler) | ||
|
||
@property | ||
def endpoint(self) -> str: | ||
return "materiales" | ||
|
||
def parse_result(self, data: dict[str, Any]) -> MaterialModel: | ||
return MaterialModel(**data) |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"""Module for retrieving information from 'Notas' endpoint.""" | ||
|
||
from typing import Any | ||
|
||
from ..filter.nota import NotaFilter | ||
from ..objects.nota import NotaModel | ||
from ..utils.module import BaseModule | ||
from ..utils.request_handler import ReqHandler | ||
|
||
|
||
class Notas(BaseModule[NotaFilter, NotaModel]): | ||
|
||
def __init__(self, req_handler: ReqHandler) -> None: | ||
super().__init__(req_handler) | ||
|
||
@property | ||
def endpoint(self) -> str: | ||
return "notas" | ||
|
||
def parse_result(self, data: list[dict[str, Any]]) -> list[NotaModel]: | ||
return [NotaModel(**d) for d in data] |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"""Module for retrieving information from 'Registro Cambios' endpoint.""" | ||
|
||
from typing import Any | ||
|
||
from ..filter.registro_cambios import RegistroCambiosFilter | ||
from ..objects.registro_cambios import RegistroCambiosModel | ||
from ..utils.module import BaseModule | ||
from ..utils.request_handler import ReqHandler | ||
|
||
|
||
class RegistroCambios(BaseModule[RegistroCambiosFilter, RegistroCambiosModel]): | ||
|
||
def __init__(self, req_handler: ReqHandler) -> None: | ||
super().__init__(req_handler) | ||
|
||
@property | ||
def endpoint(self) -> str: | ||
return "registroCambios" | ||
|
||
def parse_result(self, data: dict[str, Any]) -> RegistroCambiosModel: | ||
if "Es necesario indicar la fecha" in data.values(): | ||
raise KeyError("You must filter, at least, by `fecha`") | ||
return RegistroCambiosModel(**data) |
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
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,14 +1,14 @@ | ||
"""Module for the 'Material' object.""" | ||
|
||
from pydantic import HttpUrl | ||
from pydantic.dataclasses import dataclass | ||
|
||
from .documento_material import DocumentoMaterialModel | ||
from .videos import VideoModel | ||
|
||
|
||
@dataclass | ||
class MaterialModel: | ||
titulo: str | ||
listaDocsPaciente: list[DocumentoMaterialModel] | ||
listaDocsProfesional: list[DocumentoMaterialModel] | ||
video: HttpUrl | ||
titulo: str | None = None | ||
listaDocsPaciente: list[DocumentoMaterialModel] | None = None | ||
listaDocsProfesional: list[DocumentoMaterialModel] | None = None | ||
videos: list[VideoModel] | 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
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
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"""Module for the 'Videos' object.""" | ||
|
||
from datetime import datetime | ||
|
||
from pydantic import HttpUrl | ||
from pydantic.dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class VideoModel: | ||
titulo: str | ||
url: HttpUrl | ||
video: HttpUrl | ||
fecha: datetime |
This file was deleted.
Oops, something went wrong.
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,4 +1,4 @@ | ||
"""Package: Utils of the filtering methods for AEMPSconn.""" | ||
|
||
from .filter import Filterable | ||
from .operator import Bool, Integer, Text | ||
from .operator import Bool, Date, Integer, Text |
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
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 |
---|---|---|
|
@@ -26,3 +26,10 @@ class Integer( | |
Generic[R], | ||
): | ||
pass | ||
|
||
|
||
class Date( | ||
Equals[str, R], | ||
Generic[R], | ||
): | ||
pass |
Oops, something went wrong.