rename folder

This commit is contained in:
Deepthi
2021-03-19 16:58:28 +05:30
parent 184638f10d
commit 9f2ce1d49b
50 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1,125 @@
drop function if exists mmt_staging2.fn_BUDNI_DBP_ODS ;
CREATE OR REPLACE FUNCTION mmt_staging2.fn_BUDNI_DBP_ODS()
RETURNS void AS $$
begin
insert into mmt_ods.test_instance_tractor_info
(
client_id,
function_id,
test_file_ref_no,
test_file_format,
test_file_sheet_format,
tractor_make,
tractor_model,
configuration,
Transmission_type,
Wheel_Drive_Type,
Steering_type,
Hitch_Height,
Ballast_condition
)
select
client_id,
function_id,
file_syspk ,
file_format,
sheet_mnemonic,
column3,
column4,
column7,
column8,
column9,
column11,
column13::int,
column14
from mmt_staging2.BUDNI_DBP_Spec_H1_Block where ods_record =1 ;
insert into mmt_ods.test_instance
(
client_id,
function_id,
test_file_ref_no,
test_file_format,
test_file_sheet_format,
tractor_make,
tractor_model,
type_of_road
)
select
client_id,
function_id,
file_syspk ,
file_format,
sheet_mnemonic,
column3,
column4,
column15
from mmt_staging2.BUDNI_DBP_Spec_H1_Block where ods_record =1 ;
insert into mmt_ods.test_instance_engine_info
(
client_id,
function_id,
test_file_ref_no,
test_file_format,
test_file_sheet_format,
tractor_make,
tractor_model,
Rated_RPM,
engine_to_pto_ratio_540_pto
)
select
client_id,
function_id,
file_syspk ,
file_format,
sheet_mnemonic,
column3,
column4,
column6::int,
column12
from mmt_staging2.BUDNI_DBP_Spec_H1_Block where ods_record =1 ;
insert into mmt_ods.budni_drawbar_perf_results
(
client_id,
function_id,
test_file_ref_no,
test_file_format,
test_file_sheet_format,
tractor_make,
tractor_model,
test_condtion,
gear_used,
travel_speed_km_per_h,
drawbar_power_kw,
drawbar_pull_kn,
engine_speed_rpm,
wheel_slip_pct,
fuel_consumption_kg_per_kwh,
fuel_consumption_l_per_h,
specific_energy_kwh_per_ltr,
atmosp_conditions_pressure_kpa,
atmosp_conditions_rh_pct,
atmosp_conditions_temp_c,
temp_trans_oil_c,
temp_coolant_c,
temp_fuel_c,
temp_engine_oil_c
)
select
client_id,function_id,file_syspk,file_format,sheet_mnemonic,make,model,
column2,column3,column4::float,column5::float,column6::float,column7::float,
column8::float,column9::float,column10::float,column11::float,column12,column13,
column14,column15,column16,column17,column18
from mmt_staging2.BUDNI_DBP_Drawbar_Perf_Block where ods_record = 1;
end
$$ LANGUAGE plpgsql;
select mmt_staging2.fn_BUDNI_DBP_ODS();

View File

@@ -0,0 +1,219 @@
drop function if exists mmt_staging2.fn_BUDNI_PTO_ODS;
CREATE OR REPLACE FUNCTION mmt_staging2.fn_BUDNI_PTO_ODS()
RETURNS void AS $$
begin
SET search_path TO mmt_staging2;
insert into mmt_ods.test_instance_tractor_info
(
client_id,
function_id,
test_file_ref_no,
test_file_format,
test_file_sheet_format,
tractor_make,
tractor_model,
tractor_engine_hp,
configuration,
fip_type,
steering_type,
transmission_type,
wheel_drive_type
)
select
client_id,
function_id,
file_syspk,
file_format,
sheet_mnemonic,
make,
model,
tractor_HP::int,
configuration,FIP_type,steering_type,transmission_type,wheel_drive_type
from mmt_staging2.BUDNI_PTO_Spec_H1_block;
insert into mmt_ods.test_instance
(
client_id,
function_id,
test_file_ref_no,
test_file_format,
test_file_sheet_format,
tractor_make,
tractor_model
)
select
client_id,
function_id,
file_syspk,
file_format,
sheet_mnemonic,
make,model
from
mmt_staging2.BUDNI_PTO_Spec_H1_block;
insert into mmt_ods.test_instance_engine_info
(
client_id,
function_id,
test_file_ref_no,
test_file_format,
test_file_sheet_format,
tractor_make,
tractor_model,
rated_rpm,
engine_to_pto_ratio_540_pto
)
select
client_id,
function_id,
file_syspk,
file_format,
sheet_mnemonic,
make,model,
rated_rpm::int,
engine_to_pto_ratio
from mmt_staging2.BUDNI_PTO_Spec_H1_block;
/*block */
insert into mmt_ods.budni_pto_perf_results_summary
(
client_id,
function_id,
test_file_ref_no,
test_file_format,
test_file_sheet_format,
tractor_make,
tractor_model,
pto_category ,
pto_sub_category ,
power_kw,
speed_rpm_pto ,
speed_rpm_engine ,
fuel_consumption_lh,
fuel_consumption_kgh,
specific_kg_per_kwh,
specifc_energy_kwhl
)
select
client_id,
function_id,
file_syspk,
file_format,
sheet_mnemonic,
make,model,
column2,
column3,
column4::numeric,column5::numeric,column6::numeric,column7::numeric,column8::numeric,
column9::numeric,column10::numeric
from mmt_staging2.BUDNI_PTO_Perf_Report_block where ods_record=1
order by rank;
/*block */
insert into mmt_ods.budni_pto_perf_results_details
(
client_id,
function_id,
test_file_ref_no,
test_file_format,
test_file_sheet_format,
tractor_make,
tractor_model,
ambient_type,
no_load_max_engine_speed_rpm,
equi_crankshaft_torque_at_max_power_nm,
max_equi_crankshaft_torque_nm,
engine_speed_at_max_equi_crankshaft_torque_rpm,
backup_torque,
pct_smoke_level_max_light_absorption_coef_per_mtr,
range_of_atm_conditions_temp_c,
range_of_atm_conditions_pressure_kpa,
range_of_atm_conditions_rel_humidity_pct
)
select
client_id,
function_id,
file_syspk,
file_format,
sheet_mnemonic,
make,model,
column3,
column4::int,
column5::numeric,
column6::numeric,column7::int,column8::numeric,
column9::numeric,column10,column11,column12
from mmt_staging2.BUDNI_PTO_MMTKeyword1_block
where ods_record=1;
/* block */
insert into mmt_ods.budni_pto_perf_results_details
(
client_id,
function_id,
test_file_ref_no,
test_file_format,
test_file_sheet_format,
tractor_make,
tractor_model,
ambient_type,
max_temp_engine_oil_c,
max_temp_coolant_water_c,
max_temp_fuel_c,
max_temp_air_intake_c,
max_temp_exhaust_gas_c,
pressure_at_max_power_intake_air_kpa,
pressure_at_max_power_exhst_gas_bfr_turbo_charger_kpa,
consumptions_lub_oil_gkwh,
consumptions_coolant_water_pct_of_total_coolant_capacity
)
select client_id,
function_id,
file_syspk,
file_format,
sheet_mnemonic,
make,model,
column3,
column4::numeric,column5::numeric,column6::numeric,column7::numeric,column8::numeric,column9::numeric,
column10,column11::numeric,column12::numeric
from mmt_staging2.BUDNI_PTO_MMTKeyword2_block
where ods_record=1 and column3='Natural Ambient';
insert into mmt_ods.budni_test_observations
(
client_id,
function_id,
test_file_ref_no,
test_file_format,
test_file_sheet_format,
tractor_make,
tractor_model,
srl_no,
characteristic,
category_evaluative_or_non_evaluative,
requirements_as_per_is_12207_2008,
values_declared_by_the_applicant_d_rqmt,
as_observed,
whether_meets_the_requirements_yesno
)
select client_id,
function_id,
file_syspk,
file_format,
sheet_mnemonic,
make,model,column3,column4,column7,column8,column10,column11,column12
from mmt_staging2.BUDNI_PTO_Summary_block
where rank in (3,4) and ods_record=1
;
end
$$ LANGUAGE plpgsql;
select mmt_staging2.fn_BUDNI_PTO_ODS();

