Skip to content

Commit

Permalink
Implementing health care professionals models and tables
Browse files Browse the repository at this point in the history
  • Loading branch information
TanookiVerde committed Jun 24, 2024
1 parent f70a4fe commit e044cd9
Show file tree
Hide file tree
Showing 6 changed files with 3,402 additions and 7 deletions.
11 changes: 6 additions & 5 deletions api/app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,24 +284,25 @@ class Meta:


class HealthCareRoleFamily(Model):
code = fields.IntField(pk=True)
code = fields.CharField(pk=True, max_length=4)
name = fields.CharField(max_length=512)


class ProfessionalRegistry(Model):
code = fields.IntField(pk=True)
type = fields.CharField(max_length=12) #enum
code = fields.CharField(pk=True, max_length=16)
type = fields.CharField(max_length=12)
professional = fields.ForeignKeyField("app.HealthCareProfessional", related_name="crm_professional")


class HealthCareRole(Model):
cbo = fields.CharField(max_length=10, pk=True)
cbo = fields.CharField(max_length=6, pk=True)
family = fields.ForeignKeyField("app.HealthCareRoleFamily", related_name="role_family")
description = fields.CharField(max_length=512)
professionals = fields.ReverseRelation["HealthCareProfessional"]


class HealthCareProfessional(Model):
id_sus = fields.IntField(pk=True)
id_sus = fields.CharField(pk=True, max_length=16)
name = fields.CharField(max_length=512)
cns = fields.CharField(max_length=16, index=True)
cpf = fields.CharField(max_length=11, index=True, validators=[CPFValidator()])
Expand Down
4 changes: 2 additions & 2 deletions api/app/pydantic_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ class MergedPatientTelecom(BaseModel):

class ProfessionalModel(BaseModel):
id_profissional_sus: str
cns: str
cpf: str
cns: Optional[str]
cpf: Optional[str]
nome: str
id_cbo_lista: list[str]
id_registro_conselho_lista: list[str]
Expand Down
14 changes: 14 additions & 0 deletions api/data/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,19 @@
"source_csv_name": "./data/city.csv",
"conflict_columns": ["code"],
"version": 1
},
{
"entity_model_name": "HealthCareRoleFamily",
"table_name": "healthcarerolefamily",
"source_csv_name": "./data/ocupacao_familias.csv",
"conflict_columns": ["code"],
"version": 1
},
{
"entity_model_name": "HealthCareRole",
"table_name": "healthcarerole",
"source_csv_name": "./data/ocupacao_cbo.csv",
"conflict_columns": ["cbo"],
"version": 1
}
]
Loading

0 comments on commit e044cd9

Please sign in to comment.