Add parsing for LeafInputData after retrieving CleanedInput files

This commit is contained in:
2016-05-19 07:45:53 -04:00
parent 77ae03534e
commit cff6a0d96f
18 changed files with 433 additions and 8 deletions
+7
View File
@@ -99,6 +99,10 @@
<Compile Include="Migrations\201605161458209_LeafOutputFileType.Designer.cs">
<DependentUpon>201605161458209_LeafOutputFileType.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\201605191138068_LeafInputData.cs" />
<Compile Include="Migrations\201605191138068_LeafInputData.Designer.cs">
<DependentUpon>201605191138068_LeafInputData.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\Configuration.cs" />
<Compile Include="Parsers\LeafGasComparisonParser.cs" />
<Compile Include="Remote\IPiscalClient.cs" />
@@ -152,6 +156,9 @@
<EmbeddedResource Include="Migrations\201605161458209_LeafOutputFileType.resx">
<DependentUpon>201605161458209_LeafOutputFileType.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\201605191138068_LeafInputData.resx">
<DependentUpon>201605191138068_LeafInputData.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+4
View File
@@ -14,6 +14,10 @@ namespace LeafWeb.Core.DAL
public DbSet<FluxnetSite> FluxnetSites { get; set; }
public DbSet<PhotosynthesisType> PhotosynthesisTypes { get; set; }
public DbSet<LeafOutputFile> LeafOutputFiles { get; set; }
public DbSet<LeafInputData> LeafInputData { get; set; }
public DbSet<LeafInputDataCurve> LeafInputDataCurves { get; set; }
public DbSet<LeafInputDataPhotosynthetic> LeafInputDataPhotosynthetic { get; set; }
public DbSet<LeafInputDataSite> LeafInputDataSite { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
@@ -25,6 +25,12 @@ namespace LeafWeb.Core.Entities
/// </summary>
[ParseInfo(2, boolEncodedPosition: 1, alternateTitle: "FitRwp|Rch|ha?")] // formerly FitGi
public bool FitRwp {get; set;}
/// <summary>
/// TODO? : boolEncodedPosition only able to parse a single value from each cell currently
/// </summary>
//[ParseInfo(2, boolEncodedPosition: 2, alternateTitle: "FitRwp|Rch|ha?")] // formerly FitGi
//public bool FitRch {get; set;}
/// <summary>
/// whether or not the chloroplastic CO2 partial pressure photocompensation point is
+1
View File
@@ -16,6 +16,7 @@ namespace LeafWeb.Core.Entities
public virtual ICollection<LeafOutputFile> OutputFiles { get; set; }
public LeafOutputFile OutputErrorMessage => OutputFiles?.FirstOrDefault(f => f.IsErrorMessage);
public LeafOutputFile OutputWarningMessage => OutputFiles?.FirstOrDefault(f => f.IsWarningMessage);
public virtual ICollection<LeafInputData> LeafInputData { get; set; }
public LeafInputStatusType CurrentStatus { get; set; }
public virtual ICollection<LeafInputStatus> StatusHistory { get; set; }
+12
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using LeafWeb.Core.Utility;
namespace LeafWeb.Core.Entities
@@ -9,11 +10,22 @@ namespace LeafWeb.Core.Entities
/// </summary>
public class LeafInputData
{
[ForeignKey("LeafOutputFile")]
public int Id { get; set; }
public virtual LeafInputDataSite Site { get; set; }
public virtual LeafInputDataPhotosynthetic Photosynthetic { get; set; }
public virtual ICollection<LeafInputDataCurve> Data { get; set; }
/// <summary>
/// Leaf Input set this data belongs to
/// </summary>
public virtual LeafInput LeafInput { get; set; }
/// <summary>
/// Output file this data was parsed from
/// </summary>
public virtual LeafOutputFile LeafOutputFile { get; set; }
[ParseInfo(1, exampleValue: "First and last name")]
public string InvestigatorName { get; set; }
+1 -1
View File
@@ -10,7 +10,7 @@ namespace LeafWeb.Core.Entities
{
public int Id { get; set; }
public virtual LeafInputData LeafInputInfo { get; set; }
public virtual LeafInputData LeafInputData { get; set; }
public int ListOrder { get; set; }
+4 -2
View File
@@ -1,4 +1,5 @@
using LeafWeb.Core.Utility;
using System.ComponentModel.DataAnnotations.Schema;
using LeafWeb.Core.Utility;
namespace LeafWeb.Core.Entities
{
@@ -7,9 +8,10 @@ namespace LeafWeb.Core.Entities
/// </summary>
public class LeafInputDataPhotosynthetic
{
[ForeignKey("LeafInputData")]
public int Id { get; set; }
public virtual LeafInputData LeafInputInfo { get; set; }
public virtual LeafInputData LeafInputData { get; set; }
/// <summary>chloroplastic CO2 photocompensation point</summary>
/// <remarks>must be positive</remarks>
+4 -2
View File
@@ -1,4 +1,5 @@
using LeafWeb.Core.Utility;
using System.ComponentModel.DataAnnotations.Schema;
using LeafWeb.Core.Utility;
namespace LeafWeb.Core.Entities
{
@@ -7,9 +8,10 @@ namespace LeafWeb.Core.Entities
/// </summary>
public class LeafInputDataSite
{
[ForeignKey("LeafInputData")]
public int Id { get; set; }
public virtual LeafInputData LeafInputInfo { get; set; }
public virtual LeafInputData LeafInputData { get; set; }
/// <summary>Site identifier</summary>
/// <remarks>do not leave blank between letters</remarks>
+9 -1
View File
@@ -12,10 +12,18 @@ namespace LeafWeb.Core.Entities
public virtual LeafInput LeafInput { get; set; }
public string Filename { get; set; }
/// <summary>
/// CleanedInput files will be parsed and data stored here
/// </summary>
public virtual LeafInputData LeafInputData { get; set; }
/// <summary>
/// ToUser, NotToUser, CleanedInput
/// </summary>
public LeafOutputFileType FileType { get; set; }
public string Filename { get; set; }
public byte[] Contents { get; set; }
public bool IsLeafChartFile => Filename?.Contains(Filename_LeafChart) ?? false;
@@ -0,0 +1,29 @@
// <auto-generated />
namespace LeafWeb.Core.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class LeafInputData : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(LeafInputData));
string IMigrationMetadata.Id
{
get { return "201605191138068_LeafInputData"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -0,0 +1,141 @@
namespace LeafWeb.Core.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class LeafInputData : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.LeafInputData",
c => new
{
Id = c.Int(nullable: false),
InvestigatorName = c.String(),
ContactInformation = c.String(),
SiteName = c.String(),
VegetationType = c.String(),
SoilType = c.String(),
MajorSpecies = c.String(),
SampleLeafLightEnv = c.String(),
WaterStressAssessment = c.String(),
InstrumentUsed = c.String(),
ExtraInfo = c.String(),
LeafInput_Id = c.Int(),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.LeafInput", t => t.LeafInput_Id)
.ForeignKey("dbo.LeafOutputFile", t => t.Id)
.Index(t => t.Id)
.Index(t => t.LeafInput_Id);
CreateTable(
"dbo.LeafInputDataCurve",
c => new
{
Id = c.Int(nullable: false, identity: true),
ListOrder = c.Int(nullable: false),
Obs = c.Double(),
HHMMSS = c.String(maxLength: 8),
FTime = c.Double(),
Photo = c.Double(),
AdjPhoto = c.Double(),
StomCond = c.Double(),
Ci = c.Double(),
Trmmol = c.Double(),
VpdL = c.Double(),
Area = c.Double(),
StmRat = c.Double(),
BLCond = c.Double(),
Tair = c.Double(),
Tleaf = c.Double(),
TBlk = c.Double(),
CO2R = c.Double(),
CO2S = c.Double(),
H2OR = c.Double(),
H2OS = c.Double(),
RH_R = c.Double(),
RH_S = c.Double(),
Flow = c.Double(),
PARi = c.Double(),
PARo = c.Double(),
Press = c.Double(),
CsMch = c.Double(),
HsMch = c.Double(),
StableF = c.Double(),
Status = c.String(),
PhiPS2 = c.Double(),
OxygenPress = c.Double(),
LeafInputData_Id = c.Int(),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.LeafInputData", t => t.LeafInputData_Id)
.Index(t => t.LeafInputData_Id);
CreateTable(
"dbo.LeafInputDataPhotosynthetic",
c => new
{
Id = c.Int(nullable: false),
GammaStar = c.Double(nullable: false),
Kc = c.Double(nullable: false),
Ko = c.Double(nullable: false),
Alpha = c.Double(nullable: false),
Rd = c.Double(nullable: false),
gi = c.Double(nullable: false),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.LeafInputData", t => t.Id)
.Index(t => t.Id);
CreateTable(
"dbo.LeafInputDataSite",
c => new
{
Id = c.Int(nullable: false),
SiteId = c.String(),
Latitude = c.Double(),
Longitude = c.Double(),
Elevation = c.Double(),
SampleYear = c.Int(),
SampleDayOfYear = c.Int(),
GrowSeasonStart = c.Int(),
GrowSeasonEnd = c.Int(),
StandAge = c.Double(),
CanopyHeight = c.Double(),
LeafAreaIndex = c.Double(),
SpeciesSampled = c.String(),
AverageTimeResolution = c.Double(),
SampleHeight = c.Double(),
LeafAge = c.Int(),
SpecificLeafArea = c.Double(),
LfNitrogenContent = c.Double(),
LfCarbonContent = c.Double(),
LfPhosphContent = c.Double(),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.LeafInputData", t => t.Id)
.Index(t => t.Id);
}
public override void Down()
{
DropForeignKey("dbo.LeafInputDataSite", "Id", "dbo.LeafInputData");
DropForeignKey("dbo.LeafInputDataPhotosynthetic", "Id", "dbo.LeafInputData");
DropForeignKey("dbo.LeafInputData", "Id", "dbo.LeafOutputFile");
DropForeignKey("dbo.LeafInputData", "LeafInput_Id", "dbo.LeafInput");
DropForeignKey("dbo.LeafInputDataCurve", "LeafInputData_Id", "dbo.LeafInputData");
DropIndex("dbo.LeafInputDataSite", new[] { "Id" });
DropIndex("dbo.LeafInputDataPhotosynthetic", new[] { "Id" });
DropIndex("dbo.LeafInputDataCurve", new[] { "LeafInputData_Id" });
DropIndex("dbo.LeafInputData", new[] { "LeafInput_Id" });
DropIndex("dbo.LeafInputData", new[] { "Id" });
DropTable("dbo.LeafInputDataSite");
DropTable("dbo.LeafInputDataPhotosynthetic");
DropTable("dbo.LeafInputDataCurve");
DropTable("dbo.LeafInputData");
}
}
}
File diff suppressed because one or more lines are too long
+4
View File
@@ -13,6 +13,10 @@ namespace LeafWeb.Core.Parsers
{
}
public LeafInputCsvParser(byte[] fileContents) : base(fileContents)
{
}
public LeafInputData Parse()
{
// First 10 lines