{
	"name": "form/manager/productivity_report/reduce.json",
	"definition": {
		"develop_chart": {
			"filter": {
				"name": "form/manager/productivity_report/filter.json",
				"definition": "develop_chart"
			},
			"reduce": "combine",
			"combine": ["year_month"],
			"first": ["year_month", "load_group"],
			"sum": ["actual_hour", "planned_hour", "std_time", "work_time", "not_failed", "produced"],
			"sort": ["year_month", ">"]
		},
		"develop_chart_old": {
			"reduce": "combine",
			"combine": ["x"],
			"first": ["x"],
			"avg": ["y"]
		},
		"speed_row_other_lg": {
			"filter": {
				"name": "form/manager/productivity_report/filter.json",
				"definition": "speed_row_other_lg"
			},
			"reduce": "count",
			"unique": "prwo.resource_id"
		},
		"speed_row": {
			"reduce": "combine",
			"combine": ["prwo.production_lot", "prwo.work_phase_number"],
			"sum": ["prwo.work_hours", "work_time", "std_time"],
			"sum_filterX": {
				"name": "form/manager/productivity_report/filter.json",
				"definition": "finished_work_time"
			},
			"sum_filterXX": ["std_time", ">", 0],
			"max": ["estimated_speed_percent", "std_speed_percent"],
			"first": [
				"prwo.work_phase_number",
				"finished_work_time",
				"before_time_period_sum",
				"estimated_work_time",
				"estimated_work_time__unit",
				"finished_estimated_work_time",
				"finished_estimated_work_time__unit",
				"wos_produced",
				"wos_failed",
				"wos_finished",
				"prwo.record_id",
				"prwo.production_lot",
				"pro.drawing_number",
				"pr.name",
				"prwo.person_id",
				"prwo.resource_id"
			],
			"last": ["after_time_period_sum"]
		},
		"speed_row_all": {
			"reduce": "combine",
			"sort": [
				"prwo.production_lot",
				">",
				"prwo.work_phase_number",
				">",
				"target_date",
				">",
				"prwo.json_data.work_shift",
				">",
				"prwo.json_data.end_date",
				">",
				"prwo.json_data.end_time",
				">",
				"prwo.resource_id",
				">"
			],
			"combine": ["prwo.production_lot", "prwo.work_phase_number"],
			"sum": ["prwo.work_hours", "work_time", "std_time"],
			"unique": ["prwo.resource_id"],
			"max": ["estimated_speed_percent", "std_speed_percent"],
			"first": [
				"work_time_all",
				"prwo.work_phase_number",
				"finished_work_time",
				"before_time_period_sum",
				"estimated_work_time",
				"estimated_work_time__unit",
				"finished_estimated_work_time",
				"finished_estimated_work_time__unit",
				"wos_produced",
				"wos_failed",
				"wos_finished",
				"prwo.record_id",
				"prwo.production_lot",
				"pro.drawing_number",
				"pr.name",
				"prwo.person_id"
			],
			"last": ["after_time_period_sum"]
		},
		"finished_estimated_work_time": {
			"filter": {
				"name": "form/manager/productivity_report/filter.json",
				"definition": "finished_estimated_work_time"
			},
			"reduce": "sum",
			"field": "finished_estimated_work_time"
		},
		"finished_work_time": {
			"filter": {
				"name": "form/manager/productivity_report/filter.json",
				"definition": "finished_work_time"
			},
			"reduce": "sum",
			"field": "finished_work_time"
		},
		"prwo.produced_amount": {
			"filter": {
				"name": "form/manager/productivity_report/filter.json",
				"definition": "quality"
			},
			"reduce": "sum",
			"field": "prwo.produced_amount"
		},
		"prwo.failed_amount": {
			"filter": {
				"name": "form/manager/productivity_report/filter.json",
				"definition": "quality"
			},
			"reduce": "sum",
			"field": "prwo.failed_amount"
		},
		"prwo.work_hours": {
			"reduce": "sum",
			"field": "prwo.work_hours"
		},
		"wlg_header": {
			"map": {
				"name": "form/manager/productivity_report/map.json",
				"definition": "wlg_header"
			},
			"reduce": "first",
			"field": "wlg_header",
			"default": ""
		},
		"finished_repair_amount": {
			"filter": {
				"name": "form/manager/productivity_report/filter.json",
				"definition": "finished_reclamation"
			},
			"reduce": "sum",
			"field": "rcl.repair_amount"
		},
		"finished_rejected_amount": {
			"filter": {
				"name": "form/manager/productivity_report/filter.json",
				"definition": "finished_reclamation"
			},
			"reduce": "sum",
			"field": "rcl.rejected_amount"
		},
		"capacity_shift": {
			"filter": {
				"name": "form/manager/productivity_report/filter.json",
				"definition": "capacity_shift"
			},
			"reduce": "sum",
			"field": "hours"
		},
		"planned_hour": {
			"info": "currently same as capacity",
			"filter": {
				"name": "form/manager/productivity_report/filter.json",
				"definition": "capacity"
			},
			"reduce": "sum",
			"field": "hours"
		},
		"actual_hour": {
			"info": "AGA: fix, map to new field setup time + work time?, MUST divide by shift",
			"filter": {
				"name": "form/manager/productivity_report/filter.json",
				"definition": "capacity_work_time"
			},
			"reduce": "sum",
			"field": "prwo.work_hours"
		},
		"actual_machine_hour": {
			"info": "actual_machine_hour",
			"filter": {
				"name": "form/manager/productivity_report/filter.json",
				"definition": "capacity_work_time"
			},
			"reduce": "sum",
			"field": "prwo.machine_hours"
		},
		"unproductive_hour": {
			"info": "unproductive_hour",
			"filter": {
				"name": "form/manager/productivity_report/filter.json",
				"definition": "capacity_unproductive_work_time"
			},
			"reduce": "sum",
			"field": "prwo.work_hours"
		},
		"rcl.repair_amount": {
			"reduce": "sum",
			"field": "rcl.repair_amount"
		},
		"rcl.rejected_amount": {
			"filter": {
				"name": "form/manager/productivity_report/filter.json",
				"definition": "rcl.rejected_amount"
			},
			"reduce": "sum",
			"field": "rcl.rejected_amount"
		},
		"track_time_asked_counter": {
			"reduce": "count",
			"filter": {
				"name": "form/manager/productivity_report/filter.json",
				"definition": "track_time_asked"
			}
		},
		"track_time_measured_counter": {
			"reduce": "count",
			"filter": {
				"name": "form/manager/productivity_report/filter.json",
				"definition": "track_time_measured"
			}
		},
		"track_time_changed_counter": {
			"reduce": "count",
			"filter": {
				"name": "form/manager/productivity_report/filter.json",
				"definition": "track_time_changed"
			}
		},
		"track_time_changed_percent": {
			"reduce": "sum",
			"filter": {
				"name": "form/manager/productivity_report/filter.json",
				"definition": "track_time_changed"
			},
			"field": "track_time_change_percent"
		}
	}
}
