Skip to content

Commit

Permalink
Update TTV database context, field of art
Browse files Browse the repository at this point in the history
  • Loading branch information
sarkikos committed Oct 12, 2023
1 parent b3ce54b commit 10d582d
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 194 deletions.
2 changes: 1 addition & 1 deletion aspnetcore/src/ApiModels/CodeList/FieldOfArt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
///
/// http://uri.suomi.fi/codelist/research/Taiteenala
/// </summary>
public class FieldOfArts : CodeList
public class FieldOfArt : CodeList
{
}
14 changes: 7 additions & 7 deletions aspnetcore/src/ApiModels/Publication/Publication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@ public class Publication
/// </summary>
public List<FieldOfEducation>? FieldsOfEducation { get; set; }

/// <summary>
/// Field of art
///
/// http://uri.suomi.fi/codelist/research/Taiteenala
/// </summary>
public FieldOfArt? FieldOfArt { get; set; }

/// <summary>
/// Keywords
/// </summary>
Expand Down Expand Up @@ -257,13 +264,6 @@ public class Publication
/// </summary>
public License? License { get; set; }

/// <summary>
/// Field of art
///
/// http://uri.suomi.fi/codelist/research/Taiteenala
/// </summary>
public List<FieldOfArts>? FieldsOfArts { get; set; }

/// <summary>
/// Art publications type category
///
Expand Down
139 changes: 8 additions & 131 deletions aspnetcore/src/DatabaseContext/ApiDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ public ApiDbContext(DbContextOptions<ApiDbContext> options)
public virtual DbSet<DimEvent> DimEvents { get; set; } = null!;
public virtual DbSet<DimExternalService> DimExternalServices { get; set; } = null!;
public virtual DbSet<DimFieldDisplaySetting> DimFieldDisplaySettings { get; set; } = null!;
public virtual DbSet<DimFieldOfArt> DimFieldOfArts { get; set; } = null!;
public virtual DbSet<DimFieldOfEducation> DimFieldOfEducations { get; set; } = null!;
public virtual DbSet<DimFundingDecision> DimFundingDecisions { get; set; } = null!;
public virtual DbSet<DimGeo> DimGeos { get; set; } = null!;
public virtual DbSet<DimIdentifierlessDatum> DimIdentifierlessData { get; set; } = null!;
Expand Down Expand Up @@ -1056,118 +1054,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
});
});

modelBuilder.Entity<DimFieldOfArt>(entity =>
{
entity.ToTable("dim_field_of_art");

entity.Property(e => e.Id).HasColumnName("id");

entity.Property(e => e.Created)
.HasColumnType("datetime")
.HasColumnName("created");

entity.Property(e => e.FieldId)
.HasMaxLength(255)
.HasColumnName("field_id");

entity.Property(e => e.Modified)
.HasColumnType("datetime")
.HasColumnName("modified");

entity.Property(e => e.NameEn)
.HasMaxLength(255)
.HasColumnName("name_en");

entity.Property(e => e.NameFi)
.HasMaxLength(255)
.HasColumnName("name_fi");

entity.Property(e => e.NameSv)
.HasMaxLength(255)
.HasColumnName("name_sv");

entity.Property(e => e.SourceDescription)
.HasMaxLength(255)
.HasColumnName("source_description");

entity.Property(e => e.SourceId)
.HasMaxLength(255)
.HasColumnName("source_id");

entity.HasMany(d => d.DimPublications)
.WithMany(p => p.DimFieldOfArts)
.UsingEntity<Dictionary<string, object>>(
"BrFieldOfArtDimPublication",
l => l.HasOne<DimPublication>().WithMany().HasForeignKey("DimPublicationId").OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("FKbr_field_o505394"),
r => r.HasOne<DimFieldOfArt>().WithMany().HasForeignKey("DimFieldOfArtId").OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("FKbr_field_o978876"),
j =>
{
j.HasKey("DimFieldOfArtId", "DimPublicationId").HasName("PK__br_field__809A87CDC51CB6D5");

j.ToTable("br_field_of_art_dim_publication");

j.IndexerProperty<int>("DimFieldOfArtId").HasColumnName("dim_field_of_art_id");

j.IndexerProperty<int>("DimPublicationId").HasColumnName("dim_publication_id");
});
});

