Skip to content

Commit

Permalink
adjust batch endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasFaria committed Nov 4, 2024
1 parent 8db087c commit 3ce450f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class Forms(BaseModel):
activity_permanence_status: List[str]

class Config:
schema_extra = {
json_schema_extra = {
"example": {
"description_activity": [
(
Expand Down
26 changes: 24 additions & 2 deletions app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,30 @@ def preprocess_batch(training_names: list, query: dict) -> dict:
check_format_features(df["event"].to_list(), "event", r"^\d{2}[PMF]$")

# TODO: Add check for cj and activity_permanence_status*

df = df.replace(np.nan, "NaN")
# TODO: make it cleaner
df.loc[:, ["other_nature_activity", "precision_act_sec_agricole"]] = df[
["other_nature_activity", "precision_act_sec_agricole"]
].replace(np.nan, "")
df.loc[
:,
[
"type_form",
"nature",
"surface",
"event",
"cj",
"activity_permanence_status",
],
] = df[
[
"type_form",
"nature",
"surface",
"event",
"cj",
"activity_permanence_status",
]
].replace(np.nan, "NaN")

query = df.rename(
columns={
Expand Down

0 comments on commit 3ce450f

Please sign in to comment.