Skip to content

Commit

Permalink
Merge pull request #1434 from Artsdatabanken/feature/horizonScanned
Browse files Browse the repository at this point in the history
Horisontskannede vurderinger
  • Loading branch information
matssa authored Sep 23, 2024
2 parents 42a1fdb + b370b4c commit 2de3193
Show file tree
Hide file tree
Showing 40 changed files with 792 additions and 279 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public async Task<IActionResult> Detail(int id)
// members by expertgroup
if (!assessmentExpertGroupMembers.Any())
{
assessmentExpertGroupMembers = expertGroupMembers.Where(x => x.ExpertGroup == assessment.ExpertGroup)
assessmentExpertGroupMembers = expertGroupMembers.Where(x => x.ExpertGroup == assessment.ExpertGroup).DistinctBy(x => x.FullName)
.OrderBy(x => new List<string> { "Leder", "Medlem" }.IndexOf(x.ExpertGroupRole)).ThenBy(x => x.LastName).ToList();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,18 +250,5 @@ public static string GetChipText(string filter, FilterItem[] filterItems)
}
return String.Empty;
}

public class SearchAndFilterNames
{
public const string GeographicRiskVariation = "Geografisk variasjon i risiko";
public const string ClimateChangeRisk = "Betydning av klimaendringer for risiko";
public const string FirstTimeAssessment = "Risikovurdert for første gang";
public const string ChooseCriteria = "Avgjørende kriterier for risikokategori";
public const string KnownOrExpectedInRegion = "Regioner med kjent eller forventet forekomst";
public const string NaturType = "Naturtype";
public const string WaysOfSpreading = "Spredningsmåter";
public const string RegionallyAlienSpecies = "Regionalt fremmede arter";
public const string NonAssessedSpecies = "Ikke risikovurderte arter";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,9 @@ public enum NotAssessedAlienSpeciesCategory

UncertainBefore1800 = AlienSpeciecAssessment2023AlienSpeciesCategory.UncertainBefore1800,

MisIdentified = AlienSpeciecAssessment2023AlienSpeciesCategory.MisIdentified
MisIdentified = AlienSpeciecAssessment2023AlienSpeciesCategory.MisIdentified,

HorizonScanned = AlienSpeciecAssessment2023AlienSpeciesCategory.HorizonScannedButNoRiskAssessment
}

public FilterAndMetaData AlienSpecies2023NotAssessed() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ private static IQueryable<AlienSpeciesAssessment2023> ApplyNotAssessed(string[]
nameof(NotAssessed.NotAssessedAlienSpeciesCategory.NotAlienSpecies) => query.Where(x => x.AlienSpeciesCategory == AlienSpeciecAssessment2023AlienSpeciesCategory.NotAlienSpecie),
nameof(NotAssessed.NotAssessedAlienSpeciesCategory.UncertainBefore1800) => query.Where(x => x.AlienSpeciesCategory == AlienSpeciecAssessment2023AlienSpeciesCategory.UncertainBefore1800),
nameof(NotAssessed.NotAssessedAlienSpeciesCategory.MisIdentified) => query.Where(x => x.AlienSpeciesCategory == AlienSpeciecAssessment2023AlienSpeciesCategory.MisIdentified),
nameof(NotAssessed.NotAssessedAlienSpeciesCategory.HorizonScanned) => query.Where(x => x.AlienSpeciesCategory == AlienSpeciecAssessment2023AlienSpeciesCategory.HorizonScannedButNoRiskAssessment),
_ => null
};
if (assessments != null)
Expand Down
2 changes: 2 additions & 0 deletions Assessments.Frontend.Web/Infrastructure/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ public class SearchAndFiltersAlienSpecies

public const string AlienSpecies2023FirstPublished = "11.08.2023";

public const string AlienSpecies2023FirstPublishedHorizonScanned = "23.09.2024";

public const string AlienSpecies2023FirstPublishedYear = "2023";