View File

@@ -0,0 +1,241 @@
drop function if exists mmt_staging2.fn_FTDRY_SUM_ODS ;
CREATE OR REPLACE FUNCTION mmt_staging2.fn_FTDRY_SUM_ODS()
RETURNS void AS $$
begin
execute 'insert into mmt_ods.field_perf_summary_tractor_info
(
client_id,
function_id,
tractor_model,
tractor_make,
tractor_engine_hp,
rated_rpm,
transmission_type,
wheel_drive_type,
fip_type,
steering_type,
tractor_weight_front_kg,
tractor_weight_rear_kg,
tractor_weight_total_kg,
test_file_ref_no,
)
select
client_id,
function_id,
tractor_model,
tractor_make,
tractor_engine_hp::float,
rated_rpm::int,
transmission_type,
wheel_drive_type,
fip_type,
steering_type,
tractor_weight_kg_front::int,
tractor_weight_kg_rear::int,
tractor_weight_kg_total::int,
file_number
from mmt_staging2.ftdry_sum_trac_h1_block where tractor_model<> '0'';
execute 'insert into mmt_ods.field_perf_summary_implement_info
(
client_id,
function_id,
make_of_implement,
implement_type,
implement_size,
hitch_category,
implement_weight,
soil_type,
soil_moisture_content_pct,
soil_bulk_density_g_per_cc,
soil_cone_index,
field_condition,
season,
test_file_ref_no
)
select
client_id,
function_id,
make_of_implement,
implement_type,
implement_size,
hitch_category,
implement_weight::int,
soil_type,
moisture_content::int soil_moisture_content_pct,
bulk_density_g_cc::int soil_bulk_density_g_per_cc,
soil_cone_index::int soil_cone_index,
field_condition,
season,
file_number
from mmt_staging2.ftdry_sum_implement_block';
execute 'insert into mmt_ods.field_perf_summary
(
client_id,
function_id,
test_condition,
test_date,
tractor_model,
engine_rpm_set,
pto_rpm_set,
gear_used,
nominal_speed_kmph,
engine_rpm_drop_on_straight_1st_pass,
engine_rpm_drop_on_turn_1st_pass,
depth_of_cut_cm,
no_load_speed_kmph,
on_load_speed_kmph,
wheel_slippage_pct,
fuel_consumption_lit_per_hr,
area_covered_acr_per_hr,
fuel_consumption_lit_per_acr,
fuel_consumption_var_lit_per_hr,
area_covered_var_acr_per_hr,
fuel_consumption_var_lit_per_acr,
engine_smoke_on_load,
engine_acceleration_smoke,
draft_response,
tractor_steer_ability,
tractor_braking_perfprmance,
front_visibility,
implement_accessibility,
front_wheel_dragging_at_turning,
front_end_lifting_during_operation,
rpm_recovery_time,
engine_vibration,
engine_sound,
implement_lifting_per_lowering_response,
pulverization_index,
pulverization_quality,
test_file_ref_no
)
select
client_id,
function_id,
test_condition,
test_date::date,
tractor_model,
engine_rpm_set::int,
pto_rpm_set::int,
gear_used,
nominal_speed_kmph::float,
engine_rpm_drop_on_straight engine_rpm_drop_on_straight_1st_pass ,
engine_rpm_drop_on_turn engine_rpm_drop_on_turn_1st_pass,
depth_of_cut_cm,
no_load_speed_kmph::int,
on_load_speed_kmph::int,
wheel_slippage_::int wheel_slippage_pct,
fuel_consumption_lit_hr::float fuel_consumption_lit_per_hr,
area_covered_acr_hr::int area_covered_acr_per_hr,
fuel_consumption_lit_acr::float fuel_consumption_lit_per_acr ,
fuel_consumption_lit_hr_2::int fuel_consumption_var_lit_per_hr,
area_covered_acr_hr_2::int area_covered_var_acr_per_hr ,
fuel_consumption_lit_acr_2::int fuel_consumption_var_lit_per_acr,
engine_smoke_on_load,
engine_acceleration_smoke ,
draft_response,
tractor_steer_ability,
tractor_braking_performance,
front_visibility,
implement_accessibility,
front_wheel_dragging_at_turning,
front_end_lifting_during_operation,
rpm_recovery_time,
engine_vibration,
engine_sound,
implement_lifting_lowering_response implement_lifting_per_lowering_response,
pulverization_index,
pulverization_quality,
file_number
from mmt_staging2.ftdry_sum_test_condition_1_block where engine_rpm_set <> '0'';
execute 'insert into mmt_ods.field_perf_summary
(
client_id,
function_id,
test_condition,
test_date,
tractor_model,
engine_rpm_set,
pto_rpm_set,
gear_used,
nominal_speed_kmph,
engine_rpm_drop_on_straight_1st_pass,
engine_rpm_drop_on_turn_1st_pass,
depth_of_cut_cm,
no_load_speed_kmph,
on_load_speed_kmph,
wheel_slippage_pct,
fuel_consumption_lit_per_hr,
area_covered_acr_per_hr,
fuel_consumption_lit_per_acr,
fuel_consumption_var_lit_per_hr,
area_covered_var_acr_per_hr,
fuel_consumption_var_lit_per_acr,
engine_smoke_on_load,
engine_acceleration_smoke,
draft_response,
tractor_steer_ability,
tractor_braking_perfprmance,
front_visibility,
implement_accessibility,
front_wheel_dragging_at_turning,
front_end_lifting_during_operation,
rpm_recovery_time,
engine_vibration,
engine_sound,
implement_lifting_per_lowering_response,
pulverization_index,
pulverization_quality,
test_file_ref_no
)
select
client_id,
function_id,
test_condition,
test_date::date,
tractor_model,
engine_rpm_set::int,
pto_rpm_set::int,
gear_used,
nominal_speed_kmph::float,
engine_rpm_drop_on_straight engine_rpm_drop_on_straight_1st_pass ,
engine_rpm_drop_on_turn engine_rpm_drop_on_turn_1st_pass,
depth_of_cut_cm,
no_load_speed_kmph::int,
on_load_speed_kmph::int,
wheel_slippage_::int wheel_slippage_pct,
fuel_consumption_lit_hr::float fuel_consumption_lit_per_hr,
area_covered_acr_hr::int area_covered_acr_per_hr,
fuel_consumption_lit_acr::float fuel_consumption_lit_per_acr ,
fuel_consumption_lit_hr_2::int fuel_consumption_var_lit_per_hr,
area_covered_acr_hr_2::int area_covered_var_acr_per_hr ,
fuel_consumption_lit_acr_2::int fuel_consumption_var_lit_per_acr,
engine_smoke_on_load,
engine_acceleration_smoke ,
draft_response,
tractor_steer_ability,
tractor_braking_performance,
front_visibility,
implement_accessibility,
front_wheel_dragging_at_turning,
front_end_lifting_during_operation,
rpm_recovery_time,
engine_vibration,
engine_sound,
implement_lifting_lowering_response implement_lifting_per_lowering_response,
pulverization_index,
pulverization_quality
file_number,
from mmt_staging2.ftdry_sum_test_condition_2_block where engine_rpm_set <> '0'';
end
$$ LANGUAGE plpgsql;
select mmt_staging2.fn_FTDRY_SUM_ODS();

