Skip to content

Commit

Permalink
feat(lovac): add unmanaged modesl
Browse files Browse the repository at this point in the history
  • Loading branch information
alexisig committed Jan 8, 2025
1 parent 1c01b18 commit 648c9a0
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 0 deletions.
26 changes: 26 additions & 0 deletions airflow/dags/update_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ def copy_table_from_dw_to_app(
"copy_public_data_couverturesol",
"copy_public_data_usagesol",
"copy_public_data_couvertureusagematrix",
"copy_public_data_logementvacant",
"copy_public_data_autorisationlogement",
],
type="array",
),
Expand Down Expand Up @@ -447,6 +449,28 @@ def copy_public_data_couvertureusagematrix(**context):
],
)

@task.python
def copy_public_data_logementvacant(**context):
return copy_table_from_dw_to_app(
from_table="public_for_app.for_app_logementvacant",
to_table="public.public_data_logementvacant",
environment=context["params"]["environment"],
btree_index_columns=[
["land_id", "land_type", "year"],
],
)

@task.python
def copy_public_data_autorisationlogement(**context):
return copy_table_from_dw_to_app(
from_table="public_for_app.for_app_autorisationlogement",
to_table="public.public_data_autorisationlogement",
environment=context["params"]["environment"],
btree_index_columns=[
["land_id", "land_type", "year"],
],
)

@task.branch
def copy_public_data_branch(**context):
return context["params"]["tasks"]
Expand Down Expand Up @@ -478,6 +502,8 @@ def copy_public_data_branch(**context):
copy_public_data_couverturesol(),
copy_public_data_usagesol(),
copy_public_data_couvertureusagematrix(),
copy_public_data_logementvacant(),
copy_public_data_autorisationlogement(),
]


Expand Down
1 change: 1 addition & 0 deletions public_data/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
from .mixins import * # noqa: F401, F403
from .ocsge import ArtificialArea, Ocsge, OcsgeDiff, ZoneConstruite # noqa: F401, F403
from .sudocuh import Sudocuh, SudocuhEpci # noqa: F401
from .urbanisme import * # noqa: F401, F403
19 changes: 19 additions & 0 deletions public_data/models/urbanisme/AutorisationLogement.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from django.db import models

from public_data.models.administration import AdminRef


class AutorisationLogement(models.Model):
land_id = models.CharField()
land_type = models.CharField(choices=AdminRef.CHOICES)
year = models.IntegerField()
logements_autorises = models.IntegerField()
logements_commences = models.IntegerField()
surface_de_plancher_autorisee = models.DecimalField()
surface_de_plancher_commencee = models.DecimalField()
percent_autorises_on_parc_general = models.DecimalField()
percent_autorises_on_vacants_parc_general = models.DecimalField()

class Meta:
managed = False
db_table = "public_data_autorisationlogement"
20 changes: 20 additions & 0 deletions public_data/models/urbanisme/LogementVacant.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from django.db import models

from public_data.models.administration import AdminRef


class LogementVacant(models.Model):
land_id = models.CharField()
land_type = models.CharField(choices=AdminRef.CHOICES)
year = models.IntegerField()
logements_parc_prive = models.IntegerField()
logements_vacants_parc_prive = models.IntegerField()
logements_parc_social = models.IntegerField()
logements_vacants_parc_social = models.IntegerField()
logements_vacants_parc_general_percent = models.DecimalField()
logements_vacants_parc_prive_percent = models.DecimalField()
logements_vacants_parc_social_percent = models.DecimalField()

class Meta:
managed = False
db_table = "public_data_logementvacant"
7 changes: 7 additions & 0 deletions public_data/models/urbanisme/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from .AutorisationLogement import AutorisationLogement
from .LogementVacant import LogementVacant

__all__ = [
"AutorisationLogement",
"LogementVacant",
]

0 comments on commit 648c9a0

Please sign in to comment.