Skip to content

Commit

Permalink
Release 1.28 (#211)
Browse files Browse the repository at this point in the history
* Update TTV database context, field of art (#207)

* Limit ORCID research activity name to max allowed value in database (#208)

* Update TTV database context, field of art corrected database schema (#209)

* TTV model update fact_dim_referencedata_field_of_art.dim_publication_id (#210)
  • Loading branch information
sarkikos authored Oct 24, 2023
1 parent 8b3c617 commit f4864f5
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 140 deletions.
2 changes: 0 additions & 2 deletions aspnetcore/src/api/Models/Ttv/DimFundingDecision.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ public partial class DimFundingDecision

public virtual ICollection<DimFundingDecision> InverseDimFundingDecisionIdParentDecisionNavigation { get; set; } = new List<DimFundingDecision>();

public virtual ICollection<DimFieldOfArt> DimFieldOfArts { get; set; } = new List<DimFieldOfArt>();

public virtual ICollection<DimFundingDecision> DimFundingDecisionFroms { get; set; } = new List<DimFundingDecision>();

public virtual ICollection<DimFundingDecision> DimFundingDecisionFromsNavigation { get; set; } = new List<DimFundingDecision>();
Expand Down
6 changes: 2 additions & 4 deletions aspnetcore/src/api/Models/Ttv/DimPublication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,9 @@ public partial class DimPublication

public virtual DimReferencedatum ThesisTypeCodeNavigation { get; set; }

public virtual ICollection<DimFieldOfArt> DimFieldOfArts { get; set; } = new List<DimFieldOfArt>();

public virtual ICollection<DimFieldOfEducation> DimFieldOfEducations { get; set; } = new List<DimFieldOfEducation>();

public virtual ICollection<DimKeyword> DimKeywords { get; set; } = new List<DimKeyword>();

public virtual ICollection<DimReferencedatum> DimReferencedata { get; set; } = new List<DimReferencedatum>();

public virtual ICollection<DimReferencedatum> DimReferencedataNavigation { get; set; } = new List<DimReferencedatum>();
}
2 changes: 2 additions & 0 deletions aspnetcore/src/api/Models/Ttv/DimReferencedatum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,7 @@ public partial class DimReferencedatum

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

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

public virtual ICollection<DimResearchDataset> DimResearchDatasets { get; set; } = new List<DimResearchDataset>();
}
152 changes: 19 additions & 133 deletions aspnetcore/src/api/Models/Ttv/TtvContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ public TtvContext(DbContextOptions<TtvContext> options)

public virtual DbSet<DimFieldDisplaySetting> DimFieldDisplaySettings { get; set; }

public virtual DbSet<DimFieldOfArt> DimFieldOfArts { get; set; }

public virtual DbSet<DimFieldOfEducation> DimFieldOfEducations { get; set; }

public virtual DbSet<DimFundingDecision> DimFundingDecisions { get; set; }

public virtual DbSet<DimGeo> DimGeos { get; set; }
Expand Down Expand Up @@ -960,116 +956,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
});
});

modelBuilder.Entity<DimFieldOfArt>(entity =>
{
entity.HasKey(e => e.Id).HasName("PK__dim_fiel__3213E83F4D9A7338");

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)
.IsRequired()
.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)
.IsRequired()
.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)
.IsRequired()
.HasMaxLength(255)
.HasColumnName("source_id");

entity.HasMany(d => d.DimPublications).WithMany(p => p.DimFieldOfArts)
.UsingEntity<Dictionary<string, object>>(
"BrFieldOfArtDimPublication",
r => r.HasOne<DimPublication>().WithMany()
.HasForeignKey("DimPublicationId")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FKbr_field_o505394"),
l => l.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.HasKey(e => e.Id).HasName("PK__dim_fiel__3213E83FDDB2A932");

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)
.IsRequired()
.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)
.IsRequired()
.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)
.IsRequired()
.HasMaxLength(255)
.HasColumnName("source_id");

entity.HasMany(d => d.DimPublications).WithMany(p => p.DimFieldOfEducations)
.UsingEntity<Dictionary<string, object>>(
"BrFieldOfEducationDimPublication",
r => r.HasOne<DimPublication>().WithMany()
.HasForeignKey("DimPublicationId")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FKbr_field_o449658"),
l => l.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.HasKey(e => e.Id).HasName("PK__dim_fund__3213E83FC754B6DF");
Expand Down Expand Up @@ -1178,25 +1064,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",
r => r.HasOne<DimFieldOfArt>().WithMany()
.HasForeignKey("DimFieldOfArtId")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FKbr_funding154428"),
l => l.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>>(
"BrPreviousFundingDecision",
Expand Down Expand Up @@ -2850,6 +2717,25 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.HasForeignKey(d => d.DimReferencedataId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_dim_referencedata_dim_referencedata");

entity.HasMany(d => d.DimPublicationsNavigation).WithMany(p => p.DimReferencedataNavigation)
.UsingEntity<Dictionary<string, object>>(
"FactDimReferencedataFieldOfArt",
r => r.HasOne<DimPublication>().WithMany()
.HasForeignKey("DimPublicationId")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("field_of_art_code"),
l => l.HasOne<DimReferencedatum>().WithMany()
.HasForeignKey("DimReferencedataId")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FKfact_dim_r130466"),
j =>
{
j.HasKey("DimReferencedataId", "DimPublicationId").HasName("PK__fact_dim__FD761943629A8020");
j.ToTable("fact_dim_referencedata_field_of_art");
j.IndexerProperty<int>("DimReferencedataId").HasColumnName("dim_referencedata_id");
j.IndexerProperty<int>("DimPublicationId").HasColumnName("dim_publication_id");
});
});

modelBuilder.Entity<DimRegisteredDataSource>(entity =>
Expand Down
4 changes: 3 additions & 1 deletion aspnetcore/src/api/Services/OrcidJsonParserService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,8 @@ public OrcidWorks GetWorks(String json, bool processOnlyResearchActivities=false
"" : workElement.GetProperty("url").GetProperty("value").GetString();

string workType = workElement.GetProperty("type").GetString();
string name = workElement.GetProperty("title").GetProperty("title").GetProperty("value").GetString();
name = name.Length > 255 ? name.Substring(0, 255) : name; // Database size 255

// Import only one element from "work-summary" array.
orcidWorks.ResearchActivities.Add(
Expand All @@ -672,7 +674,7 @@ public OrcidWorks GetWorks(String json, bool processOnlyResearchActivities=false
disambiguatedOrganizationIdentifier: "",
disambiguationSource: "",
departmentName: "",
name: workElement.GetProperty("title").GetProperty("title").GetProperty("value").GetString(),
name: name,
startDate: GetOrcidDate(workElement.GetProperty("publication-date")),
endDate: new OrcidDate(),
putCode: this.GetOrcidPutCode(workElement),
Expand Down

0 comments on commit f4864f5

Please sign in to comment.