View File

@@ -0,0 +1,229 @@
drop function if exists mmt_staging2.fn_FTHLG_SUM_ODS ;
CREATE OR REPLACE FUNCTION mmt_staging2.fn_FTHLG_SUM_ODS()
RETURNS void AS $$
begin
execute 'insert into mmt_ods.field_perf_summary_tractor_info
(
client_id,
function_id,
tractor_model,
tractor_make,
tractor_engine_hp,
rated_rpm,
transmission_type,
wheel_drive_type,
fip_type,
steering_type,
tractor_weight_front_kg,
tractor_weight_rear_kg,
tractor_weight_total_kg,
test_file_ref_no
)
select
client_id,
function_id,
tractor_model,
tractor_make ,
tractor_engine_hp::int,
rated_rpm::int,
transmission_type,
wheel_drive_type,
fip_type,
steering_type,
tractor_weight_kg_front::int tractor_weight_front_kg,
tractor_weight_kg_rear::int tractor_weight_rear_kg,
tractor_weight_kg_total::int tractor_weight_total_kg,
file_number
from mmt_staging2.fthlg_sum_trac_h1_block where tractor_model<> '0'';
execute 'insert into mmt_ods.field_perf_summary_trailer_info
(
client_id,
function_id,
trailer_type,
tire_size_and_inflation_pressure_psi,
no_of_axle,
no_of_wheels,
trailer_gross_weight_kg,
tractor_rwc_to_hitch_point_center_dist_mm,
tractor_hitch_height_from_ground_mm,
trailer_hitch_height_above_ground_level_mm,
gradient_slope_1_degree,
gradient_slope_2_degree,
tractor_hitch_type,
test_file_ref_no
)
select
client_id,
function_id,
Trailer_Type,
Tire_size_and_inflation_pressure_psi,
No_Of_Axle::int ,
No_Of_Wheels::int,
Trailer_Gross_Weight_Kg::int,
Tractor_Rear_Wheel_Center_to_Hitch_Point_Center_Distance_mm::int,
Tractor_Hitch_Height_from_Ground_mm::int,
Trailer_hitch_Height_above_ground_level_mm::int,
Gradient_Slope_1_Degree::int,
Gradient_Slope_2_degree::int,
Tractor_Hitch_Type,
file_number
from mmt_staging2.FTHLG_SUM_Trail_Type_Block';
execute 'insert into mmt_ods.field_perf_summary
(
client_id,
function_id,
test_condition,
test_date,
tractor_model,
fuel_consumption_lit_per_hr,
mileage_km_per_ltr,
avg_speed_of_travel_kmph,
total_dist_travelled_km,
gear_used_on_straight_road,
straight_road_rpm_drop,
gear_used_on_up_slope_1,
up_slope_rpm_drop_1,
gear_used_on_up_slope_2,
up_slope_rpm_drop_2,
gear_used_on_down_slope,
down_slope_rpm_shoot_up,
fuel_consumption_var_lit_per_hr,
mileage_var_km_per_ltr,
fuel_consumption_var_pct_lit_per_hr,
mileage_var_pct_km_per_ltr,
engine_smoke_on_load,
engine_acceleration_smoke,
range_gear_shifting,
speed_gear_shifting,
tractor_steer_ability,
tractor_braking_perf,
front_visibility,
implement_accessibility,
front_end_lifting_during_operation,
rpm_recovery_time,
engine_vibration,
engine_sound,
test_file_ref_no
)
select
client_id,
function_id,
Test_Condition,
Test_Date::date,
Tractor_Model,
Fuel_consumption_Ltr_hr::float fuel_consumption_lit_per_hr ,
Mileage_Km_Ltr ::float mileage_km_per_ltr ,
Average_speed_of_travel_kmph::float avg_speed_of_travel_kmph ,
Total_distance_travelled_km::int total_dist_travelled_km ,
Gear_used_on_Straight_Road,
Straight_road_RPM_Drop,
Gear_used_on_Up_Slope_1,
Up_Slope_RPM_Drop_1 ,
Gear_used_on_Up_Slope_2,
Up_Slope_RPM_Drop_2,
Gear_used_on_Down_Slope,
Down_Slope_RPM_Shoot_up,
case when fuel_consumption_lit_hr_2 ~ E'^\\d+$' then fuel_consumption_lit_hr_2::int else null end as fuel_consumption_var_lit_per_hr ,
case when Mileage_Km_Ltr_2 ~ E'^\\d+$' then Mileage_Km_Ltr_2::int else null end as mileage_var_km_per_ltr,
case when fuel_consumption_lit_hr_3 ~ E'^\\d+$' then fuel_consumption_lit_hr_3::int else null end as fuel_consumption_var_pct_lit_per_hr ,
case when Mileage_Km_Ltr_3 ~ E'^\\d+$' then Mileage_Km_Ltr_3::int else null end as mileage_var_pct_km_per_ltr,
engine_smoke_on_load,
Engine_acceleration_smoke,
Range_Gear_Shifting,
Speed_Gear_Shifting,
Tractor_Steer_ability,
Tractor_braking_performance tractor_braking_perf ,
Front_Visibility,
Implement_Accessibility,
Front_end_lifting_during_operation,
RPM_Recovery_Time,
Engine_Vibration,
Engine_Sound,
file_number
from mmt_staging2.fthlg_sum_test_condition_1_block where Gear_used_on_Straight_Road not in ('0','0.000')';
execute 'insert into mmt_ods.field_perf_summary
(
client_id,
function_id,
test_condition,
test_date,
tractor_model,
fuel_consumption_lit_per_hr,
mileage_km_per_ltr,
avg_speed_of_travel_kmph,
--total_dist_travelled_km,
gear_used_on_straight_road,
straight_road_rpm_drop,
gear_used_on_up_slope_1,
up_slope_rpm_drop_1,
gear_used_on_up_slope_2,
up_slope_rpm_drop_2,
gear_used_on_down_slope,
down_slope_rpm_shoot_up,
fuel_consumption_var_lit_per_hr,
mileage_var_km_per_ltr,
fuel_consumption_var_pct_lit_per_hr,
mileage_var_pct_km_per_ltr,
engine_smoke_on_load,
engine_acceleration_smoke,
range_gear_shifting,
speed_gear_shifting,
tractor_steer_ability,
tractor_braking_perf,
front_visibility,
implement_accessibility,
front_end_lifting_during_operation,
rpm_recovery_time,
engine_vibration,
engine_sound,
test_file_ref_no
)
select
client_id,
function_id,
Test_Condition,
Test_Date::date,
Tractor_Model,
Fuel_consumption_Ltr_hr::float fuel_consumption_lit_per_hr ,
Mileage_Km_Ltr ::float mileage_km_per_ltr ,
Average_speed_of_travel_kmph::float avg_speed_of_travel_kmph ,
Total_distance_travelled_km::int end as total_dist_travelled_km ,
Gear_used_on_Straight_Road,
Straight_road_RPM_Drop,
Gear_used_on_Up_Slope_1,
Up_Slope_RPM_Drop_1 ,
Gear_used_on_Up_Slope_2,
Up_Slope_RPM_Drop_2,
Gear_used_on_Down_Slope,
Down_Slope_RPM_Shoot_up,
case when fuel_consumption_lit_hr_2 ~ E'^\\d+$' then fuel_consumption_lit_hr_2::int else null end as fuel_consumption_var_lit_per_hr ,
case when Mileage_Km_Ltr_2 ~ E'^\\d+$' then Mileage_Km_Ltr_2::int else null end as mileage_var_km_per_ltr,
case when fuel_consumption_lit_hr_3 ~ E'^\\d+$' then fuel_consumption_lit_hr_3::int else null end as fuel_consumption_var_pct_lit_per_hr ,
case when Mileage_Km_Ltr_3 ~ E'^\\d+$' then Mileage_Km_Ltr_3::int else null end as mileage_var_pct_km_per_ltr,
engine_smoke_on_load,
Engine_acceleration_smoke,
Range_Gear_Shifting,
Speed_Gear_Shifting,
Tractor_Steer_ability,
Tractor_braking_performance tractor_braking_perf ,
Front_Visibility,
Implement_Accessibility,
Front_end_lifting_during_operation,
RPM_Recovery_Time,
Engine_Vibration,
Engine_Sound,
file_number
from mmt_staging2.fthlg_sum_test_condition_2_block where Gear_used_on_Straight_Road not in ('0','0.000')';
end
$$ LANGUAGE plpgsql;
select mmt_staging2.fn_FTHLG_SUM_ODS();