modelBuilder.Entity<DimFieldOfEducation>(entity =>
{
entity.ToTable("dim_field_of_education");

entity.Property(e => e.Id).HasColumnName("id");

entity.Property(e => e.Created)
.HasColumnType("datetime")
.HasColumnName("created");

entity.Property(e => e.FieldId)
.HasMaxLength(255)
.HasColumnName("field_id");

entity.Property(e => e.Modified)
.HasColumnType("datetime")
.HasColumnName("modified");

entity.Property(e => e.NameEn)
.HasMaxLength(255)
.HasColumnName("name_en");

entity.Property(e => e.NameFi)
.HasMaxLength(255)
.HasColumnName("name_fi");

entity.Property(e => e.NameSv)
.HasMaxLength(255)
.HasColumnName("name_sv");

entity.Property(e => e.SourceDescription)
.HasMaxLength(255)
.HasColumnName("source_description");

entity.Property(e => e.SourceId)
.HasMaxLength(255)
.HasColumnName("source_id");

entity.HasMany(d => d.DimPublications)
.WithMany(p => p.DimFieldOfEducations)
.UsingEntity<Dictionary<string, object>>(
"BrFieldOfEducationDimPublication",
l => l.HasOne<DimPublication>().WithMany().HasForeignKey("DimPublicationId").OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("FKbr_field_o449658"),
r => r.HasOne<DimFieldOfEducation>().WithMany().HasForeignKey("DimFieldOfEducationId").OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("FKbr_field_o983513"),
j =>
{
j.HasKey("DimFieldOfEducationId", "DimPublicationId").HasName("PK__br_field__6E377B2CD08233DA");

j.ToTable("br_field_of_education_dim_publication");

j.IndexerProperty<int>("DimFieldOfEducationId").HasColumnName("dim_field_of_education_id");

j.IndexerProperty<int>("DimPublicationId").HasColumnName("dim_publication_id");
});
});