public const int AlienSpecies2023PageMenuContentId = 239657;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public AlienSpeciesDetailViewModel(AlienSpeciesAssessment2023 assessment)
Environment = assessment.Environment,
EvaluationContext = assessment.EvaluationContext,
HasIndoorProduction = assessment.HasIndoorProduction,
HorizonEcologicalEffect = assessment.HorizonEcologicalEffect,
HorizonEstablismentPotential = assessment.HorizonEstablismentPotential,
HybridWithoutOwnRiskAssessmentDescription = assessment.HybridWithoutOwnRiskAssessmentDescription,
ImportPathways = assessment.ImportPathways,
MisidentifiedDescription = assessment.MisIdentifiedDescription,
Expand Down
6 changes: 5 additions & 1 deletion Assessments.Frontend.Web/Models/PartialViewModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@ public class ExpertStatementViewModel

public string UncertaintyEstablishmentTimeDescription { get; set; }

public string ScientificName { get; set; }
public string ScientificName { get; set; }

public AlienSpeciesAssessment2023HorizonEstablismentPotential? HorizonEstablismentPotential { get; set; }

public AlienSpeciesAssessment2023HorizonEcologicalEffect? HorizonEcologicalEffect { get; set; }
}

public class IngressViewModel
Expand Down
2 changes: 1 addition & 1 deletion Assessments.Frontend.Web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Make areas in the assessment page collapsible

Follow the recipe found in top of the file "Assessments.Frontend.Web/wwwroot/js/collapse.js".
Follow the recipe found in top of the file "Assessments.Frontend.Web/wwwroot/js/accordions.js".