View File

@@ -0,0 +1,194 @@
drop function if exists mmt_staging2.fn_FTHLG_TRS_ODS ;
CREATE OR REPLACE FUNCTION mmt_staging2.fn_FTHLG_TRS_ODS()
RETURNS void AS $$
begin
execute 'insert into mmt_ods.test_instance
(
client_id,
function_id,
test_report_no,
objective_of_test,
background_of_test,
job_order_no,
test_location_name,
gradient_slope_1_degree,
gradient_slope_2_degree,
tractor_hitch_type,
test_engineer,
test_operator,
date_of_test,
test_report_date,
type_of_road,
tractor_hitch_ht_mm,
tractor_rwheel_c2h_dist_mm,
test_file_ref_no
)
select
client_id,
function_id,
Report_Reference_No test_report_no ,
Objective_Of_Test,
Background_of_Test,
Job_Order_No,
Test_Location test_location_name,
Gradient_Slope_1_Degree::int,
Gradient_Slope_2_Degree::int,
Tractor_Hitch_Type,
Test_Engineer,
Test_Operator,
Date_of_Test::date,
Report_Date::date test_report_date,
Type_of_Road,
Tractor_Hitch_Height_from_Ground_mm::int tractor_hitch_ht_mm ,
Tractor_Rear_Wheel_Center_to_Hitch_Point_Center_Distance_mm::int tractor_rwheel_c2h_dist_mm,
file_syspk
from mmt_staging2.FTHLG_TRS_H1_Block';
execute 'insert into mmt_ods.test_instance_tractor_info
(
client_id,
function_id,
tractor_model,
tractor_make,
tractor_sr_no,
tractor_engine_hp,
fip_type,
hour_meter_reading,
steering_type,
transmission_type,
wheel_drive_type,
egr_yn,
brake_type,
pto_type,
standard_pto_speed_rpm,
epto_speed_rpm,
tractor_weight_front_kg,
tractor_weight_rear_kg,
tractor_weight_total_kg,
ballasted_tractor_accessories,
mechanical_ballast_rear,
water_ballast_rear_75_pct,
mechanical_ballast_front_kg,
mechanical_ballast_front,
total_ballast_weight,
test_file_ref_no
)
select
client_id,
function_id,
Tractor_Model,
Tractor_Make,
Tractor_Sr_No,
Tractor_Engine_HP::int,
FIP_Type,
Hour_Meter_Reading::float,
Steering_Type,
Transmission_Type,
Wheel_Drive_Type_WD,
EGR_Yes_No egr_yn,
Brake_Type,
PTO_Type,
Standard_PTO_Speed_RPM::int,
EPTO_Speed_RPM::int,
Tractor_Weight_kg_Front::int tractor_weight_front_kg,
Tractor_Weight_kg_Rear::int tractor_weight_rear_kg,
Tractor_Weight_kg_Total::int tractor_weight_total_kg,
Ballasted_Tractor_Accessories,
Mechanical_Ballast_Rear,
Water_Ballast_Rear_75 water_ballast_rear_75_pct,
Mechanical_Ballast_Front_in_kg::int mechanical_ballast_front_kg,
Mechanical_Ballast_Front,
Total_Ballast_Weight::int,
file_syspk
from mmt_staging2.fthlg_trs_spec_block';
execute 'insert into mmt_ods.test_instance_engine_info
(
client_id,
function_id,
low_idle_declared,
high_idle_declared,
rated_rpm,
engine_to_pto_ratio_540_pto,
engine_to_pto_ratio_540e_pto,
tractor_model,
tractor_make,
test_file_ref_no
)
select
client_id,
function_id,
low_idle low_idle_declared,
high_idle high_idle_declared,
rated_rpm::int,
engine_to_pto_ratio_540_pto,
engine_to_pto_ratio_540e_pto,
tractor_model,
tractor_make,
file_syspk
from mmt_staging2.fthlg_trs_engine_rpm_block where tractor_model is not null';
execute 'insert into mmt_ods.test_instance_trailer_info
(
client_id,
function_id,
type_of_trailer,
no_of_axle,
no_of_wheels,
trailer_hitch_ht_above_ground_lvl_mm,
make_model_of_trailer,
trailer_platform_length_mm,
trailer_platform_width_mm,
trailer_platform_height_mm,
tire_size,
inflation_pressure_psi,
track_width_of_trailer_mm,
hzntl_dist_of_hitch_pt_from_trailer_face_mm,
tractor_rwc_to_hitch_pt_center_dist_mm,
dist_from_tractor_rwc_to_trailer_rwc_mm,
dist_from_trailer_front_axle_dist_from_hitch_pt_mm,
trailer_empty_weight_kg,
trailer_gross_weight_kg,
test_file_ref_no
)
select
client_id,
function_id,
Type_Of_Trailer,
No_Of_Axle::int,
No_Of_Wheels::int,
Trailer_hitch_Height_above_ground_level_mm::int trailer_hitch_ht_above_ground_lvl_mm,
Make_model_of_trailer,
Trailer_platform_length_mm::int,
Trailer_platform_Width_mm::int,
Trailer_platform_Height_mm::int,
Tire_size,
Inflation_pressure_psi::int,
Track_width_of_trailer_mm::int,
Horizontal_distance_of_hitch_point_from_trailer_front_face_mm::int hzntl_dist_of_hitch_pt_from_trailer_face_mm,
Tractor_Rear_Wheel_Center_to_Hitch_Point_Center_Distance_mm::int tractor_rwc_to_hitch_pt_center_dist_mm,
Distance_from_Trailerfront_axle_distance_from_hitch_point_mm::int dist_from_tractor_rwc_to_trailer_rwc_mm,
Distance_from_tractor_rear_wheel_center_to_tractor_rear_wheel_center_mm::int dist_from_trailer_front_axle_dist_from_hitch_pt_mm,
Trailer_empty_weight_Kg::int,
Trailer_Gross_Weight_Kg::int,
file_syspk
from mmt_staging2.fthlg_trs_trailer_block';
end
$$ LANGUAGE plpgsql;
select mmt_staging2.fn_FTHLG_TRS_ODS();
end
$$ LANGUAGE plpgsql;
select mmt_staging2.fn_FTHLG_TRS_ODS ();

