-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
massive refactor app structure and move to mongodb
- Loading branch information
1 parent
8c4fa6d
commit ee09ac1
Showing
103 changed files
with
254 additions
and
245 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,29 @@ | ||
import re | ||
|
||
|
||
def valid_postcode(postcode) -> bool: | ||
""" | ||
Validation function for UK postcodes | ||
Returns either a regexp match or 'not matched' | ||
ACKNOWLEDGEMENT: with thanks to https://kodey.co.uk/2020/09/03/a-uk-postcode-validation-script-in-python/ | ||
""" | ||
pattern = 'not matched' | ||
#e.g. W27XX | ||
if len(postcode.replace(" ", "")) == 5: | ||
pattern = re.compile("^[a-zA-Z]{1}[0-9]{2}[a-zA-Z]{2}") | ||
#e.g. TW27XX | ||
elif len(postcode.replace(" ", "")) == 6: | ||
pattern = re.compile("^[a-zA-Z]{2}[0-9]{2}[a-zA-Z]{2}") | ||
#e.g. TW218FF | ||
elif len(postcode.replace(" ", "")) == 7: | ||
pattern = re.compile("^[a-zA-Z]{2}[0-9]{3}[a-zA-Z]{2}") | ||
|
||
return pattern | ||
|
||
|
||
def validate_postcode(postcode: str) -> bool: | ||
valid_postcode_regex = valid_postcode(postcode=postcode) | ||
if(valid_postcode_regex.match('not matched')): | ||
return False | ||
else: | ||
return True |
File renamed without changes.
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,17 @@ | ||
# Generated by Django 4.0 on 2022-03-09 13:36 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('epilepsy12', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name='case', | ||
options={'verbose_name': 'case', 'verbose_name_plural': 'cases'}, | ||
), | ||
] |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
15 changes: 9 additions & 6 deletions
15
...epsy12/models/electroclinical_syndrome.py → ...epsy12/models/electroclinical_syndrome.py
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,20 +1,23 @@ | ||
from django.db import models | ||
from ..constants import * | ||
from .time_and_user_abstract_base_classes import * | ||
|
||
|
||
class ElectroClinicalSyndrome(TimeStampAbstractBaseClass, UserStampAbstractBaseClass): | ||
""" | ||
This class records information on electroclinical syndromes. | ||
It references the episode class, since one episode can have features of a single electroclinical syndrome. | ||
""" | ||
electroclinical_syndrome=models.IntegerField(choices=ELECTROCLINICAL_SYNDROMES) | ||
electroclinical_sydrome_other=models.CharField( | ||
electroclinical_syndrome = models.IntegerField( | ||
choices=ELECTROCLINICAL_SYNDROMES) | ||
electroclinical_syndrome_other = models.CharField( | ||
default=None, | ||
max_length=250 | ||
) | ||
|
||
class Meta: | ||
verbose_name="electroclinical syndrome", | ||
verbose_name_plural="electroclinical syndromes" | ||
verbose_name = 'electroclinical syndrome' | ||
verbose_name_plural = 'electroclinical syndromes' | ||
|
||
def __str__(self) -> str: | ||
return self.electroclinical_syndrome | ||
return self.electroclinical_syndrome |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.