modelBuilder.Entity<DimFundingDecision>(entity =>
{
entity.ToTable("dim_funding_decision");
Expand Down Expand Up @@ -1312,23 +1198,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FKdim_fundin974924");

entity.HasMany(d => d.DimFieldOfArts)
.WithMany(p => p.DimFundingDecisions)
.UsingEntity<Dictionary<string, object>>(
"BrFundingDecisionDimFieldOfArt",
l => l.HasOne<DimFieldOfArt>().WithMany().HasForeignKey("DimFieldOfArtId").OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("FKbr_funding154428"),
r => r.HasOne<DimFundingDecision>().WithMany().HasForeignKey("DimFundingDecisionId").OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("FKbr_funding281737"),
j =>
{
j.HasKey("DimFundingDecisionId", "DimFieldOfArtId").HasName("PK__br_fundi__07CB586D2869F096");

j.ToTable("br_funding_decision_dim_field_of_art");

j.IndexerProperty<int>("DimFundingDecisionId").HasColumnName("dim_funding_decision_id");

j.IndexerProperty<int>("DimFieldOfArtId").HasColumnName("dim_field_of_art_id");
});

entity.HasMany(d => d.DimFundingDecisionFroms)
.WithMany(p => p.DimFundingDecisionTos)
.UsingEntity<Dictionary<string, object>>(
Expand Down Expand Up @@ -2949,6 +2818,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.HasMaxLength(4000)
.HasColumnName("doi_handle");

entity.Property(e => e.FieldOfArtCode).HasColumnName("field_of_art_code");

entity.Property(e => e.GovermentCollaboration).HasColumnName("goverment_collaboration");

entity.Property(e => e.HospitalDistrictCollaboration).HasColumnName("hospital_district_collaboration");
Expand Down Expand Up @@ -3104,6 +2975,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FKdim_public896887");

entity.HasOne(d => d.FieldOfArtCodeNavigation)
.WithMany(p => p.DimPublicationFieldOfArtCodeNavigations)
.HasForeignKey(d => d.FieldOfArtCode)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("field_of_art_code");

entity.HasOne(d => d.LanguageCodeNavigation)
.WithMany(p => p.DimPublicationLanguageCodeNavigations)
.HasForeignKey(d => d.LanguageCode)
Expand Down
2 changes: 0 additions & 2 deletions aspnetcore/src/DatabaseContext/Entities/DimFundingDecision.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public DimFundingDecision()
FactDimReferencedataFieldOfSciences = new HashSet<FactDimReferencedataFieldOfScience>();
FactFieldValues = new HashSet<FactFieldValue>();
InverseDimFundingDecisionIdParentDecisionNavigation = new HashSet<DimFundingDecision>();
DimFieldOfArts = new HashSet<DimFieldOfArt>();
DimFundingDecisionFroms = new HashSet<DimFundingDecision>();
DimFundingDecisionFromsNavigation = new HashSet<DimFundingDecision>();
DimFundingDecisionTos = new HashSet<DimFundingDecision>();
Expand Down Expand Up @@ -75,7 +74,6 @@ public DimFundingDecision()
public virtual ICollection<FactFieldValue> FactFieldValues { get; set; }
public virtual ICollection<DimFundingDecision> InverseDimFundingDecisionIdParentDecisionNavigation { get; set; }

public virtual ICollection<DimFieldOfArt> DimFieldOfArts { get; set; }
public virtual ICollection<DimFundingDecision> DimFundingDecisionFroms { get; set; }
public virtual ICollection<DimFundingDecision> DimFundingDecisionFromsNavigation { get; set; }
public virtual ICollection<DimFundingDecision> DimFundingDecisionTos { get; set; }
Expand Down
6 changes: 2 additions & 4 deletions aspnetcore/src/DatabaseContext/Entities/DimPublication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ public DimPublication()
FactContributions = new HashSet<FactContribution>();
FactDimReferencedataFieldOfSciences = new HashSet<FactDimReferencedataFieldOfScience>();
FactFieldValues = new HashSet<FactFieldValue>();
DimFieldOfArts = new HashSet<DimFieldOfArt>();
DimFieldOfEducations = new HashSet<DimFieldOfEducation>();
DimKeywords = new HashSet<DimKeyword>();
DimReferencedata = new HashSet<DimReferencedatum>();
}
Expand Down Expand Up @@ -77,9 +75,11 @@ public DimPublication()
public string? OpenAccess { get; set; }
public string? PublisherOpenAccessCode { get; set; }
public string? Abstract { get; set; }
public int FieldOfArtCode { get; set; }

public virtual DimReferencedatum? ArticleTypeCodeNavigation { get; set; }
public virtual DimRegisteredDataSource DimRegisteredDataSource { get; set; } = null!;
public virtual DimReferencedatum FieldOfArtCodeNavigation { get; set; } = null!;
public virtual DimReferencedatum LanguageCodeNavigation { get; set; } = null!;
public virtual DimReferencedatum LicenseCodeNavigation { get; set; } = null!;
public virtual DimReferencedatum? ParentPublicationTypeCodeNavigation { get; set; }
Expand All @@ -94,8 +94,6 @@ public DimPublication()
public virtual ICollection<FactDimReferencedataFieldOfScience> FactDimReferencedataFieldOfSciences { get; set; }
public virtual ICollection<FactFieldValue> FactFieldValues { get; set; }

public virtual ICollection<DimFieldOfArt> DimFieldOfArts { get; set; }
public virtual ICollection<DimFieldOfEducation> DimFieldOfEducations { get; set; }
public virtual ICollection<DimKeyword> DimKeywords { get; set; }
public virtual ICollection<DimReferencedatum> DimReferencedata { get; set; }
}
Expand Down
2 changes: 2 additions & 0 deletions aspnetcore/src/DatabaseContext/Entities/DimReferencedatum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public DimReferencedatum()
DimProfileOnlyPublicationThesisTypeCodeNavigations = new HashSet<DimProfileOnlyPublication>();
DimProfileOnlyPublicationTypeClassificationCodeNavigations = new HashSet<DimProfileOnlyPublication>();
DimPublicationArticleTypeCodeNavigations = new HashSet<DimPublication>();
DimPublicationFieldOfArtCodeNavigations = new HashSet<DimPublication>();
DimPublicationLanguageCodeNavigations = new HashSet<DimPublication>();
DimPublicationLicenseCodeNavigations = new HashSet<DimPublication>();
DimPublicationParentPublicationTypeCodeNavigations = new HashSet<DimPublication>();
Expand Down Expand Up @@ -76,6 +77,7 @@ public DimReferencedatum()
public virtual ICollection<DimProfileOnlyPublication> DimProfileOnlyPublicationThesisTypeCodeNavigations { get; set; }
public virtual ICollection<DimProfileOnlyPublication> DimProfileOnlyPublicationTypeClassificationCodeNavigations { get; set; }
public virtual ICollection<DimPublication> DimPublicationArticleTypeCodeNavigations { get; set; }
public virtual ICollection<DimPublication> DimPublicationFieldOfArtCodeNavigations { get; set; }
public virtual ICollection<DimPublication> DimPublicationLanguageCodeNavigations { get; set; }
public virtual ICollection<DimPublication> DimPublicationLicenseCodeNavigations { get; set; }
public virtual ICollection<DimPublication> DimPublicationParentPublicationTypeCodeNavigations { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion aspnetcore/src/Interface/Interface.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>fb1549e6-e7b1-45b6-91cb-dfebd31eadb8</UserSecretsId>
<UserSecretsId>b73bde99-06bf-406c-8e60-eb475cb00acc</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..\src\Api</DockerfileContext>
<DockerfileFile>..\..\openshift\api\Dockerfile</DockerfileFile>
Expand Down
2 changes: 1 addition & 1 deletion aspnetcore/src/Interface/Maps/PublicationProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public PublicationProfile()
CreateMap<Service.Models.ReferenceData, JufoClass>();
CreateMap<Service.Models.ReferenceData, FieldOfScience>();
CreateMap<Service.Models.ReferenceData, FieldOfEducation>();
CreateMap<Service.Models.ReferenceData, FieldOfArts>();
CreateMap<Service.Models.ReferenceData, FieldOfArt>();
CreateMap<Service.Models.ReferenceData, ArticleType>();
CreateMap<Service.Models.ReferenceData, ArtPublicationTypeCategory>();
CreateMap<Service.Models.ReferenceData, PublicationStatus>();
Expand Down
4 changes: 2 additions & 2 deletions aspnetcore/src/Repositories/Maps/PublicationProfile.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using CSC.PublicApi.DatabaseContext.Entities;
using CSC.PublicApi.Service.Models;
using CSC.PublicApi.Service.Models.Publication;
using Microsoft.Data.SqlClient;
using FactContribution = CSC.PublicApi.Service.Models.Publication.FactContribution;
using Name = CSC.PublicApi.Service.Models.Publication.Name;
using Profile = AutoMapper.Profile;
Expand Down Expand Up @@ -54,7 +55,7 @@ public PublicationProfile()
.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)))
.ForMember(dst => dst.FieldsOfEducation, opt => opt.MapFrom(src => src.DimFieldOfEducations))
.ForMember(dst => dst.FieldOfArt, opt => opt.MapFrom(src => src.FieldOfArtCodeNavigation))
.ForMember(dst => dst.Keywords, opt => opt.MapFrom(src => src.DimKeywords))
.ForMember(dst => dst.InternationalPublication, opt => opt.MapFrom(src => src.InternationalPublication != 9 ? src.InternationalPublication == 1 : (bool?)null)) // 0 = kotim. 1 ulkom. 9 = ei tietoa.
.ForMember(dst => dst.Country, opt => opt.MapFrom(src => src.PublicationCountryCodeNavigation))
Expand All @@ -67,7 +68,6 @@ public PublicationProfile()
.ForMember(dst => dst.License, opt => opt.MapFrom(src => src.LicenseCodeNavigation.Id != -1 ? src.LicenseCodeNavigation : null))
.ForMember(dst => dst.Preprint, opt => opt.MapFrom(src => src.DimLocallyReportedPubInfos.Where(i => i.SelfArchivedType == PreprintType)))
.ForMember(dst => dst.SelfArchived, opt => opt.MapFrom(src => src.DimLocallyReportedPubInfos.Where(i => i.SelfArchivedType == SelfArchivedType)))
.ForMember(dst => dst.FieldsOfArts, opt => opt.MapFrom(src => src.DimFieldOfArts))
.ForMember(dst => dst.ArtPublicationTypeCategory, opt => opt.MapFrom(src => src.DimReferencedata))
.ForMember(dst => dst.Abstract, opt => opt.MapFrom(src => src.Abstract))
.ForMember(dst => dst.Created, opt => opt.MapFrom(src => src.Created))
Expand Down
10 changes: 5 additions & 5 deletions aspnetcore/src/Service.Models/Publication/Publication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ public class Publication
/// </summary>
public List<ReferenceData>? FieldsOfEducation { get; set; }