View File

@@ -0,0 +1,185 @@
drop function if exists mmt_staging2.fn_FTWET_SUM_ODS ;
CREATE OR REPLACE FUNCTION mmt_staging2.fn_FTWET_SUM_ODS()
RETURNS void AS $$
begin
execute 'insert into mmt_ods.field_perf_summary_tractor_info
(
client_id,
function_id,
tractor_model,
tractor_make,
tractor_engine_hp,
rated_rpm,
transmission_type,
wheel_drive_type,
fip_type,
steering_type,
tractor_weight_front_kg,
tractor_weight_rear_kg,
tractor_weight_total_kg,
test_file_ref_no
)
select
client_id,
function_id
tractor_model,
tractor_make,
tractor_engine_hp::float,
rated_rpm::int,
transmission_type,
wheel_drive_type,
fip_type,
steering_type,
tractor_weight_kg_front::int,
tractor_weight_kg_rear::int,
tractor_weight_kg_total::int,
file_number,
from mmt_staging2.ftwet_sum_trac_h1_block where tractor_model<> '0'';
execute 'insert into mmt_ods.field_perf_summary_implement_info
(
client_id,
function_id,
make_of_implement,
implement_type,
implement_size,
hitch_category,
implement_weight,
soil_type,
soil_moisture_content_pct,
soil_bulk_density_g_per_cc,
soil_cone_index,
field_condition,
season,
test_file_ref_no,
)
select
client_id,
function_id,
make_of_implement,
implement_type,
implement_size,
hitch_category,
implement_weight::int,
soil_type,
moisture_content::int soil_moisture_content_pct,
bulk_density_g_cc::int soil_bulk_density_g_per_cc,
soil_cone_index::int soil_cone_index,
field_condition,
season,
file_number
from mmt_staging2.ftwet_sum_implement_block';
execute 'insert into mmt_ods.field_perf_summary_implement_info
(
client_id,
function_id,
type_of_cage_wheel,
cage_wheel_width_mm,
cage_wheel_weight,
cage_wheel_inner_and_outer_ring_dia_mm,
cage_wheel_center_ring_dia_mm,
dist_between_rhs_and_lhs_cage_wheel_inner_ring_mm,
no_of_angles_on_cage_wheel,
test_file_ref_no
)
select
client_id,
function_id,
Type_of_Cage_Wheel,
Cage_Wheel_Width_mm::int,
Cage_wheel_Weight::int,
Cage_Wheel_inner_Outer_Ring_Dia_mm::int cage_wheel_inner_and_outer_ring_dia_mm ,
Cage_Wheel_Center_Ring_Dia_mm::int,
Distance_between_RHS_LHS_cage_wheel_Inner_Ring_mm::int dist_between_rhs_and_lhs_cage_wheel_inner_ring_mm ,
No_of_angles_on_cage_wheel::int,
file_number
from mmt_staging2.FTWET_SUM_Cage_Wheel_Block';
execute 'insert into mmt_ods.field_perf_summary
(
Test_Condition,
Test_Date,
Tractor_Model,
Engine_RPM_set,
PTO_RPM_set,
Gear_Used,
Nominal_Speed_KMPH,
Engine_RPM_Drop_on_straight_1st_Pass,
Engine_RPM_Drop_on_straight_2nd_Pass,
Engine_RPM_Drop_on_straight_3rd_Pass,
Engine_RPM_Drop_on_turn_1st_Pass,
Engine_RPM_Drop_on_turn_2nd_Pass,
Engine_RPM_Drop_on_turn_3rd_Pass,
No_of_passes,
depth_of_cut_cm,
fuel_consumption_lit_per_hr,
area_covered_acr_per_hr,
fuel_consumption_lit_per_acr,
fuel_consumption_var_lit_per_hr,
area_covered_var_acr_per_hr,
fuel_consumption_var_lit_per_acr,
Engine_Smoke_on_Load,
Engine_acceleration_smoke,
Draft_Response,
Tractor_Steer_ability,
Tractor_braking_perf,
Front_Visibility,
Implement_Accessibility,
Front_Wheel_dragging_at_turning,
Front_end_lifting_during_operation,
RPM_Recovery_Time,
Engine_Vibration,
Engine_Sound,
implement_lifting_per_lowering_response,
Pulverization_Quality,
Pulverization_Index,
test_file_ref_no
)
select
Test_Condition,
Test_Date::date,
Tractor_Model,
Engine_RPM_set::int,
PTO_RPM_set::int,
Gear_Used,
Nominal_Speed_KMPH::float,
Engine_RPM_Drop_on_straight_1st_Pass,
Engine_RPM_Drop_on_straight_2nd_Pass,
Engine_RPM_Drop_on_straight_3rd_Pass,
Engine_RPM_Drop_on_turn_1st_Pass,
Engine_RPM_Drop_on_turn_2nd_Pass,
Engine_RPM_Drop_on_turn_3rd_Pass,
No_of_passes::int,
Avg_Depth_of_cut_cm depth_of_cut_cm ,
Fuel_consumption_lit_hr::float fuel_consumption_lit_per_hr,
Area_covered_acr_hr::float area_covered_acr_per_hr,
Fuel_consumption_lit_Acr::float fuel_consumption_lit_per_acr,
Fuel_consumption_lit_hr_2::int fuel_consumption_var_lit_per_hr,
Area_covered_acr_hr_2::int area_covered_var_acr_per_hr,
Fuel_consumption_lit_Acr_2::int fuel_consumption_var_lit_per_acr,
Engine_Smoke_on_Load,
Engine_acceleration_smoke,
Draft_Response,
Tractor_Steer_ability,
Tractor_braking_performance tractor_braking_perf,
Front_Visibility,
Implement_Accessibility,
Front_Wheel_dragging_at_turning,
Front_end_lifting_during_operation,
RPM_Recovery_Time,
Engine_Vibration,
Engine_Sound,
Implement_Lifting_Lowering_response implement_lifting_per_lowering_response,
Pulverization_Quality,
Pulverization_Index,
file_number
from mmt_staging2.FTWET_SUM_Test_Condition_Block where engine_rpm_set <> '0'';
end
$$ LANGUAGE plpgsql;
select mmt_staging2.fn_FTWET_SUM_ODS();

