Skip to content

Commit

Permalink
[stat_visualization mask_user_info] タスクlist.csvのマスクに失敗する不具合の修正 (#809)
Browse files Browse the repository at this point in the history
* version up

* update

* "number_of_rejections"を削除

* 習性

* update doc

* update
  • Loading branch information
yuji38kwmt authored Jun 30, 2022
1 parent 974f3f6 commit a35615c
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 14 deletions.
2 changes: 1 addition & 1 deletion annofabcli/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.66.1"
__version__ = "1.66.2"
13 changes: 12 additions & 1 deletion annofabcli/filesystem/mask_user_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,18 @@ def _get_tuple_column(df: pandas.DataFrame, column: str) -> Union[str, Tuple]:
return column


def replace_by_columns(df, replacement_dict: Dict[str, str], main_column: Any, sub_columns: Optional[List[Any]] = None):
def replace_by_columns(
df: pandas.DataFrame, replacement_dict: Dict[str, str], main_column: Any, sub_columns: Optional[List[Any]] = None
):
"""引数dfの中のユーザ情報を、指定した列名を元に置換します。
Args:
df (pandas.DataFrame): _description_
replacement_dict (Dict[str, str]): 置換対象のuser_idと置換後のuser_id(username)。key: 置換対象のuser_id, value: 置換後のuser_id
main_column: 置換対象の列名(ex: user_id)
sub_column: main_columnと同じ値で置換する列(ex: username)
"""

def _get_username(row, main_column: Any, sub_column: Any) -> str:
if row[main_column] in replacement_dict:
return replacement_dict[row[main_column]]
Expand Down
1 change: 0 additions & 1 deletion annofabcli/stat_visualization/mask_visualization_dir.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

def _replace_df_task(task: Task, replacement_dict_by_user_id: Dict[str, str]) -> Task:
df_output = task.df.copy()
replace_by_columns(df_output, replacement_dict_by_user_id, main_column="user_id", sub_columns=["username"])

replace_by_columns(
df_output,
Expand Down
5 changes: 0 additions & 5 deletions annofabcli/statistics/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,6 @@ def set_task_histories(cls, task: Task, task_histories: List[TaskHistory]):
for e in task_histories
)

# APIで取得した 'number_of_rejections' は非推奨で、number_of_rejections_by_inspection/acceptanceと矛盾する場合があるので、書き換える
task["number_of_rejections"] = (
task["number_of_rejections_by_inspection"] + task["number_of_rejections_by_acceptance"]
)

return task

@staticmethod
Expand Down
4 changes: 2 additions & 2 deletions annofabcli/statistics/visualization/dataframe/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,8 @@ def to_csv(self, output_file: Path) -> None:
"phase",
"phase_stage",
"status",
"number_of_rejections",
"number_of_rejections_by_inspection",
"number_of_rejections_by_acceptance",
"first_acceptance_completed_datetime",
# 1回目の教師付フェーズ
"first_annotation_user_id",
"first_annotation_username",
Expand All @@ -261,6 +259,8 @@ def to_csv(self, output_file: Path) -> None:
"first_acceptance_username",
"first_acceptance_worktime_hour",
"first_acceptance_started_datetime",
# 最後の受入
"first_acceptance_completed_datetime",
# 作業時間に関する内容
"worktime_hour",
"annotation_worktime_hour",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
project_id,task_id,phase,phase_stage,status,user_id,username,number_of_rejections,number_of_rejections_by_inspection,number_of_rejections_by_acceptance,started_datetime,updated_datetime,first_acceptance_completed_datetime,sampling,first_annotation_user_id,first_annotation_username,first_annotation_worktime_hour,first_annotation_started_datetime,first_inspection_user_id,first_inspection_username,first_inspection_worktime_hour,first_inspection_started_datetime,first_acceptance_user_id,first_acceptance_username,first_acceptance_worktime_hour,first_acceptance_started_datetime,worktime_hour,annotation_worktime_hour,inspection_worktime_hour,acceptance_worktime_hour,first_annotator_worktime_hour,first_inspector_worktime_hour,first_acceptor_worktime_hour,input_data_count,annotation_count,inspection_comment_count,input_data_count_of_inspection,annotator_is_changed,inspector_is_changed,acceptor_is_changed,inspection_is_skipped,acceptance_is_skipped,diff_days_to_first_acceptance_started,diff_days_to_first_inspection_started,diff_days_to_first_acceptance_completed,metadata
prj1,task1,acceptance,1,complete,NZ,NZ,0,0,0,2020-09-01T11:08:47.598+09:00,2020-09-01T11:09:40.359+09:00,2020-09-01T11:09:40.351+09:00,,QU,QU,0.091450555555556,2020-09-01T09:44:35.431+09:00,,,0,,NZ,NZ,0.014653611111111,2020-09-01T11:08:47.598+09:00,0.106104166666667,0.091450555555556,0,0.014653611111111,0.091450555555556,0,0.014653611111111,20,194,0,0,False,False,False,False,False,0.058474155092593,,0.059084722222222,{}
prj1,task2,acceptance,1,complete,NZ,NZ,0,0,0,2020-09-02T07:22:13.693+09:00,2020-09-02T07:23:38.295+09:00,2020-09-02T07:23:38.274+09:00,,KX,KX,0.533797777777778,2020-08-31T16:18:34.369+09:00,,,0,,NZ,NZ,0.023494722222222,2020-09-02T07:22:13.693+09:00,0.5572925,0.533797777777778,0,0.023494722222222,0.533797777777778,0,0.023494722222222,20,648,0,0,False,False,False,False,False,1.62753847222222,,1.62851741898148,{}
project_id,task_id,phase,phase_stage,status,number_of_rejections_by_inspection,number_of_rejections_by_acceptance,first_annotation_user_id,first_annotation_username,first_annotation_worktime_hour,first_annotation_started_datetime,first_inspection_user_id,first_inspection_username,first_inspection_worktime_hour,first_inspection_started_datetime,first_acceptance_user_id,first_acceptance_username,first_acceptance_worktime_hour,first_acceptance_started_datetime,first_acceptance_completed_datetime,worktime_hour,annotation_worktime_hour,inspection_worktime_hour,acceptance_worktime_hour,input_data_count,annotation_count,inspection_comment_count,inspection_is_skipped,acceptance_is_skipped
prj1,task1,acceptance,1,complete,0,0,TP,TP,0.091450555555556,2020-09-01T09:44:35.431+09:00,,,0,,QF,QF,0.014653611111111,2020-09-01T11:08:47.598+09:00,2020-09-01T11:09:40.351+09:00,0.106104166666667,0.091450555555556,0,0.014653611111111,20,194,0,False,False
prj1,task2,acceptance,1,complete,0,0,MO,MO,0.533797777777778,2020-08-31T16:18:34.369+09:00,,,0,,QF,QF,0.023494722222222,2020-09-02T07:22:13.693+09:00,2020-09-02T07:23:38.274+09:00,0.5572925,0.533797777777778,0,0.023494722222222,20,648,0,False,False
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,27 @@
* 教師付/検査/受入の作業時間
* 最初に教師付/検査/受入したユーザ

以下に、列名から内容が判断しづらい列の詳細を記載します。

* number_of_rejections_by_inspection : 検査フェーズで差し戻された回数
* number_of_rejections_by_acceptance : 受入フェーズで差し戻された回数

* first_annotation_user_id : 最初に教師付フェーズを開始したユーザーのuser_id
* first_annotation_username : 最初に教師付フェーズを開始したユーザーのusername
* first_annotation_worktime_hour : 最初に教師付フェーズの作業時間[hour]
* first_annotation_started_datetime : 最初に教師付フェーズを開始した日時

* worktime_hour: 作業時間[hour]
* annotation_worktime_hour: 教師付作業時間[hour]
* inspection_worktime_hour: 検査作業時間[hour]
* acceptance_worktime_hour: 受入作業時間[hour]

* input_data_count : タスクに含まれる入力データ数
* input_data_count : タスクに含まれるアノテーション数
* inspection_comment_count : 指摘された検査コメント数(対応不要のコメントは除く)

* inspection_is_skipped : 抜取検査により検査フェーズがスキップされたか
* acceptance_is_skipped : 抜取受入により受入フェーズがスキップされたか


`タスクlist.csv <https://github.com/kurusugawa-computer/annofab-cli/blob/main/docs/command_reference/statistics/visualize/out_dir/タスクlist.csv>`_
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "annofabcli"
version = "1.66.1"
version = "1.66.2"
description = "Utility Command Line Interface for AnnoFab"
authors = ["yuji38kwmt"]
license = "MIT"
Expand Down

0 comments on commit a35615c

Please sign in to comment.