/// <summary>
/// Taiteenala
/// </summary>
public ReferenceData? FieldOfArt { get; set; }

/// <summary>
/// Avainsanat
/// </summary>
Expand Down Expand Up @@ -232,11 +237,6 @@ public class Publication
/// </summary>
public ReferenceData? License { get; set; }

/// <summary>
/// Taiteenala
/// </summary>
public List<ReferenceData>? FieldsOfArts { get; set; }

/// <summary>
/// TaidealanTyyppiKategoria
/// </summary>
Expand Down
33 changes: 5 additions & 28 deletions aspnetcore/test/Indexer.Tests/Maps/PublicationProfileTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,6 @@ private static DimPublication GetEntity()
JufoClassCode = "jufoClassCode",
Doi = "doi",
DoiHandle = "doiHandle",
DimFieldOfEducations = new List<DimFieldOfEducation>
{
new()
{
FieldId = "foeFieldId",
NameFi = "foeNameFi",
NameSv = "foeNameSv",
NameEn = "foeNameEn"
}
},
DimReferencedata = new List<DimReferencedatum>
{
new()
Expand Down Expand Up @@ -258,16 +248,6 @@ private static DimPublication GetEntity()
SelfArchivedType = "preprint"
}
},
DimFieldOfArts = new List<DimFieldOfArt>
{
new()
{
FieldId = "fieldOfArtsId",
NameFi = "fieldOfArtsNameFi",
NameSv = "fieldOfArtsNameSv",
NameEn = "fieldOfArtsNameEn"
}
},
Abstract = "abstract",
Created = new DateTime(2023, 3, 10, 10, 43, 00),
Modified = new DateTime(2023, 3, 10, 10, 44, 00)
Expand Down Expand Up @@ -463,15 +443,12 @@ private Publication GetModel()
EmbargoDate = new DateTime(2023, 3, 10, 10, 40, 00)
}
},
FieldsOfArts = new List<ReferenceData>
FieldOfArt = new ReferenceData()
{
new()
{
Code = "fieldOfArtsId",
NameFi = "fieldOfArtsNameFi",
NameSv = "fieldOfArtsNameSv",
NameEn = "fieldOfArtsNameEn"
}
Code = "123",
NameEn = "fieldOfArtCodeNameEn",
NameFi = "fieldOfArtCodeNameFi",
NameSv = "fieldOfArtCodeNameSv",
},
Abstract = "abstract",
ArtPublicationTypeCategory = new List<ReferenceData>
Expand Down
Loading

0 comments on commit 10d582d

Please sign in to comment.