View File

@@ -0,0 +1,193 @@
drop function if exists mmt_staging2.fn_FTWET_TRS_ODS ;
CREATE OR REPLACE FUNCTION mmt_staging2.fn_FTWET_TRS_ODS()
RETURNS void AS $$
begin
execute 'insert into mmt_ods.test_instance
(
client_id,
function_id,
test_file_ref_no ,
test_report_no,
objective_of_test,
background_of_test,
job_order_no,
test_location_name,
soil_moisture_content_pct,
soil_bulk_density_g_per_cc,
test_engineer,
test_operator,
date_of_test,
test_report_date,
season,
type_of_soil,
soil_cone_index,
field_condition
)
select client_id,
function_id,
file_number,
report_reference_no test_report_no,
objective_of_test,
background_of_test,
job_order_no,
test_location test_location_name,
soil_moisture_content_::int soil_moisture_content_pct ,
soil_bulk_density_g_cc::int soil_bulk_density_g_per_cc,
test_engineer,
test_operator,
date_of_test::date,
report_date::date test_report_date,
season,
type_of_soil,
soil_cone_index_kpa::int soil_cone_index,
field_condition
from mmt_staging2.ftwet_trs_h1_block';
execute 'insert into mmt_ods.test_instance_tractor_info
(
client_id,
function_id,
tractor_model,
tractor_make,
tractor_sr_no,
tractor_engine_hp,
fip_type,
hour_Meter_Reading,
Steering_Type,
Transmission_Type,
wheel_drive_type,
egr_yn,
Brake_Type,
PTO_Type,
Standard_PTO_Speed_RPM,
EPTO_Speed_RPM,
tractor_weight_front_kg,
tractor_weight_rear_kg,
tractor_weight_total_kg,
Ballasted_Tractor_Accessories,
mechanical_ballast_rear_in_kg,
water_ballast_rear_75_pct ,
Mechanical_Ballast_Front,
mechanical_ballast_front_kg ,
Total_Ballast_Weight,
test_file_ref_no
)
select client_id,
function_id,
Tractor_Model,
Tractor_Make,
Tractor_Sr_No,
Tractor_Engine_HP::float,
FIP_Type,
hour_Meter_Reading::float,
Steering_Type,
Transmission_Type,
Wheel_Drive_Type_WD wheel_drive_type ,
EGR_Yes_No egr_yn,
Brake_Type ,
PTO_Type ,
Standard_PTO_Speed_RPM::int,
EPTO_Speed_RPM::int,
Tractor_Weight_kg_Front::int tractor_weight_front_kg ,
Tractor_Weight_kg_Rear::int tractor_weight_rear_kg ,
Tractor_Weight_kg_Total::int tractor_weight_total_kg ,
Ballasted_Tractor_Accessories,
Mechanical_Ballast_Rear_in_KG::int mechanical_ballast_rear_in_kg ,
Water_Ballast_Rear water_ballast_rear_75_pct ,
Mechanical_Ballast_Front,
Mechanical_Ballast_Front_in_Kg::int mechanical_ballast_front_kg ,
Total_Ballast_Weight::int,
file_number
from mmt_staging2.ftwet_trs_spec_block where tractor_model is not null';
execute 'insert into mmt_ods.test_instance_engine_info
(
client_id,
function_id,
low_idle_declared,
high_idle_declared,
rated_rpm_declared,
engine_to_pto_ratio_540_pto,
engine_to_pto_ratio_540e_pto,
test_file_ref_no,
)
select
client_id,
function_id,
low_idle low_idle_declared,
high_idle high_idle_declared,
rated_rpm::int rated_rpm_declared,
engine_to_pto_ratio_540_pto,
engine_to_pto_ratio_540e_pto,
file_number
from mmt_staging2.ftwet_trs_engine_rpm_block tractor_model is not null ';
execute 'insert into mmt_ods.test_instance_implement_info
(
client_id,
function_id,
name_of_implement,
type_of_implement,
make_of_implement,
no_of_disc_blades_bottoms,
cutting_width_m,
implement_weight_kg,
hitch_category,
span_for_mounted_implement_cm,
mast_height_for_mounted_implement_cm,
type_of_cage_wheel_hcw_fcw,
Cage_Wheel_Width_mm,
cage_wheel_weight_kg,
cage_wheel_inner_ring_dia_mm,
cage_wheel_outer_ring_dia_mm,
cage_wheel_center_ring_dia_mm,
dist_btwn_lhs_fcw_to_rhs_fcw_mm,
No_of_angles_on_cage_wheel,
No_of_days_of_water_logging,
Depth_of_water_mm,
test_file_ref_no
)
select
client_id,function_id,
name_of_implement,
type_of_implement,
make_of_implement,
no_of_bottoms_tyne_disc_blade::int no_of_disc_blades_bottoms,
cutting_width_m,
implement_weight_kg::int,
hitch_category,
span_cm_for_mounted_implement::int span_for_mounted_implement_cm ,
mast_height_cm_for_mounted_implement::int mast_height_for_mounted_implement_cm,
Type_of_Cage_Wheel_Half_Cage_wheel_Full_Cage_Wheel type_of_cage_wheel_hcw_fcw ,
Cage_Wheel_Width_mm::int,
Cage_wheel_Weight::int cage_wheel_weight_kg,
Cage_Wheel_inner_Outer_Ring_Dia_mm::int cage_wheel_inner_ring_dia_mm ,
Cage_Wheel_inner_Outer_Ring_Dia_mm::int cage_wheel_outer_ring_dia_mm,
Cage_Wheel_Center_Ring_Dia_mm::int cage_wheel_center_ring_dia_mm ,
Distance_between_RHS_LHS_cage_wheel_Inner_Ring_mm_For_Full_Cage_wheel::int dist_btwn_lhs_fcw_to_rhs_fcw_mm,
No_of_angles_on_cage_wheel::int,
No_of_days_of_water_logging::int,
Depth_of_water_mm::int,
file_number
from mmt_staging2.ftwet_trs_implement_block where name_of_implement is not null';
end
$$ LANGUAGE plpgsql;
select mmt_staging2.fn_FTWET_TRS_ODS();
end
$$ LANGUAGE plpgsql;

