Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Début de la refactorisation de l'interface dags/validations #1174

Merged
merged 26 commits into from
Jan 21, 2025
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
eff178c
Début de la refactorisation de l'interface dags/validations
kolok Jan 2, 2025
2e02f6c
simplification et proposition de modification
kolok Jan 2, 2025
7dcb234
WIP
kolok Jan 8, 2025
10e41f5
isolation de data
kolok Jan 9, 2025
ae95aa2
manage location
kolok Jan 10, 2025
fe8d8de
Ignorer les localisations nulle
kolok Jan 10, 2025
a5a6286
update migrations
kolok Jan 13, 2025
0bcf0aa
update tests
kolok Jan 13, 2025
c8fba02
Update tests
kolok Jan 14, 2025
1c8c8d1
keep dagrun managment and create suggestion aside it
kolok Jan 14, 2025
46d344f
isolation du dags d'ingestion des suggestions
kolok Jan 14, 2025
afb7446
update statut
kolok Jan 16, 2025
0bff938
Update jinja2/qfdmo/dags_validations.html
kolok Jan 16, 2025
cacbf74
déplacement de fichiers et suppression de champs inutilisés
kolok Jan 16, 2025
ec116f9
suppression type_action inutiles
kolok Jan 16, 2025
5505b48
clean source dags files
kolok Jan 16, 2025
7c8bbeb
renomme fonction db_write_type_action_suggestions
kolok Jan 19, 2025
a64edb4
corrections proposé lors de la relecture
kolok Jan 20, 2025
9f62fac
fix suggestion process
kolok Jan 20, 2025
9d2a0ce
logger stuff
kolok Jan 20, 2025
a37aba8
rename
kolok Jan 20, 2025
23ff597
update migrations
kolok Jan 20, 2025
f68434d
REJETER -> REJETEE
kolok Jan 20, 2025
c0190cf
remove useless FIXME
kolok Jan 20, 2025
963820b
extract cree_le et modifie_le dans un modèle abstrait et partagé
kolok Jan 20, 2025
e009a1d
utiliser modification plutôt que mises à jour
kolok Jan 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
utiliser modification plutôt que mises à jour
kolok committed Jan 21, 2025
commit e009a1d658c65df5ee29e98c5bb228bed0f49183
2 changes: 1 addition & 1 deletion dags/sources/config/shared_constants.py
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
# SuggestionCohorte actions
SUGGESTION_CLUSTERING = "CLUSTERING"
SUGGESTION_SOURCE_AJOUT = "SOURCE_AJOUT"
SUGGESTION_SOURCE_MISESAJOUR = "SOURCE_MISESAJOUR"
SUGGESTION_SOURCE_MODIFICATION = "SOURCE_MODIFICATION"
SUGGESTION_SOURCE_SUPRESSION = "SOURCE_SUPRESSION"

# Public accueilli
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ def db_write_type_action_suggestions(
metadata=metadata,
dag_name=f"{dag_name} - MISES A JOUR",
run_name=run_name,
type_action=constants.SUGGESTION_SOURCE_MISESAJOUR,
type_action=constants.SUGGESTION_SOURCE_MODIFICATION,
)


Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ def db_normalize_suggestion():
type_action
in [
constants.SUGGESTION_SOURCE_AJOUT,
constants.SUGGESTION_SOURCE_MISESAJOUR,
constants.SUGGESTION_SOURCE_MODIFICATION,
]
and not df_sql.empty
):
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ def db_write_validsuggestions(data_acteurs_normalized: dict):
with engine.begin() as connection:
if change_type in [
constants.SUGGESTION_SOURCE_AJOUT,
constants.SUGGESTION_SOURCE_MISESAJOUR,
constants.SUGGESTION_SOURCE_MODIFICATION,
]:
db_write_acteurupdate(
connection, df_actors, df_labels, df_acteur_services, df_pds, df_pdssc
2 changes: 1 addition & 1 deletion data/migrations/0002_tables_suggestion.py
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ class Migration(migrations.Migration):
"ingestion de source de données - nouveau acteur",
),
(
"SOURCE_MISESAJOUR",
"SOURCE_MODIFICATION",
"ingestion de source de données - modification d'acteur existant",
),
("SOURCE_SUPRESSION", "ingestion de source de données"),
8 changes: 4 additions & 4 deletions data/models.py
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
SUGGESTION_PARTIEL,
SUGGESTION_REJETEE,
SUGGESTION_SOURCE_AJOUT,
SUGGESTION_SOURCE_MISESAJOUR,
SUGGESTION_SOURCE_MODIFICATION,
SUGGESTION_SOURCE_SUPRESSION,
SUGGESTION_SUCCES,
)
@@ -34,8 +34,8 @@ class SuggestionAction(models.TextChoices):
SUGGESTION_SOURCE_AJOUT,
"ingestion de source de données - nouveau acteur",
)
SOURCE_MISESAJOUR = (
SUGGESTION_SOURCE_MISESAJOUR,
SOURCE_MODIFICATION = (
SUGGESTION_SOURCE_MODIFICATION,
"ingestion de source de données - modification d'acteur existant",
)
SOURCE_SUPPRESSION = SUGGESTION_SOURCE_SUPRESSION, "ingestion de source de données"
@@ -72,7 +72,7 @@ class SuggestionCohorte(TimestampedModel):
def is_source_type(self) -> bool:
return self.type_action in [
SuggestionAction.SOURCE_AJOUT,
SuggestionAction.SOURCE_MISESAJOUR,
SuggestionAction.SOURCE_MODIFICATION,
SuggestionAction.SOURCE_SUPPRESSION,
]

2 changes: 1 addition & 1 deletion data/views.py
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
ACTION_TO_VERB = {
SuggestionAction.SOURCE_AJOUT: "ajoutera",
SuggestionAction.SOURCE_SUPPRESSION: "supprimera",
SuggestionAction.SOURCE_MISESAJOUR: "mettra à jour",
SuggestionAction.SOURCE_MODIFICATION: "modifiera",
}


2 changes: 1 addition & 1 deletion templates/data/_partials/source_event.html
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ <h3>Exemples</h3>
<div class="fr-table">
<table>
<caption>Suggestion de source à valider</caption>
{% if suggestion_cohorte_instance.type_action == "SOURCE_AJOUT" or suggestion_cohorte_instance.type_action == "SOURCE_MISESAJOUR" %}
{% if suggestion_cohorte_instance.type_action == "SOURCE_AJOUT" or suggestion_cohorte_instance.type_action == "SOURCE_MODIFICATION" %}
{% include 'data/_partials/source_ajout_event.html' %}
{% elif suggestion_cohorte_instance.type_action == "SOURCE_SUPRESSION" %}
{% include 'data/_partials/source_supression_event.html' %}
4 changes: 2 additions & 2 deletions unit_tests/data/test_models.py
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
"type_action, expected_result",
[
(SuggestionAction.SOURCE_AJOUT, True),
(SuggestionAction.SOURCE_MISESAJOUR, True),
(SuggestionAction.SOURCE_MODIFICATION, True),
(SuggestionAction.SOURCE_SUPPRESSION, True),
(SuggestionAction.CLUSTERING, False),
("other_action", False),
@@ -26,7 +26,7 @@ def test_is_source_type(type_action, expected_result):
[
(SuggestionAction.CLUSTERING, True),
(SuggestionAction.SOURCE_AJOUT, False),
(SuggestionAction.SOURCE_MISESAJOUR, False),
(SuggestionAction.SOURCE_MODIFICATION, False),
(SuggestionAction.SOURCE_SUPPRESSION, False),
("other_action", False),
],