### Adding a filter to the list view

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,4 +246,7 @@
<data name="axis_score" xml:space="preserve">
<value>score</value>
</data>
<data name="did_not_pass_horizon_scanning" xml:space="preserve">
<value>outside the scope of risk assessment</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -246,4 +246,7 @@
<data name="axis_score" xml:space="preserve">
<value>delkategori</value>
</data>
<data name="did_not_pass_horizon_scanning" xml:space="preserve">
<value>utenfor avgrensningen for risikovurdering</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
{
AssessmentYear = 2023, // TODO: create this field in assessment model
ExpertCommittee = assessment.ExpertGroup,
FirstPublishedDateString = Constants.AlienSpecies2023FirstPublished,
FirstPublishedDateString = assessment.AlienSpeciesCategory == AlienSpeciecAssessment2023AlienSpeciesCategory.HorizonScannedButNoRiskAssessment ? Constants.AlienSpecies2023FirstPublishedHorizonScanned : Constants.AlienSpecies2023FirstPublished,
RevisionDate = assessment.RevisionDate, // TODO: check if this is revision date
RevisionReason = "", // TODO: create a field for this, if we need revisions at all for alien species
SpeciesGroup = assessment.SpeciesGroup.DisplayName(),
Expand Down Expand Up @@ -91,7 +91,8 @@
var isMisidentified = assessment.AlienSpeciesCategory == Assessments.Mapping.AlienSpecies.Model.Enums.AlienSpeciecAssessment2023AlienSpeciesCategory.MisIdentified;

var showExpertStatement = !isNr && !isEvaluatedAtAnotherLevel;
var showAssessmentReasoning = (isNr || isEvaluatedAtAnotherLevel) &&
var isHorizonScanned = Model.Assessment.AlienSpeciesCategory == AlienSpeciecAssessment2023AlienSpeciesCategory.HorizonScannedButNoRiskAssessment;
var showAssessmentReasoning = isHorizonScanned || (isNr || isEvaluatedAtAnotherLevel) &&
(!string.IsNullOrEmpty(Model.ExpertStatementViewModel.MisidentifiedDescription) ||
!string.IsNullOrEmpty(Model.ExpertStatementViewModel.AllSubTaxaAssessedSeparately) ||
!string.IsNullOrEmpty(Model.ExpertStatementViewModel.HybridWithoutOwnRiskAssessmentDescription) ||
Expand All @@ -100,14 +101,14 @@
!string.IsNullOrEmpty(Model.ExpertStatementViewModel.ConnectedToHigherLowerTaxonDescription) ||
!string.IsNullOrEmpty(Model.ExpertStatementViewModel.UncertaintyEstablishmentTimeDescription));
var showRiskCategoryExplanation = !isNr && !isEvaluatedAtAnotherLevel;
var showCategoryChange = !((isNr && (sameAs2018 || !has2018Assessmnet)) || isEvaluatedAtAnotherLevel || isMisidentified);
var showCategoryChange = !((isNr && (sameAs2018 || !has2018Assessmnet)) || isEvaluatedAtAnotherLevel || isMisidentified || isHorizonScanned);
var showClimateEffectsInvationpotential = !isNr && !isEvaluatedAtAnotherLevel;
var showGeographicVariationInCategory = !isNr && !isEvaluatedAtAnotherLevel;
var showRegionalSpread = !isNr && !isEvaluatedAtAnotherLevel;
var showAttachments = !isEvaluatedAtAnotherLevel && assessment.Attachments != null && assessment.Attachments.Count() != 0;
var showImpactedNatureTypes = !isNr && !isEvaluatedAtAnotherLevel;
var showKnowMore = !(assessment.Category == AlienSpeciesAssessment2023Category.NR && (assessment.AlienSpeciesCategory == AlienSpeciecAssessment2023AlienSpeciesCategory.NotAlienSpecie || Model.Assessment.SpeciesStatus == AlienSpeciesAssessment2023SpeciesStatus.NotIndicated));
var showReference = assessment.References != null && assessment.References.Count() > 0;
var showKnowMore = !(assessment.Category == AlienSpeciesAssessment2023Category.NR && (assessment.AlienSpeciesCategory == AlienSpeciecAssessment2023AlienSpeciesCategory.NotAlienSpecie || Model.Assessment.SpeciesStatus == AlienSpeciesAssessment2023SpeciesStatus.NotIndicated || Model.Assessment.AlienSpeciesCategory == AlienSpeciecAssessment2023AlienSpeciesCategory.HorizonScannedButNoRiskAssessment));
var showReference = assessment.References != null && assessment.References.Count() > 0 && assessment.AlienSpeciesCategory != AlienSpeciecAssessment2023AlienSpeciesCategory.HorizonScannedButNoRiskAssessment;
var showSpreadWays = !isNr && !isEvaluatedAtAnotherLevel;
var showTableOfContents = assessment.Category != AlienSpeciesAssessment2023Category.NR;
var showCitationForAssessment = Model.ExpertGroupMembers.Any();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@model ExpertStatementViewModel
@using Assessments.Mapping.AlienSpecies.Model.Enums
@model ExpertStatementViewModel

@{
var showChangedAssessment = Model.AlienSpeciesCategory == Assessments.Mapping.AlienSpecies.Model.Enums.AlienSpeciecAssessment2023AlienSpeciesCategory.NotAlienSpecie;
Expand All @@ -7,6 +8,7 @@
var showChangedFromAlienDescription = !string.IsNullOrEmpty(Model.ChangedFromAlienDescription) && (!string.IsNullOrEmpty(Model.AlienStatusExplanation) && Model.AlienStatusExplanation != Model.ChangedFromAlienDescription || string.IsNullOrEmpty(Model.AlienStatusExplanation));
var showConnectedToHigherLowerTaxonDescription = Model.AlienSpeciesCategory == Assessments.Mapping.AlienSpecies.Model.Enums.AlienSpeciecAssessment2023AlienSpeciesCategory.TaxonEvaluatedAtAnotherLevel;
var showUncertaintyEstablishmentTimeDescription = Model.AlienSpeciesCategory == Assessments.Mapping.AlienSpecies.Model.Enums.AlienSpeciecAssessment2023AlienSpeciesCategory.UncertainBefore1800 || Model.AlienSpeciesCategory == Assessments.Mapping.AlienSpecies.Model.Enums.AlienSpeciecAssessment2023AlienSpeciesCategory.RegionallyAlienEstablishedBefore1800;
var showHorizonScanned = Model.AlienSpeciesCategory == AlienSpeciecAssessment2023AlienSpeciesCategory.HorizonScannedButNoRiskAssessment;
var isMisidentified = Model.AlienSpeciesCategory == Assessments.Mapping.AlienSpecies.Model.Enums.AlienSpeciecAssessment2023AlienSpeciesCategory.MisIdentified;
var isAllBubTaxaAssessedSeparately = Model.AlienSpeciesCategory == Assessments.Mapping.AlienSpecies.Model.Enums.AlienSpeciecAssessment2023AlienSpeciesCategory.AllSubTaxaAssessedSeparately;
var isHybridWithoutOwnRiskAssessment = Model.AlienSpeciesCategory == Assessments.Mapping.AlienSpecies.Model.Enums.AlienSpeciecAssessment2023AlienSpeciesCategory.HybridWithoutOwnRiskAssessment;
Expand Down Expand Up @@ -36,6 +38,9 @@
<p is-visible="@showUncertaintyEstablishmentTimeDescription">
@Html.Raw(Model.UncertaintyEstablishmentTimeDescription)
</p>
<div is-visible="showHorizonScanned">
<partial name="/Views/AlienSpecies/2023/AssessmentPartials/_HorizonScanned.cshtml" />
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -361,22 +361,14 @@

void GetListForCategory(AlienSpeciesAssessment2023Criterion criterion, string letter)
{
<div class="collapsible_header">
<button onclick="toggleAccordion(this)" class="adb-accordion-button">
<span>
<b><span class="collapsible_header_letter">@letter.</span></b>
<span> @AlienSpeciesHelpers.GetLetterFullText(criterion) @Localizer["corresponds_to"] @LocalizerShared["score"] @criterion.Value.</span>
</span>
<button onclick="toggleCollapsible(this)" class="adb-button ghost">
<span class="expanded_icon">
<span>Se mindre</span>
<span class="material-icons">expand_less</span>
</span>
<span class="collapsed_icon">
<span>Se mer</span>
<span class="material-icons">expand_more</span>
</span>
</button>
</div>
</span>
<span class="material-symbols-outlined add">expand_more</span>
<span class="material-symbols-outlined remove">expand_less</span>
</button>
}

void GetEstimationMethod(string estimationMethod)
Expand Down Expand Up @@ -408,11 +400,11 @@
<span>@Localizer["go_to_non_decisive"]</span>
</p>
<ul class="criteria-summary-list">
<li is-visible="criteriaHasA || criteriaHasB" class="collapsible initially_closed">
<li is-visible="criteriaHasA || criteriaHasB" class="adb-accordion accordion-primary">
@{
GetListForCategory(uncertaintyA, AlienSpeciesAssessment2023CriteriaLetter.A.ToString());
}
<div class="collapsible_content">
<div class="adb-accordion-content">
@{GetEstimationMethod(assessment.MedianLifetimeEstimationMethod.DisplayName().ToLowerInvariant());}
<p class="summary-estimated">
<span is-visible="showSimplifiedEstimateAcceptedAlien || showSimplifiedEstimateNotAcceptedAlien">
Expand Down Expand Up @@ -520,11 +512,11 @@
</div>
</div>
</li>
<li is-visible="criteriaHasA || criteriaHasB" class="collapsible initially_closed">
<li is-visible="criteriaHasA || criteriaHasB" class="adb-accordion accordion-primary">
@{
GetListForCategory(uncertaintyB, AlienSpeciesAssessment2023CriteriaLetter.B.ToString());
}
<div class="collapsible_content">
<div class="adb-accordion-content">
@{GetEstimationMethod(assessment.ExpansionSpeedEstimationMethod.DisplayName().ToLowerInvariant());}
<div is-visible="isSpatiotemporalDataset">
<br>
Expand Down Expand Up @@ -633,11 +625,11 @@
</div>
</li>
<li is-visible="criteriaHasC">
<div is-visible="hasContentC" class="collapsible initially_closed">
<div is-visible="hasContentC" class="adb-accordion accordion-primary">
@{
GetListForCategory(uncertaintyC, AlienSpeciesAssessment2023CriteriaLetter.C.ToString());
}
<div class="collapsible_content">
<div class="adb-accordion-content">
<table class="big-data-table">
<caption class="table-title">
<b>@Constants.AlienSpeciesTables.CriteriaCNaturetypesTableTitle</b>
Expand Down Expand Up @@ -691,11 +683,11 @@
<p>@Localizer["eco_effect_no_decisive"]</p>
</p>
<ul class="criteria-summary-list">
<li is-visible="criteriaHasD && !showIsNk && hasContentD" class="collapsible initially_closed">
<li is-visible="criteriaHasD && !showIsNk && hasContentD" class="adb-accordion accordion-primary">
@{
GetListForCategory(uncertaintyD, AlienSpeciesAssessment2023CriteriaLetter.D.ToString());
}
<div class="collapsible_content">
<div class="adb-accordion-content">
<div is-visible="@(assessment.SpeciesSpeciesInteractionsThreatenedSpecies != null && assessment.SpeciesSpeciesInteractionsThreatenedSpecies.Count() != 0)">
<div class="mobile_hide">
@{
Expand Down Expand Up @@ -734,11 +726,11 @@
</div>
</li>

<li is-visible="criteriaHasE && !showIsNk && hasContentE" class="collapsible initially_closed">
<li is-visible="criteriaHasE && !showIsNk && hasContentE" class="adb-accordion accordion-primary">
@{
GetListForCategory(uncertaintyE, AlienSpeciesAssessment2023CriteriaLetter.E.ToString());
}
<div class="collapsible_content">
<div class="adb-accordion-content">
<div is-visible="@(assessment.SpeciesSpeciesInteractions != null && assessment.SpeciesSpeciesInteractions .Count() != 0)">
<div class="mobile_hide">
@{
Expand Down Expand Up @@ -777,11 +769,11 @@
</div>
</li>

<li is-visible="criteriaHasF && !showIsNk && hasContentF" class="collapsible initially_closed">
<li is-visible="criteriaHasF && !showIsNk && hasContentF" class="adb-accordion accordion-primary">
@{
GetListForCategory(uncertaintyF, AlienSpeciesAssessment2023CriteriaLetter.F.ToString());
}
<div class="collapsible_content">
<div class="adb-accordion-content">
<div is-visible="showFTable">
@{
GetFGTable(true);
Expand All @@ -794,11 +786,11 @@
</li>

<li is-visible="criteriaHasG">
<div is-visible="!showIsNk && hasContentG" class="collapsible initially_closed">
<div is-visible="!showIsNk && hasContentG" class="adb-accordion accordion-primary">
@{
GetListForCategory(uncertaintyG, AlienSpeciesAssessment2023CriteriaLetter.G.ToString());
}
<div class="collapsible_content">
<div class="adb-accordion-content">
<div is-visible="showGTable">
@{
GetFGTable(false);
Expand All @@ -812,11 +804,11 @@
</li>

<li is-visible="criteriaHasH">
<div is-visible="!showIsNk && hasContentH" class="collapsible initially_closed">
<div is-visible="!showIsNk && hasContentH" class="adb-accordion accordion-primary">
@{
GetListForCategory(uncertaintyH, AlienSpeciesAssessment2023CriteriaLetter.H.ToString());
}
<div class="collapsible_content">
<div class="adb-accordion-content">
<div>
<table class="big-data-table" is-visible="showHTable">
<caption class="table-title">
Expand Down Expand Up @@ -863,11 +855,11 @@
</li>

<li is-visible="criteriaHasI">
<div is-visible="!showIsNk && hasContentI" class="collapsible initially_closed">
<div is-visible="!showIsNk && hasContentI" class="adb-accordion accordion-primary">
@{
GetListForCategory(uncertaintyI, AlienSpeciesAssessment2023CriteriaLetter.I.ToString());
}
<div class="collapsible_content">
<div class="adb-accordion-content">
<div>
<table class="big-data-table" is-visible="showITable">
<caption class="table-title">
Expand Down Expand Up @@ -919,7 +911,7 @@
</div>
</li>

<li is-visible="!isDecisiveCriteria && UnusedCriteriaEcologicalEffect().Length > 0" class="collapsible initially_closed">
<li is-visible="!isDecisiveCriteria && UnusedCriteriaEcologicalEffect().Length > 0" class="adb-accordion accordion-primary">
<div class="collapsible_header">
@Localizer["eco_effects_by_criteria"] @UnusedCriteriaEcologicalEffect()
@Localizer["evaluated_absent"]
Expand Down
Loading

0 comments on commit 2de3193

Please sign in to comment.