View File

@@ -0,0 +1,178 @@
drop function if exists mmt_staging2.fn_FTDRY_TRS_ODS ;
CREATE OR REPLACE FUNCTION mmt_staging2.fn_FTDRY_TRS_ODS()
RETURNS void AS $$
begin
execute 'insert into mmt_ods.test_instance
(
client_id,
function_id,
test_file_ref_no ,
test_report_no,
objective_of_test,
background_of_test,
job_order_no,
test_location_name,
soil_moisture_content_pct,
soil_bulk_density_g_per_cc,
test_engineer,
test_operator,
date_of_test,
test_report_date,
season,
type_of_soil,
soil_cone_index,
field_condition
)
select
client_id,function_id,
file_number,
report_reference_no test_report_no,
objective_of_test,
background_of_test,
job_order_no,
test_location test_location_name,
soil_moisture_content_::int soil_moisture_content_pct ,
soil_bulk_density_g_cc::int soil_bulk_density_g_per_cc,
test_engineer,
test_operator,
date_of_test::date,
report_date::date test_report_date,
season,
type_of_soil,
soil_cone_index_kpa::int soil_cone_index,
field_condition
from mmt_staging2.ftdry_trs_h1_block';
exceute 'insert into mmt_ods.test_instance_tractor_info
(
client_id,
function_id,
tractor_model,
tractor_make,
tractor_sr_no,
tractor_engine_hp,
fip_type,
hour_Meter_Reading,
Steering_Type,
Transmission_Type,
wheel_drive_type,
egr_yn,
Brake_Type,
PTO_Type,
Standard_PTO_Speed_RPM,
EPTO_Speed_RPM,
tractor_weight_front_kg,
tractor_weight_rear_kg,
tractor_weight_total_kg,
Ballasted_Tractor_Accessories,
Mechanical_Ballast_Rear,
mechanical_ballast_rear_in_kg,
water_ballast_rear_75_pct ,
Mechanical_Ballast_Front,
mechanical_ballast_front_kg ,
Total_Ballast_Weight,
test_file_ref_no
)
select
client_id,
function_id,
Tractor_Model,
Tractor_Make,
Tractor_Sr_No,
Tractor_Engine_HP::float,
FIP_Type,
hour_Meter_Reading::int,
Steering_Type,
Transmission_Type,
Wheel_Drive_Type_WD wheel_drive_type ,
EGR_Yes_No egr_yn,
Brake_Type ,
PTO_Type ,
Standard_PTO_Speed_RPM::int,
EPTO_Speed_RPM::int,
Tractor_Weight_kg_Front::int tractor_weight_front_kg ,
Tractor_Weight_kg_Rear::int tractor_weight_rear_kg ,
Tractor_Weight_kg_Total::int tractor_weight_total_kg ,
Ballasted_Tractor_Accessories,
Mechanical_Ballast_Rear,
Mechanical_Ballast_Rear_in_KG::int mechanical_ballast_rear_in_kg ,
Water_Ballast_Rear water_ballast_rear_75_pct ,
Mechanical_Ballast_Front,
Mechanical_Ballast_Front_in_Kg::int mechanical_ballast_front_kg ,
Total_Ballast_Weight::int,
file_number
from mmt_staging2.ftdry_trs_spec_block'
execute 'insert into mmt_ods.test_instance_engine_info
(
client_id,
function_id,
low_idle_observed ,
high_idle_observed ,
rated_rpm_observed ,
engine_to_pto_ratio_540_pto,
engine_to_pto_ratio_540e_pto,
tractor_model,
tractor_make,
test_file_ref_no
)
select
client_id,
function_id,
low_idle::int low_idle_observed ,
high_idle::int high_idle_observed ,
rated_rpm::int rated_rpm_observed
,engine_to_pto_ratio_540_pto,
engine_to_pto_ratio_540e_pto,
file_number
from mmt_staging2.ftdry_trs_engine_rpm_block
where tractor_model is not null'
execute 'insert into mmt_ods.test_instance_implement_info
(
client_id,
function_id,
name_of_implement,
type_of_implement,
make_of_implement,
no_of_disc_blades_bottoms,
cutting_width_m,
implement_weight_kg,
hitch_category,
span_for_mounted_implement_cm,
mast_height_for_mounted_implement_cm,
test_file_ref_no
)
select
client_id,
function_id,
name_of_implement,
type_of_implement,
make_of_implement,
no_of_bottoms_tyne_disc_blade::int no_of_disc_blades_bottoms,
cutting_width_m,
implement_weight_kg::int,
hitch_category,
span_cm_for_mounted_implement::int span_for_mounted_implement_cm ,
mast_height_cm_for_mounted_implement::int mast_height_for_mounted_implement_cm,
file_number
from mmt_staging2.ftdry_trs_implement_block;
end
$$ LANGUAGE plpgsql;
select mmt_staging2.fn_FTDRY_TRS_ODS();
from mmt_staging2.ftdry_trs_implement_block where name_of_implement is not null;
end
$$ LANGUAGE plpgsql;