Skip to content

Commit

Permalink
set observations checks on modal #1105
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoLechemia committed Aug 2, 2021
1 parent 791e341 commit 375238a
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 31 deletions.
8 changes: 8 additions & 0 deletions frontend/src/app/GN2CommonModule/form/data-form.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -633,5 +633,13 @@ export class DataFormService {
${idNomenclatureLifeStage}`
)
}

/* A partir d'un id synthese, retourne si l'observation match avec les différents
critère d'un profil
*/
getProfileConsistancyData(idSynthese) {
return this._http.get<any>(`${AppConfig.API_ENDPOINT}/gn_profiles/consistancy_data/${idSynthese}`)

}
}

Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class GeojsonComponent implements OnInit, OnChanges {
/** Observable pour retourner les données geojson passées au composant */
public currentGeoJson$: Observable<L.GeoJSON> = this.geojsonCharged.asObservable();

constructor(public mapservice: MapService) {}
constructor(public mapservice: MapService) { }

ngOnInit() {
this.map = this.mapservice.map;
Expand All @@ -52,12 +52,12 @@ export class GeojsonComponent implements OnInit, OnChanges {
return;
}

let bounds = curLayerGroup.getBounds();
const bounds = curLayerGroup.getBounds();
if (!Object.keys(bounds).length) {
return;
}

map.fitBounds(curLayerGroup.getBounds());
map.fitBounds(bounds);
}, 200);
}

Expand All @@ -72,7 +72,9 @@ export class GeojsonComponent implements OnInit, OnChanges {
this.mapservice.layerGroup = new L.FeatureGroup();
this.mapservice.map.addLayer(this.mapservice.layerGroup);
this.mapservice.layerGroup.addLayer(this.currentGeojson);

if (zoom) {

this.zoom(this.mapservice.layerGroup);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,6 @@ <h5>Information sur l'observation</h5>
</div>
<mat-card>

<!-- <chart
#myChart
[type]="chartType"
[data]="charData"
[options]="options"
></chart> -->
{{results|json}}
<canvas
baseChart
width="200"
height="200"
[datasets]="results"
[labels]="lineChartLabels"
[colors]="lineChartColors"
[legend]="lineChartLegend"
[chartType]="lineChartType"
></canvas>

<span *ngIf="selectedObsTaxonDetail?.nom_vern">
{{ selectedObsTaxonDetail?.nom_vern }} -
Expand Down Expand Up @@ -435,7 +418,92 @@ <h5 class="underlined underlined-sm main-color"> Médias
</tbody>
</table>

<h3> Profil </h3>
<div class="row row-sm">
<div
*ngIf="APP_CONFIG.FRONTEND.DISPLAY_PROFILES"
class="col-5 padding-sm"
>
<h3> Profil du taxon</h3>

<table class="font-xs table table-striped table-sm">
<tr>
<td> Altitude minimale valide </td>
<td> {{profile?.properties?.altitude_min}} </td>
</tr>
<tr>
<td> Altitude maximale valide </td>
<td> {{profile?.properties?.altitude_max}}</td>
</tr>

<tr>
<td> Première observation valide </td>
<td> {{profile?.properties?.first_valid_data | date:'dd/MM/yyyy'}} </td>
</tr>
<tr>
<td> Dernière observation valide </td>
<td>{{profile?.properties?.last_valid_data | date:'dd/MM/yyyy'}}</td>
</tr>
</table>
<!-- <canvas
baseChart
width="200"
height="200"
[datasets]="results"
[labels]="lineChartLabels"
[colors]="lineChartColors"
[legend]="lineChartLegend"
[chartType]="lineChartType"
></canvas> -->
<h3> Cohérence de la donnée </h3>

<table class="table table-sm font-xs table-striped">
<tr>
<td>Dans l'aire d'observation valide </td>
<td *ngIf='profileDataChecks?.valid_distribution'>
<mat-icon class="success"> check </mat-icon>
</td>
<td *ngIf='!profileDataChecks?.valid_distribution'>
<mat-icon class="error"> close </mat-icon>
</td>
</tr>
<tr>
<td>Cohérence phénologique </td>
<td *ngIf='profileDataChecks?.valid_phenology'>
<mat-icon class="success"> check </mat-icon>
</td>
<td *ngIf='!profileDataChecks?.valid_phenology'>
<mat-icon class="error"> close </mat-icon>
</td>
</tr>
<tr>
<td> Dans la fourchette altitudinale valide</td>
<td *ngIf='profileDataChecks?.valid_altitude'>
<mat-icon class="success"> check </mat-icon>
</td>
<td *ngIf='!profileDataChecks?.valid_altitude'>
<mat-icon class="error"> close </mat-icon>
</td>
</tr>
<tr>
<td> Score</td>
<td> {{profileDataChecks?.score}} </td>
</tr>
</table>
</div>
<div class="col-7 padding-sm">
<h5>Aire de répartition des observations valides</h5>
<pnx-map height="40vh">
<pnx-geojson
[geojson]="selectedGeom"
[style]="{color: 'red'}"
></pnx-geojson>
<pnx-geojson
[geojson]="profile"
[zoomOnFirstTime]="true"
></pnx-geojson>
</pnx-map>
</div>
</div>

<h5>Aire de répartition des observations valides</h5>
<pnx-map height="40vh">
Expand All @@ -456,15 +524,6 @@ <h5>Aire de répartition des observations valides</h5>
</tr>
</table>

<h5>Aire de répartition des observations valides</h5>
<pnx-map height="40vh">
<pnx-geojson
[geojson]="selectedGeom"
[style]="{color: 'red'}"
></pnx-geojson>
<pnx-geojson [geojson]="profile"></pnx-geojson>
</pnx-map>
{{phenology|json}}

</mat-tab>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { MediaService } from '@geonature_common/service/media.service';
import { finalize } from 'rxjs/operators';
import { Color, BaseChartDirective } from "ng2-charts";
import { ChartDataSets, ChartOptions, ChartType } from 'chart.js';
import { AppConfig } from "@geonature_config/app.config"



Expand All @@ -31,8 +32,10 @@ export class SyntheseInfoObsComponent implements OnInit, AfterViewInit {
public validationHistory: Array<any>;
public selectedObsTaxonDetail: any;
@ViewChild(BaseChartDirective) myChart: BaseChartDirective;
public APP_CONFIG = AppConfig;
public selectedGeom;
public chartType = 'line';
public profileDataChecks: any;


public results: ChartDataSets[] = [
Expand Down Expand Up @@ -218,7 +221,7 @@ export class SyntheseInfoObsComponent implements OnInit, AfterViewInit {
this.results[3].data.push(this.phenology[i].calculated_altitude_max)
this.lineChartLabels.push(this.phenology[i].period)
}
this.myChart.chart.update();
//this.myChart.chart.update();
// [
// { data: [65, 59, 80, 81, 56, 55, 40], label: 'Series A' },
// { data: [28, 48, 40, 19, 86, 27, 90], label: 'Series B' },
Expand All @@ -227,6 +230,10 @@ export class SyntheseInfoObsComponent implements OnInit, AfterViewInit {
});
});
});

this._gnDataService.getProfileConsistancyData(this.idSynthese).subscribe(dataChecks => {
this.profileDataChecks = dataChecks;
})
}

formatMailContent(email) {
Expand Down

0 comments on commit 375238a

Please sign in to comment.