Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 22 additions & 23 deletions backend/configs/all4trees_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,33 +49,33 @@
"columns": {
"id": "_id",
"geom": "gps.merge().centroid()",
"for": "int(loc2)",
"cod": "cod",
"isPublic": "int(conf)",
"code": "cod",
"type": "typ",
"cohort": "coh",
"loc1": "int(loc1)",
"loc2": "int(loc2)",
"ecos": "int(ecos)",
"plot_size": "20^2*pi()/10000",
"project": "proj",
"tree_pop": "count(1 if adu.cond = 1)",
"biomass_volume": "adu.sum(0.0673 * (for_sp.dens * (meas1 + meas2 + meas3 + meas4 + meas5 + meas6 + meas7 + meas8 + meas9 + meas10)^2 * hgt_perp)^0.976 if cond = 1) / (20^2 * pi() / 10000) / 1000",
"tree_density": "count(1 if adu.cond = 1) / (20^2 * pi() / 10000)",
"richness": "count(unique(adu.adu_sp))",
"tree_pop": "count(1 if adu.cond = 1 and adu.adu_sp != '0')",
"biomass_volume": "adu.sum(0.0673 * (for_sp.dens * (meas1 + meas2 + meas3 + meas4 + meas5 + meas6 + meas7 + meas8 + meas9 + meas10)^2 * hgt_perp)^0.976 if cond = 1) / double(for_samp.adu_samp) / for_samp.adu_tot_max",
"tree_density": "count(1 if adu.cond = 1 and adu.adu_sp != '0') / double(for_samp.adu_samp)",
"richness": "count(unique(adu.adu_sp if adu.adu_sp != '0'))",
"relative_abundance": "histogram(adu.adu_sp)",
"deadwoord": "adu.count(1 if cond=2 or cond=3)",
"bio_idx_tree_density": "count(1 if adu.cond = 1) / (20^2 * pi() / 10000) / 100",
"bio_idx_deadWood": "((adu.sum(0.0673 * (for_dw.dens * (meas1 + meas2 + meas3 + meas4 + meas5 + meas6 + meas7 + meas8 + meas9 + meas10)^2 * hgt_perp)^0.976 if cond = 2) + adu.sum(pi() / 3 * ((meas_b / 2)^2 + ((meas_e / 2)^2 + meas_b / 2 + meas_e / 2) * lght * for_dw.dens) if cond = 3)) / adu.sum(0.0673 * (for_sp.dens * (meas1 + meas2 + meas3 + meas4 + meas5 + meas6 + meas7 + meas8 + meas9 + meas10)^2 * hgt_perp)^0.976 if cond = 1)) / 30 * 10",
"bio_idx_tree_diversity": "shannon(adu.adu_sp) / 5 * 10",
"test_gini": "adu.gini(int(area) if cond = 1) * 10",
"bio_idx_spatial_distribution": "gini_arr(list_concat(list(adu.count(1 if cond=1 and area=1)), list(adu.count(1 if cond=1 and area=2)), list(adu.count(1 if cond=1 and area=3)), list(adu.count(1 if cond=1 and area=4)))) * 10",
"bio_idx_tree_density": "count(1 if adu.cond = 1 and adu.adu_sp != '0') / (double(for_samp.adu_samp) * 100)",
"bio_idx_deadWood": "((adu.sum(0.0673 * (for_dw.dens * (meas1 + meas2 + meas3 + meas4 + meas5 + meas6 + meas7 + meas8 + meas9 + meas10)^2 * hgt_perp)^0.976 if cond = 2 and adu_sp != '0') + adu.sum(pi() / 3 * ((meas_b / 2)^2 + ((meas_e / 2)^2 + meas_b / 2 + meas_e / 2) * lght * for_dw.dens) if cond = 3 and adu_sp != '0')) / adu.sum(0.0673 * (for_sp.dens * (meas1 + meas2 + meas3 + meas4 + meas5 + meas6 + meas7 + meas8 + meas9 + meas10)^2 * hgt_perp)^0.976 if cond = 1 and adu_sp != '0')) / for_samp.tnc_agb_max * 10",
"bio_idx_tree_diversity": "shannon(adu.adu_sp if adu.adu_sp != '0') / for_samp.shan_max * 10",
"bio_idx_spatial_distribution": "gini_arr(list_concat(list(adu.count(1 if cond=1 and area=1 and adu_sp != '0')), list(adu.count(1 if cond=1 and area=2 and adu_sp != '0')), list(adu.count(1 if cond=1 and area=3 and adu_sp != '0')), list(adu.count(1 if cond=1 and area=4 and adu_sp != '0')))) * 10",
"bio_idx_diametric_distribution": "adu.gini(meas1 + meas2 + meas3 + meas4 + meas5 + meas6 + meas7 + meas8 + meas9 + meas10) * 10",
"bio_idx_vertical_distribution": "gini(adu.hgt_perp) * 10",
"bio_idx_dominant_height": "adu.avg(hgt_perp if hgt_perp >= percentile(hgt_perp, 80)) * 10 / 40",
"bio_idx_vertical_distribution": "gini(adu.hgt_perp if adu.adu_sp != '0') * 10",
"bio_idx_dominant_height": "avg(adu.hgt_perp if adu.hgt_perp >= int(percentile(adu.hgt_perp, 80)) and adu.adu_sp != '0') * 10 / for_samp.hgt_dom_max",
"bio_idx_microhabitats": "adu.list(trem).flatten().filter( x -> x != 'None').list_unique() * 10 / trem_group_max",
"soil_structure_idx": "(thk1*float(not1) + thk2*float(not2) + thk3*float(not3) + thk4*float(not4) + thk5*float(not5)) / (thk1 + thk2 + thk3 + thk4 + thk5)",
"soil_eros_rainfall_and_wind": "for_weath.concat_ws('-', rain, wind)",
"soil_eros_rainfall": "for_weath.rain",
"soil_eros_wind": "for_weath.wind",
"soil_eros_slope": "int(10 - slop if slop < 10 else 0)",
"soil_eros_cover": "veg",
"soil_eros_stability": "((int(slak1) + int(slak2) + int(slak3) ) / 3 if slak1 != '' )",
"soil_eros_water_infiltration": "600 * 300 / ( (epoch(interval(beer1)) + ( epoch(interval(beer2)) if beer2!='' ) + ( epoch(interval(beer3)) if beer3!='' ) + ( epoch(interval(beer4)) if beer4!='' ) + ( epoch(interval(beer5)) if beer5!='' ) + ( epoch(interval(beer6)) if beer6!='' ) + ( epoch(interval(beer7)) if beer7!='' ) + ( epoch(interval(beer8)) if beer8!='' ) + ( epoch(interval(beer9)) if beer9!='' ) + ( epoch(interval(beer10)) if beer10!='' ) ) / non_null_count(beer1, beer2, beer3, beer4, beer5, beer6, beer7, beer8, beer9, beer10) * pi() * 9^2) if beer1 != ''",
"soil_eros_water_infiltration": "600 * for_samp.beer_vol / ( (epoch(interval(beer1)) + ( epoch(interval(beer2)) if beer2!='' ) + ( epoch(interval(beer3)) if beer3!='' ) + ( epoch(interval(beer4)) if beer4!='' ) + ( epoch(interval(beer5)) if beer5!='' ) + ( epoch(interval(beer6)) if beer6!='' ) + ( epoch(interval(beer7)) if beer7!='' ) + ( epoch(interval(beer8)) if beer8!='' ) + ( epoch(interval(beer9)) if beer9!='' ) + ( epoch(interval(beer10)) if beer10!='' ) ) / non_null_count(beer1, beer2, beer3, beer4, beer5, beer6, beer7, beer8, beer9, beer10) * pi() * for_samp.beer_r^2) if beer1 != ''",
"soil_fauna_density": "sum(tsbf_001.tsbf_no) / tsbf_samp",
"soil_fauna_diversity": "count(tsbf_001.tsbf_tax1)",
"soil_fauna_abundance": "list_aggregate(list(nullif(tsbf_001.concat_ws('-', tsbf_tax1, tsbf_tax2, tsbf_tax3), '')), 'histogram')",
Expand Down Expand Up @@ -106,11 +106,10 @@
"columns": {
"geom": "start_point.merge().centroid()",
"id": "_id",
"conf": "conf",
"proj": "proj",
"ecos": "ecos",
"region": "loc1",
"forest": "loc2",
"project": "proj",
"ecos": "int(ecos)",
"loc1": "int(loc1)",
"loc2": "int(loc2)",
"start_date": "coh",
"taxon": "tax",
"type": "meth",
Expand Down
6 changes: 3 additions & 3 deletions webapp/src/features/indicators/bio-inventory/format-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const useFormatBioInventoryData = (
area: `${safeData.samp_area} ${
findLabel(
metadata,
data.proj,
data.project,
lang,
"unit",
Number(safeData.samp_unit),
Expand All @@ -57,12 +57,12 @@ export const useFormatBioInventoryData = (
relative_abundance: taxons_relative_abundance,
richness: formatWithUnit(safeData.richness, UNITS.speciesInventoried),
taxon:
findLabel(metadata, data.proj, lang, "tax", Number(safeData.taxon)) ||
findLabel(metadata, data.project, lang, "tax", Number(safeData.taxon)) ||
t("dataManagement.noUnit") ||
safeData.taxon,
total_population: safeData.taxons_total_pop,
type:
findLabel(metadata, data.proj, lang, "meth", Number(safeData.type)) ||
findLabel(metadata, data.project, lang, "meth", Number(safeData.type)) ||
safeData.type,
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ export const useBioInventoryIndicatorElements = (
<ChartTaxonAbundance
data={data.relative_abundance}
metadata={externalData.bio_label}
project={rawData.proj}
project={rawData.project}
/>
<ChartSpeciesStatus
data={data.relative_abundance}
metadata={externalData.bio_sp}
project={rawData.proj}
project={rawData.project}
/>
</>
),
Expand Down
7 changes: 4 additions & 3 deletions webapp/src/features/indicators/soil/format-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export const useFormatSoilData = (data: ForestInventoryData) => {
soil_fauna_density,
soil_surface_fauna_diversity,
soil_surface_fauna_density,
soil_eros_rainfall_and_wind,
soil_eros_rainfall,
soil_eros_wind,
soil_eros_stability,
soil_eros_water_infiltration,
...safeData
Expand Down Expand Up @@ -74,13 +75,13 @@ export const useFormatSoilData = (data: ForestInventoryData) => {

return {
...safeData,
soil_eros_rainfall: Number(soil_eros_rainfall_and_wind.split("-")[0]),
soil_eros_rainfall: soil_eros_rainfall,
soil_eros_stability: soil_eros_stability,
soil_eros_water_infiltration:
String(soil_eros_water_infiltration) === t("dataManagement.noData")
? soil_eros_water_infiltration
: computeScore(soil_eros_water_infiltration),
soil_eros_wind: Number(soil_eros_rainfall_and_wind.split("-")[1]),
soil_eros_wind: soil_eros_wind,
soil_fauna_abundance: safeData.soil_fauna_abundance,
soil_fauna_density: formatWithUnit(
soil_fauna_density,
Expand Down
3 changes: 2 additions & 1 deletion webapp/src/features/indicators/soil/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

export type SoilData = {
soil_structure_idx: number;
soil_eros_rainfall_and_wind: string;
soil_eros_rainfall: number;
soil_eros_wind: number;
soil_eros_cover: number;
soil_eros_slope: number;
soil_eros_stability: number;
Expand Down
12 changes: 9 additions & 3 deletions webapp/src/features/popup/bio-inventory/popup-bio-inventory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,27 @@ export const BioInventoryPopupContent: FC<BioInventoryPopupContentProps> = ({
ns: "all4trees",
});

const ecos = `${t("all4trees:popup.common.ecos")}: ${
findLabel(externalData.bio_label, data.project, lang, "ecos", data.ecos) ||
t("dataManagement.undefined", { ns: "common" })
}`;

return (
<div className={cx("flex flex-col", className ?? "")}>
<IndicatorPopupHeader
date={t("popup.bioInventory.date", {
date={t("popup.common.date", {
date: formatDate(new Date()),
ns: "all4trees",
})}
ecos={ecos}
icon={<Leaf size={ICON_SIZE_HEADER} />}
subtitle={
findLabel(
externalData.bio_label,
data.proj,
data.project,
lang,
"loc2",
Number(data.forest),
Number(data.loc2),
) || t("dataManagement.undefined", { ns: "common" })
}
title={title}
Expand Down
10 changes: 5 additions & 5 deletions webapp/src/features/popup/bio-inventory/types.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export type BioInventoryData = {
id: number;
conf: boolean;
proj: string;
loc1: number;
loc2: number;
type: number;
cohort: number;
project: string;
ecos: number;
region: number;
forest: number;
start_date: Date;
taxon: string;
type: number;
samp_area: number;
samp_unit: number;
density: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,23 @@ export const ForestInventoryPopupContent: FC<
};

const title = t("popup.forestInventory.title", {
id: data.cod,
id: data.code,
ns: "all4trees",
});

const subtitle =
findLabel(labelData, data.project, lang, "loc2", data.for) ||
findLabel(labelData, data.project, lang, "loc2", data.loc2) ||
t("common:dataManagement.undefined");

const ecos = `${t("all4trees:popup.forestInventory.ecos")}: ${
const ecos = `${t("all4trees:popup.common.ecos")}: ${
findLabel(labelData, data.project, lang, "ecos", data.ecos) ||
t("dataManagement.undefined", { ns: "common" })
}`;

return (
<div className={cx("flex flex-col", className ?? "")}>
<IndicatorPopupHeader
date={t("popup.forestInventory.date", {
date={t("popup.common.date", {
date: formatDate(new Date()),
ns: "all4trees",
})}
Expand Down
7 changes: 5 additions & 2 deletions webapp/src/features/popup/forest-inventory/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ import type { SoilData } from "@features/indicators/soil/types";

export type ForestInventoryData = {
id: string;
for: number;
cod: number;
code: number;
type: number;
cohort: number;
loc1: number;
loc2: number;
project: string;
isPublic: boolean;
ecos: number;
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/features/popup/socio-eco/popup-socio-eco.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const SocioEcoIndicator: FC<SocioEcoIndicatorProps> = ({
return (
<div className={cx("flex flex-col", className ?? "")}>
<IndicatorPopupHeader
date={t("popup.socioEco.date", { date: formatDate(new Date()) })}
date={t("popup.common.date", { date: formatDate(new Date()) })}
icon={<UsersIcon size={ICON_SIZE_HEADER} />}
subtitle={t("popup.socioEco.subtitleCount", {
count: data.household_nb,
Expand Down
14 changes: 7 additions & 7 deletions webapp/src/shared/i18n/translations/en/all4trees.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@
},
"bioinventory": {
"sampArea": "Sampling area",
"status_abundance": "Relative abundance by extinction threat",
"status_abundance": "Relative abundance by UICN status",
"taxon": "Target taxon",
"title": "Fauna inventory",
"title": "Biodiversity inventory",
"type": "Measures type"
},
"common": {
Expand Down Expand Up @@ -224,16 +224,16 @@
},
"popup": {
"bioInventory": {
"date": "Survey date: {{ date }}",
"title": "Plot n°{{ id }}"
"title": "Site n°{{ id }}"
},
"forestInventory": {
"common": {
"date": "Site survey date : {{ date }}",
"ecos": "Ecosystem",
"ecos": "Ecosystem"
},
"forestInventory": {
"title": "Plot n°{{ id }}"
},
"socioEco": {
"date": "Survey date: {{ date }}",
"subtitleCount": "",
"subtitleCount_one": "{{ count }} household surveyed",
"subtitleCount_other": "{{ count }} households surveyed",
Expand Down
12 changes: 6 additions & 6 deletions webapp/src/shared/i18n/translations/fr/all4trees.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
},
"bioinventory": {
"sampArea": "Effort d'échantillonnage",
"status_abundance": "Abondance relative par menace d'extinction",
"status_abundance": "Abondance relative par statut UICN",
"taxon": "Taxon cible",
"title": "Inventaire de faune",
"title": "Inventaire biologique",
"type": "Type de dispositif"
},
"common": {
Expand Down Expand Up @@ -227,16 +227,16 @@
},
"popup": {
"bioInventory": {
"title": "Site n°{{ id }}"
},
"common": {
"date": "Date relevé: {{ date }}",
"title": "Placette n°{{ id }}"
"ecos": "Ecosystème"
},
"forestInventory": {
"date": "Date relevé: {{ date }}",
"ecos": "Ecosystème",
"title": "Placette n°{{ id }}"
},
"socioEco": {
"date": "Date relevé: {{ date }}",
"subtitleCount": "",
"subtitleCount_one": "{{ count }} ménage enquêté",
"subtitleCount_other": "{{ count }} ménages enquêtés",
Expand Down
Loading