Skip to content

Commit

Permalink
Ignore any exotic af_kind like ACIPA
Browse files Browse the repository at this point in the history
  • Loading branch information
dejafait committed Jul 1, 2022
1 parent c75e6d3 commit e3e762f
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions itou/siaes/management/commands/_import_siae/vue_af.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def get_vue_af_df():
df["kind"] = df["kind"].str.replace("_DC", "")

# Filter out rows with irrelevant kind.
df = df[~df.kind.isin(["FDI", "EIPA"])]
df = df[df.kind.isin(SIAE_WITH_CONVENTION_KINDS)]

# Build complete AF number.
df["number"] = df.number_prefix + "A" + df.renewal_number.astype(str) + "M" + df.modification_number.astype(str)
Expand All @@ -79,11 +79,6 @@ def get_vue_af_df():
# A ValidationError will be raised if any number is incorrect.
df.number.apply(validate_af_number)

# Ensure data quality.
# FIXME(vporte): It's bad practive to iterate over the rows. We can assert on the whole column.
for _, row in df.iterrows():
assert row.kind in SIAE_WITH_CONVENTION_KINDS

df["ends_in_the_future"] = df.end_date.apply(timezone.make_aware) > timezone.now()
df["has_active_state"] = df.state.isin(SiaeFinancialAnnex.STATES_ACTIVE)
df["is_active"] = df.has_active_state & df.ends_in_the_future
Expand Down

0 comments on commit e3e762f

Please sign in to comment.