Commit 5f9f874b authored by Bernard PRADINES's avatar Bernard PRADINES
Browse files

Total ajoute

parent 89841d3e
......@@ -967,13 +967,14 @@ Examples :
(case when pointcall_year = '1787' then nb_conges_1787_cr else nb_conges_1789_cr end) as nb_conges_cr,
(case when pointcall_year = '1787' then nb_sante_1787 else nb_sante_1789 end) as nb_conges_sante,
(case when pointcall_year = '1787' then nb_petitcabotage_1787 else nb_petitcabotage_1789 end) as nb_petitcabotage,
total,
nb_tonnage_filled, nb_homeport_filled, nb_product_filled, nb_birthplace_filled, nb_citizenship_filled, nb_flag_filled, good_sum_tonnage
"""
fields_for_select=handleParams(fields_for_select) # ne garde que les champs demandés dans 'params'
print(fields_for_select)
#print(fields_for_select)
union_G5_1787_CRonly=f"""
ogc_fid, uhgs_id, {localizedDatabaseFieldNames} status, has_a_clerk, geonameid, amiraute as admiralty, province, shiparea , ST_AsGeoJSON(ST_Transform(geom,{srid})) as point, 'G5' as source_suite, 1787 as pointcall_year, nb_conges_1787_inputdone as nb_conges_inputdone, nb_conges_1787_cr as nb_conges_cr, nb_sante_1787 as nb_conges_sante, nb_petitcabotage_1787 as nb_petitcabotage, null as nb_tonnage_filled, null as nb_homeport_filled, null as nb_product_filled, null as nb_birthplace_filled, null as nb_citizenship_filled, null as nb_flag_filled, null as good_sum_tonnage
ogc_fid, uhgs_id, {localizedDatabaseFieldNames} status, has_a_clerk, geonameid, amiraute as admiralty, province, shiparea , ST_AsGeoJSON(ST_Transform(geom,{srid})) as point, 'G5' as source_suite, 1787 as pointcall_year, nb_conges_1787_inputdone as nb_conges_inputdone, nb_conges_1787_cr as nb_conges_cr, nb_sante_1787 as nb_conges_sante, nb_petitcabotage_1787 as nb_petitcabotage, null as total, null as nb_tonnage_filled, null as nb_homeport_filled, null as nb_product_filled, null as nb_birthplace_filled, null as nb_citizenship_filled, null as nb_flag_filled, null as good_sum_tonnage
"""
union_G5_1787_CRonly=handleParams(union_G5_1787_CRonly) # ne garde que les champs demandés dans 'params'
......@@ -982,7 +983,7 @@ Examples :
#print('########### union_missing ###############'+union_missing)
union_G5_1789_CRonly=f"""
ogc_fid, uhgs_id, {localizedDatabaseFieldNames} status, has_a_clerk, geonameid, amiraute as admiralty, province, shiparea , ST_AsGeoJSON(ST_Transform(geom,{srid})) as point, 'G5' as source_suite, 1789 as pointcall_year, nb_conges_1789_inputdone as nb_conges_inputdone, nb_conges_1789_cr as nb_conges_cr, nb_sante_1789 as nb_conges_sante, nb_petitcabotage_1789 as nb_petitcabotage, null as nb_tonnage_filled, null as nb_homeport_filled, null as nb_product_filled, null as nb_birthplace_filled, null as nb_citizenship_filled, null as nb_flag_filled, null as good_sum_tonnage
ogc_fid, uhgs_id, {localizedDatabaseFieldNames} status, has_a_clerk, geonameid, amiraute as admiralty, province, shiparea , ST_AsGeoJSON(ST_Transform(geom,{srid})) as point, 'G5' as source_suite, 1789 as pointcall_year, nb_conges_1789_inputdone as nb_conges_inputdone, nb_conges_1789_cr as nb_conges_cr, nb_sante_1789 as nb_conges_sante, nb_petitcabotage_1789 as nb_petitcabotage, null as total, null as nb_tonnage_filled, null as nb_homeport_filled, null as nb_product_filled, null as nb_birthplace_filled, null as nb_citizenship_filled, null as nb_flag_filled, null as good_sum_tonnage
"""
union_G5_1789_CRonly=handleParams(union_G5_1789_CRonly) # ne garde que les champs demandés dans 'params'
......@@ -996,6 +997,7 @@ Examples :
from ports.port_points pp ,
(
select pointcall_uhgs_id, source_suite, pointcall_year,
count(pkid) as total,
count(tonnage) as nb_tonnage_filled,
count(homeport) as nb_homeport_filled,
count(commodity_purpose) as nb_product_filled,
......@@ -1004,13 +1006,13 @@ Examples :
count(flag) as nb_flag_filled,
sum(tonnage_numeric) as good_sum_tonnage
from (
select pointcall_uhgs_id, source_suite,
select pointcall_uhgs_id, source_suite, pkid,
(coalesce(extract(year from TO_DATE(substring(pointcall_out_date2 for 4),'YYYY')), extract(year from TO_DATE(substring(pointcall_in_date2 for 4),'YYYY'))))::int4 as pointcall_year,
nb_conges_1787_inputdone, nb_conges_1787_cr, nb_conges_1789_inputdone, nb_conges_1789_cr,
tonnage, homeport, commodity_purpose, birthplace, citizenship, flag,
(case when tonnage_unit = 'quintaux' then (tonnage::float)/24 else tonnage::float end) as tonnage_numeric
from navigoviz.pointcall p
{filterDate} and state_1789_fr = 'France' and pointcall_function = 'O'
{filterDate} and state_1789_fr = 'France' and pointcall_function = 'O' and data_block_leader_marker = 'A'
) as k
group by pointcall_uhgs_id , source_suite, pointcall_year
) as toto
......@@ -1038,7 +1040,16 @@ Examples :
'nb_conges_cr' : 'Int64',
'nb_conges_sante' : 'Int64',
'nb_petitcabotage' : 'Int64',
'total' : 'Int64',
'pointcall_year' : 'Int64',
'geonameid' : 'Int64',
'nb_tonnage_filled' : 'Int64',
'nb_homeport_filled' : 'Int64',
'nb_product_filled' : 'Int64',
'nb_birthplace_filled' : 'Int64',
'nb_citizenship_filled' : 'Int64',
'nb_flag_filled' : 'Int64',
}
# keep only fields present in the 'select' clause :
cast_df_columns_to_types=keepDfCastsFoundInSelect(cast_df_columns_to_types, fields_for_select)
......
......@@ -43,4 +43,4 @@ nav:
- 'Manuel utilisateur': 'usermanual.md'
- 'Licence': 'agpl-3.0.md'
- 'Code source': 'https://gitlab.huma-num.fr/portic/porticapi'
- 'Demontrateur': http://apidemo.portic.fr/
\ No newline at end of file
- 'Démonstrateur': http://apidemo.portic.fr/
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment