Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSCTTV-4052 Add jufoCodeRecorded and jufoClassCodeRecorded #173

Merged
merged 7 commits into from
Dec 16, 2024
Merged
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
12 changes: 12 additions & 0 deletions aspnetcore/src/ApiModels/Publication/Publication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@
///
/// http://uri.suomi.fi/codelist/research/AvoinSaatavuusKytkin
/// </summary>
public OpenAccess OpenAccess { get; set; }

Check warning on line 130 in aspnetcore/src/ApiModels/Publication/Publication.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'OpenAccess' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

/// <summary>
/// Open Access status of a publication channel
///
/// http://uri.suomi.fi/codelist/research/JulkaisuKanavaOA
/// </summary>
public PublisherOpenAccess PublisherOpenAccess { get; set; }

Check warning on line 137 in aspnetcore/src/ApiModels/Publication/Publication.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'PublisherOpenAccess' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

/// <summary>
/// Parent publication
Expand Down Expand Up @@ -163,6 +163,18 @@
/// </summary>
public JufoClass? JufoClass { get; set; }

/// <summary>
/// Publication forum (recorded)
/// </summary>
public string? JufoCodeRecorded { get; set; }

/// <summary>
/// Publication forum classification (recorded)
///
/// http://uri.suomi.fi/codelist/research/julkaisufoorumiluokitus
/// </summary>
public JufoClass? jufoClassRecorded { get; set; }

/// <summary>
/// DOI
/// </summary>
Expand Down
30 changes: 26 additions & 4 deletions aspnetcore/src/ApiModels/Query/GetPublicationsQueryParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public class GetPublicationsQueryParameters
/// <summary>
/// The field type:code is exactly equal to the text.
///
/// Code: http://uri.suomi.fi/codelist/research/Julkaisutyyppiluokitus
/// Code: https://koodistot.suomi.fi/codescheme;registryCode=research;schemeCode=Julkaisutyyppiluokitus
/// </summary>
/// <see cref="Publication.Type"/>
public string? Type { get; set; }
Expand Down Expand Up @@ -121,11 +121,33 @@ public class GetPublicationsQueryParameters
public string? PublisherName { get; set; }

/// <summary>
/// The field jufocode contains text.
/// The field jufoCode contains text.
/// </summary>
/// <see cref="Publication.JufoCode"/>
public string? JufoCode { get; set; }

/// <summary>
/// The field jufoCodeRecorded contains text. Recorded as part of national publication data collection.
/// </summary>
/// <see cref="Publication.JufoCodeRecorded"/>
public string? JufoCodeRecorded { get; set; }

/// <summary>
/// The field jufoClass is exactly equal to text.
///
/// Code: https://koodistot.suomi.fi/codescheme;registryCode=research;schemeCode=Julkaisufoorumiluokitus
/// </summary>
/// <see cref="Publication.JufoClass"/>
public string? JufoClass { get; set; }

/// <summary>
/// The field jufoClassRecorded is exactly equal to text. Recorded as part of national publication data collection.
///
/// Code: https://koodistot.suomi.fi/codescheme;registryCode=research;schemeCode=Julkaisufoorumiluokitus
/// </summary>
/// <see cref="Publication.JufoClassRecorded"/>
public string? JufoClassRecorded { get; set; }

/// <summary>
/// The field doi is exactly equal to the text.
/// </summary>
Expand All @@ -142,7 +164,7 @@ public class GetPublicationsQueryParameters
/// <summary>
/// The field publisherOpenAccess:code is exactly equal to the text.
///
/// Code: http://uri.suomi.fi/codelist/research/JulkaisuKanavaOA
/// Code: https://koodistot.suomi.fi/codescheme;registryCode=research;schemeCode=JulkaisuKanavaOA
/// </summary>
/// <see cref="Publication.PublisherOpenAccess"/>
public string? PublisherOpenAccess { get; set; }
Expand All @@ -156,7 +178,7 @@ public class GetPublicationsQueryParameters
/// <summary>
/// The field status is exactly equal to the text.
///
/// Code: http://uri.suomi.fi/codelist/research/julkaisuntila
/// Code: https://koodistot.suomi.fi/codescheme;registryCode=research;schemeCode=julkaisuntila
/// </summary>
/// <see cref="Publication.Status"/>
public string? Status { get; set; }
Expand Down
170 changes: 91 additions & 79 deletions aspnetcore/src/DatabaseContext/ApiDbContext.cs

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions aspnetcore/src/DatabaseContext/Entities/DimPublication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ public partial class DimPublication

public int? DimPublicationId { get; set; }

public int JufoClassCodeFrozen { get; set; }

public int DimPublicationChannelIdFrozen { get; set; }

public virtual DimReferencedatum? ArticleTypeCodeNavigation { get; set; }

public virtual ICollection<DimLocallyReportedPubInfo> DimLocallyReportedPubInfos { get; set; } = new List<DimLocallyReportedPubInfo>();
Expand All @@ -131,6 +135,8 @@ public partial class DimPublication

public virtual DimPublicationChannel DimPublicationChannel { get; set; } = null!;

public virtual DimPublicationChannel DimPublicationChannelIdFrozenNavigation { get; set; } = null!;

public virtual DimPublication? DimPublicationNavigation { get; set; }

public virtual DimRegisteredDataSource DimRegisteredDataSource { get; set; } = null!;
Expand All @@ -143,6 +149,8 @@ public partial class DimPublication

public virtual ICollection<DimPublication> InverseDimPublicationNavigation { get; set; } = new List<DimPublication>();

public virtual DimReferencedatum JufoClassCodeFrozenNavigation { get; set; } = null!;

public virtual DimReferencedatum JufoClassNavigation { get; set; } = null!;

public virtual DimReferencedatum LanguageCodeNavigation { get; set; } = null!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ public partial class DimPublicationChannel

public virtual ICollection<DimPid> DimPids { get; set; } = new List<DimPid>();

public virtual ICollection<DimPublication> DimPublications { get; set; } = new List<DimPublication>();
public virtual ICollection<DimPublication> DimPublicationDimPublicationChannelIdFrozenNavigations { get; set; } = new List<DimPublication>();

public virtual ICollection<DimPublication> DimPublicationDimPublicationChannels { get; set; } = new List<DimPublication>();

public virtual ICollection<DimResearchActivity> DimResearchActivities { get; set; } = new List<DimResearchActivity>();
}
2 changes: 2 additions & 0 deletions aspnetcore/src/DatabaseContext/Entities/DimReferencedatum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public partial class DimReferencedatum

public virtual ICollection<DimPublication> DimPublicationArticleTypeCodeNavigations { get; set; } = new List<DimPublication>();

public virtual ICollection<DimPublication> DimPublicationJufoClassCodeFrozenNavigations { get; set; } = new List<DimPublication>();

public virtual ICollection<DimPublication> DimPublicationJufoClassNavigations { get; set; } = new List<DimPublication>();

public virtual ICollection<DimPublication> DimPublicationLanguageCodeNavigations { get; set; } = new List<DimPublication>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,6 @@ private static IEnumerable<Func<QueryContainerDescriptor<Publication>, QueryCont
.Value(parameters.TypeCode)
));
}

// Searching with publisher open access code requires exact match.
if (!string.IsNullOrWhiteSpace(parameters.PublisherOpenAccess))
{
filters.Add(t => t.Term(term => term
.Field(f => f.PublisherOpenAccess!.Code)
.Value(parameters.PublisherOpenAccess)
));
}

if (parameters.Issn is not null)
{
Expand All @@ -289,6 +280,13 @@ private static IEnumerable<Func<QueryContainerDescriptor<Publication>, QueryCont
t.Term(s => s.Field(f => f.JufoCode)
.Value(parameters.JufoCode)));
}

if (parameters.JufoCodeRecorded is not null)
{
filters.Add(t =>
t.Term(s => s.Field(f => f.JufoCodeRecorded)
.Value(parameters.JufoCodeRecorded)));
}

if (parameters.Doi is not null)
{
Expand All @@ -297,6 +295,33 @@ private static IEnumerable<Func<QueryContainerDescriptor<Publication>, QueryCont
.Value(parameters.Doi)));
}

// Searching with jufo class requires exact match.
if (!string.IsNullOrWhiteSpace(parameters.JufoClass))
{
filters.Add(t => t.Term(term => term
.Field(f => f.JufoClass!.Code)
.Value(parameters.JufoClass)
));
}

// Searching with jufo class recorded requires exact match.
if (!string.IsNullOrWhiteSpace(parameters.JufoClassRecorded))
{
filters.Add(t => t.Term(term => term
.Field(f => f.JufoClassRecorded!.Code)
.Value(parameters.JufoClassRecorded)
));
}

// Searching with publisher open access code requires exact match.
if (!string.IsNullOrWhiteSpace(parameters.PublisherOpenAccess))
{
filters.Add(t => t.Term(term => term
.Field(f => f.PublisherOpenAccess!.Code)
.Value(parameters.PublisherOpenAccess)
));
}

// Searching with status requires exact match.
if (!string.IsNullOrWhiteSpace(parameters.Status))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ public class PublicationSearchParameters

public string? JufoCode { get; set; }

public string? JufoCodeRecorded { get; set; }

public string? JufoClass { get; set; }

public string? JufoClassRecorded { get; set; }

public string? Doi { get; set; }

public string? Keywords { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion aspnetcore/src/Indexer/Indexer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
Expand Down
2 changes: 2 additions & 0 deletions aspnetcore/src/Repositories/Maps/PublicationProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public PublicationProfile()
.ForMember(dst => dst.PublisherLocation, opt => opt.MapFrom(src => src.PublisherLocation))
.ForMember(dst => dst.JufoCode, opt => opt.MapFrom(src => src.DimPublicationChannel.JufoCode))
.ForMember(dst => dst.JufoClass, opt => opt.MapFrom(src => src.JufoClassNavigation))
.ForMember(dst => dst.JufoCodeRecorded, opt => opt.MapFrom(src => src.DimPublicationChannelIdFrozenNavigation.JufoCode))
.ForMember(dst => dst.JufoClassRecorded, opt => opt.MapFrom(src => src.JufoClassCodeFrozenNavigation))
.ForMember(dst => dst.Doi, opt => opt.MapFrom(src => src.Doi))
.ForMember(dst => dst.DoiHandle, opt => opt.MapFrom(src => src.DoiHandle))
.ForMember(dst => dst.FieldsOfScience, opt => opt.MapFrom(src => src.FactDimReferencedataFieldOfSciences.Select(f => f.DimReferencedata)))
Expand Down
10 changes: 10 additions & 0 deletions aspnetcore/src/Service.Models/Publication/Publication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,16 @@ public class Publication
/// </summary>
public ReferenceData? JufoClass { get; set; }

/// <summary>
/// Julkaisufoorumi (jäädytetty)
/// </summary>
public string? JufoCodeRecorded { get; set; }

/// <summary>
/// Julkaisufoorumitaso (jäädytetty)
/// </summary>
public ReferenceData? JufoClassRecorded { get; set; }

/// <summary>
/// Linkit
/// </summary>
Expand Down
21 changes: 21 additions & 0 deletions aspnetcore/test/Indexer.Tests/Maps/PublicationProfileTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,19 @@ private static DimPublication GetEntity()
ChannelNameAnylang = "channelNameAnylang",
PublisherNameText = "publisherNameText",
},
JufoClassCodeFrozenNavigation = new DimReferencedatum
{
CodeValue = "jufoClassCodeFrozen",
NameFi = "jufoClassCodeFrozenNameFi",
NameEn = "jufoClassCodeFrozenNameEn",
NameSv = "jufoClassCodeFrozenNameSv"
},
DimPublicationChannelIdFrozenNavigation = new()
{
JufoCode = "jufoCodeFrozen",
ChannelNameAnylang = "channelNameAnylang2",
PublisherNameText = "publisherNameText2",
},
PublisherOpenAccessCodeNavigation = new DimReferencedatum
{
CodeValue = "publisherOpenAccessCode",
Expand Down Expand Up @@ -495,6 +508,14 @@ private Publication GetModel()
NameEn = "jufoClassNameEn",
NameSv = "jufoClassNameSv"
},
JufoCodeRecorded = "jufoCodeFrozen",
JufoClassRecorded = new ReferenceData
{
Code = "jufoClassCodeFrozen",
NameFi = "jufoClassCodeFrozenNameFi",
NameEn = "jufoClassCodeFrozenNameEn",
NameSv = "jufoClassCodeFrozenNameSv"
},
Doi = "doi",
DoiHandle = "doiHandle",
Keywords = new List<Keyword>
Expand Down
Loading