Skip to content

Commit

Permalink
Ajustes e novas funcionalidades para formulário pacientes
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigmars committed May 1, 2024
1 parent 8b5370e commit d4fd3af
Show file tree
Hide file tree
Showing 16 changed files with 362 additions and 353 deletions.
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,3 @@ dmypy.json

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
Empty file added common/__init__.py
Empty file.
35 changes: 35 additions & 0 deletions common/util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import re


class CommonsUtil:

ALPHA_PATTERN = "[A-Za-záàâãéèêíïóôõöúçñÁÀÂÃÉÈÍÏÓÔÕÖÚÇÑ\\-_\\s]+$"

ALPHA_NUMERIC_PATTERN = "[A-Za-z0-9.-_]+$"

ALPHA_NUMERIC_CHARACTER_PATTERN = "[A-Za-z0-9_À-ÿ.-_\\s]+$"

NUMERIC_PATTERN = "[0-9]+$"

PHONE_NUMERIC_PATTERN = "([0-9]{2})?([0-9]{2})([0-9]{4,5})([0-9]{4})"

def __init__(self):
pass

def remove_characters(self, text: str) -> str:
return re.sub("[^0-9]", "", text)

def find_numbers(self, text: str):
return re.findall(r"[0-9]+", text)

def is_alpha_pattern(self, text: str):
return re.match(self.ALPHA_PATTERN, text)

def is_numeric_pattern(self, text: str):
return re.match(self.NUMERIC_PATTERN, text)

def is_alpha_numeric_character_pattern(self, text: str):
return re.match(self.ALPHA_NUMERIC_CHARACTER_PATTERN, text)

def is_phone_pattern(self, text: str):
return re.match(self.PHONE_NUMERIC_PATTERN, text)
Loading

0 comments on commit d4fd3af

Please sign in to comment.