Skip to content

Commit d11ae2a

Browse files
committed
Species Matching included VersionID handling #980
1 parent 760e63a commit d11ae2a

26 files changed

Lines changed: 581 additions & 224 deletions

File tree

Components/DLM/BExIS.Dlm.Entities/SpeciesMatching/SpeciesMatchingResult.cs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@ namespace BExIS.Dlm.Entities.SpeciesMatching
88
public class SpeciesMatchingResult : BaseEntity
99
{
1010

11-
// original unchanged name submitted for matching
11+
// original unchanged name (used for matching if EditedName is empty, and for display purposes)
1212
public virtual string OriginalName { get; set; }
1313

14-
// cleaned name after preprocessing (e.g. trimming, removing special characters, etc.)
15-
public virtual string CleanedName { get; set; }
16-
17-
// edited name after manual corrections (if any)
14+
// edited name after data cleaning + manual corrections (used for matching)
1815
public virtual string EditedName { get; set; }
1916

20-
// matched name from the external source
17+
// matched name from the external source (the result)
2118
public virtual string MatchedName { get; set; }
2219

2320
// taxonomic status of the matched name (e.g. accepted, synonym, etc.)
@@ -41,11 +38,7 @@ public class SpeciesMatchingResult : BaseEntity
4138
// reference to the dataset where the original name was taken from
4239
public virtual Dataset Dataset { get; set; }
4340

44-
// reference to the specific version of the dataset
45-
// TODO: get this to work (maybe as a normal field instead of many-to-one relation)
46-
//public virtual DatasetVersion DatasetVersion { get; set; }
47-
48-
// reference to the user who owns this matching result
49-
public virtual User Creator { get; set; }
41+
// VersionId + Dataset make the unique key for the matching result
42+
public virtual long DatasetVersionId { get; set; }
5043
}
5144
}

Components/DLM/BExIS.Dlm.Orm.NH/Mappings/Default/SpeciesMatching/SpeciesMatchingResult.hbm.xml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
<property name="OriginalName" column="original_name" type="string" not-null="false" />
1010

11-
<property name="CleanedName" column="cleaned_name" type="string" not-null="false" />
12-
1311
<property name="EditedName" column="edited_name" type="string" not-null="false" />
1412

1513
<property name="MatchedName" column="matched_name" type="string" not-null="false" />
@@ -28,12 +26,11 @@
2826

2927
<!-- Mapping entity associations -->
3028

29+
<property name="DatasetVersionId" column="dataset_version_id" type="Int64" not-null="false" />
30+
3131
<!--Dataset-->
3232
<many-to-one name="Dataset" class="BExIS.Dlm.Entities.Data.Dataset" not-null="false" column="DatasetRef" />
3333

34-
<!--Creator-->
35-
<many-to-one name="Creator" class="BExIS.Security.Entities.Subjects.User" not-null="false" column="UserRef" />
36-
3734
<!--DatasetVersion (does not work this way ... Error: refers to unmapped ...-->
3835
<!--
3936
<many-to-one class="DatasetVersion" name="DatasetVersion" column="DatasetVersionRef">

Components/DLM/BExIS.Dlm.Services/SpeciesMatching/SpeciesMatchingResultManager.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ protected virtual void Dispose(bool disposing)
5151
public SpeciesMatchingResult Create(SpeciesMatchingResult matchingResult)
5252
{
5353
if (matchingResult == null) throw new ArgumentNullException("Species matching result must not be null.");
54-
if (matchingResult.Creator == null) throw new ArgumentNullException("Creator type must not be null.");
5554
if (matchingResult.Dataset == null) throw new ArgumentNullException("Dataset must not be null.");
5655
if (matchingResult.OriginalName == null) throw new ArgumentNullException("Dataset must not be null.");
5756

Components/DLM/BExIS.Dlm.Tests/Services/SpeciesMatching/SpeciesMatchingResultManagerTest.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ public void Create_Valid_EntityTemplate()
4545
var dataset = datasetManager.DatasetRepo.Get().FirstOrDefault();
4646

4747
matchingResult.OriginalName = "Sunflower";
48-
matchingResult.CleanedName = "";
4948
matchingResult.EditedName = "";
5049
matchingResult.MatchedName = "";
5150
matchingResult.Status = "";
@@ -55,7 +54,7 @@ public void Create_Valid_EntityTemplate()
5554
matchingResult.MatchSourceVersion = "";
5655
matchingResult.ConfirmedByUser = false;
5756
matchingResult.Dataset = dataset;
58-
matchingResult.Creator = user;
57+
matchingResult.DatasetVersionId = 1;
5958

6059
//Act
6160
var created = speciesMatchingResultManager.Create(matchingResult);

Console/BExIS.Web.Shell/Areas/SMM/BExIS.Modules.SMM.UI.Svelte/src/routes/species/+page.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<script lang="ts">
22
import { ErrorMessage, Page, pageContentLayoutType, positionType, Spinner } from "@bexis2/bexis2-core-ui";
3-
import { load } from "./services";
43
import type { SpeciesModel } from "./types";
54
import { Table } from '@bexis2/bexis2-core-ui';
65
import type { TableConfig } from '@bexis2/bexis2-core-ui';
Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
11
// Implementations for all the calls for the pokemon endpoints.
22
//import Api from "./Api";
33
import { Api } from '@bexis2/bexis2-core-ui';
4-
5-
/****************/
6-
/* Create*/
7-
/****************/
8-
export const load = async () => {
9-
try {
10-
const response = await Api.get('/smm/species/load');
11-
return response.data;
12-
} catch (error) {
13-
console.error(error);
14-
}
15-
};
16-

Console/BExIS.Web.Shell/Areas/SMM/BExIS.Modules.SMM.UI/BExIS.Modules.SMM.UI.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
<ItemGroup>
122122
<Compile Include="Controllers\HomeController.cs" />
123123
<Compile Include="Controllers\SpeciesController.cs" />
124+
<Compile Include="Helpers\ConversionHelper.cs" />
124125
<Compile Include="Helpers\MatchingResultHelper.cs" />
125126
<Compile Include="Helpers\ProgressHelper.cs" />
126127
<Compile Include="Helpers\SMMSeedDataGenerator.cs" />
@@ -249,6 +250,10 @@
249250
<Project>{252F7872-A69C-43A6-84B4-4D2ABDBDD9AB}</Project>
250251
<Name>BExIS.Xml.Helpers</Name>
251252
</ProjectReference>
253+
<ProjectReference Include="..\..\..\..\..\Modules\DIM\BExIS.Dim.Entities\BExIS.Dim.Entities.csproj">
254+
<Project>{34CAD2A2-6928-458B-B8DC-AF71D55F20CC}</Project>
255+
<Name>BExIS.Dim.Entities</Name>
256+
</ProjectReference>
252257
<ProjectReference Include="..\..\DIM\BExIS.Modules.Dim.UI\BExIS.Modules.Dim.UI.csproj">
253258
<Project>{9BFFFD11-03C6-47DF-9CC9-F458A9A49377}</Project>
254259
<Name>BExIS.Modules.Dim.UI</Name>

0 commit comments

Comments
 (0)