Rename Core Models to Core Entities

modified:   Core.Tests/Charter/CurveDataConverterTests.cs
	modified:   Core.Tests/Parsers/CntrlComparisonParserTests.cs
	modified:   Core.Tests/Parsers/LeafInputCsvParserTests.cs
	modified:   Core.Tests/Remote/PiscalSshClientTests.cs
	modified:   Core/Charter/CurveDataConverter.cs
	modified:   Core/Core.csproj
	modified:   Core/DAL/DataService.cs
	modified:   Core/DAL/LeafWebContext.cs
	modified:   Core/DAL/LeafWebInitializer.cs
	renamed:    Core/Models/CntrlComparison.cs -> Core/Entities/CntrlComparison.cs
	renamed:    Core/Models/CntrlComparisonFittingInfo.cs -> Core/Entities/CntrlComparisonFittingInfo.cs
	renamed:    Core/Models/CntrlComparisonPhotosyntheticInfo.cs -> Core/Entities/CntrlComparisonPhotosyntheticInfo.cs
	renamed:    Core/Models/FluxnetSite.cs -> Core/Entities/FluxnetSite.cs
	renamed:    Core/Models/LeafInput.cs -> Core/Entities/LeafInput.cs
	renamed:    Core/Models/LeafInputData.cs -> Core/Entities/LeafInputData.cs
	renamed:    Core/Models/LeafInputFile.cs -> Core/Entities/LeafInputFile.cs
	renamed:    Core/Models/LeafInputInfo.cs -> Core/Entities/LeafInputInfo.cs
	renamed:    Core/Models/LeafInputPhotosynthetic.cs -> Core/Entities/LeafInputPhotosynthetic.cs
	renamed:    Core/Models/LeafInputSite.cs -> Core/Entities/LeafInputSite.cs
	renamed:    Core/Models/LeafInputStatus.cs -> Core/Entities/LeafInputStatus.cs
	renamed:    Core/Models/PhotosynthesisType.cs -> Core/Entities/PhotosynthesisType.cs
	modified:   Core/Parsers/CntrlComparisonParser.cs
	modified:   Core/Parsers/FluxnetSiteCsvParser.cs
	modified:   Core/Parsers/LeafInputCsvParser.cs
	modified:   Web/Controllers/LeafCharterController.cs
	modified:   Web/Controllers/LeafInputController.cs
	modified:   Web/ViewModels/LeafInput/CreateViewModel.cs
This commit is contained in:
2016-02-09 13:49:08 -05:00
parent d101c2294f
commit 279551e9be
28 changed files with 44 additions and 53 deletions
+22
View File
@@ -0,0 +1,22 @@
using System.Collections.Generic;
using System.Linq;
namespace LeafWeb.Core.Entities
{
/// <summary>
/// Part of LeafOutput
/// The file 'cntrlcomparison.csv', which is in comma-separated-value format, contains outputs from PISCAL that
/// facilitates examination of how well the fitting is.
/// </summary>
public class CntrlComparison
{
public virtual IEnumerable<CntrlComparisonFittingInfo> FittingInfo { get; set; }
public virtual IEnumerable<CntrlComparisonPhotosyntheticInfo> PhotosyntheticInfo { get; set; }
public string CurveID => FittingInfo.First().CurveID;
public bool FitGi => FittingInfo.First().FitGi;
public bool FitGammaStar => FittingInfo.First().FitGammaStar;
}
}
+117
View File
@@ -0,0 +1,117 @@
using LeafWeb.Core.Utility;
namespace LeafWeb.Core.Entities
{
/// <summary>
/// First model prediction is calculated at each sampling point.
/// Then model prediction is calculated at many selected levels of intercelluar CO2 partial pressure
/// levels under three limitation states to enable plotting curves.The same structure is then repeated for
/// each fitting of the same curve with different parameters to be estimated and with different curves. Note
/// that some common information about a curve is repeated for each data point to make the structure of the
/// file as regular as possible.
/// </summary>
public class CntrlComparisonFittingInfo
{
/// <summary>
/// the curve identifier, repeated for each point
/// </summary>
[ParseInfo(1)]
public string CurveID { get; set; }
/// <summary>
/// whether or not chlorophyll fluorescence data are used for identifying the limitation states
/// 0 = not used, 1 = used. (Currently this choice is still under evaluation and therefore ChlFlUse? = 0).
/// </summary>
[ParseInfo(2, alternateTitle: "ChlFlUse?")]
public bool ChlFlUse {get; set; }
/// <summary>
/// whether or not the internal conductance (gi) is fitted for.
/// 0 = not fitted and gi is either infinite or fixed at the value provided by the user.
/// 1 = gi is estiamted, repeated for each point
/// </summary>
[ParseInfo(3, alternateTitle: "FitGi?")]
public bool FitGi {get; set;}
/// <summary>
/// whether or not the chloroplastic CO2 partial pressure photocompensation point is
/// fitted for. 0= not fitted, a prescribed value is used, repeated for each point
/// </summary>
[ParseInfo(4, alternateTitle: "FitGamma*?")]
public bool FitGammaStar {get; set; }
/// <summary>
/// whether or not the apparent Michaelis - Menten constant Kco = Kc(1+O/Ko) is fitted for.
/// 0= not fitted, a prescribed value is calculated from Kc, Ko and the oxygen partial pressure.
/// 1= Fitted for, repeated for each point
/// </summary>
[ParseInfo(5, alternateTitle: "FitKco?")]
public bool FitKco {get; set; }
/// <summary>
/// whether the dark respiration is fitted for. 0= not fitted for, a prescribed value is used.
/// 1= fitted for. repeated for each point
/// </summary>
[ParseInfo(6, alternateTitle: "FitRd?")]
public bool FitRd {get; set;}
/// <summary>
/// whether alpha (the non-returned fraction of the glycolate carbon
/// recycled in the photorespiratory cycle) is fitted for.
/// 0= not fitted for and alpha = 0
/// 1= fitted for, repeated for each point
/// </summary>
[ParseInfo(7, alternateTitle: "FitAlpha?")]
public bool FitAlpha {get; set;}
/// <summary>
/// the combination of limitation states present in the A/Ci dataset. Parameters
/// are estimated for those limitation states that occur in the measured curve, repeated for each point
/// Rubisco: Rubisco limitation(Vcmax, Kco)
/// RuBP: RuBP regeneration limitation(J)
/// Tpu: export limitation(TPU, alpha)
/// </summary>
[ParseInfo(8)]
public string LimitCombina { get; set; }
/// <summary>
/// intercellular CO2 partial pressure
/// </summary>
[ParseInfo(9, units:"Pa")]
public double PCO2i { get; set; }
/// <summary>
/// chloroplastic CO2 partial pressure corresponding to the PCO2i of a point.
/// PCO2c=PCO2i-AnetCal/internal conductance
/// </summary>
[ParseInfo(10, units:"Pa")]
public double PCO2c { get; set; }
/// <summary>
/// measured net assimilation rate
/// </summary>
[ParseInfo(11, units: "umol/m2/s")]
public double AnetMeas { get; set; }
/// <summary>
/// calculated net assimilation rate
/// </summary>
[ParseInfo(12, units: "umol/m2/s")]
public double AnetCal { get; set; }
// TODO: readme has weitedrms, data file has PCOiCal
// weitedrms - (umol/m2/s), root mean square error of the fitting (weiting coefficient =1)
[ParseInfo(13)]
public double PCOiCal { get; set; }
/// <summary>
/// 1 = point limited by rubisco
/// 2 = point limited by RuBP regeneration
/// 3 = point limited by TPU
/// </summary>
[ParseInfo(14, units:"1,2,3")]
public int PointLimitType { get; set; }
public virtual CntrlComparison CntrlComparison { get; set; }
}
}
@@ -0,0 +1,55 @@
using LeafWeb.Core.Utility;
namespace LeafWeb.Core.Entities
{
/// <summary>
/// The second section gives photosynthesis for each of the three limitation states at selected values of intercellular
/// partial pressure.Note that the corresponding values of chloraplastic CO2 partial pressure depend on the limitation state.
/// </summary>
public class CntrlComparisonPhotosyntheticInfo
{
/// <summary>
/// intercellular CO2 partial pressure
/// </summary>
[ParseInfo(1, units:"Pa")]
public double CO2i { get; set; }
/// <summary>
/// Chloraplastic CO2 partial pressure for Rubisco limited photosynthesis
/// </summary>
[ParseInfo(2, units: "Pa")]
public double CO2cc { get; set; }
/// <summary>
/// Rubisco-limited net assimilation rate calculated with the optimized parameters
/// </summary>
[ParseInfo(3, units: "umol/m2/s")]
public double Ac { get; set; }
/// <summary>
/// Chloraplastic CO2 partial pressure for RuBP regeneration limited photosynthesis
/// </summary>
[ParseInfo(4, units:"Pa")]
public double CO2cj { get; set; }
/// <summary>
/// RuBP regeneration-limited net assimilation rate calculated with estimated parameters
/// </summary>
[ParseInfo(5, units: "umol/m2/s")]
public double Aj { get; set; }
/// <summary>
/// Chloraplastic CO2 partial pressure for export limited photosynthesis
/// </summary>
[ParseInfo(6, units: "Pa")]
public double CO2ct { get; set; }
/// <summary>
/// TPU-limited net assimilation rate calculated with estimated parameters
/// </summary>
[ParseInfo(7, units: "umol/m2/s")]
public double At { get; set; }
public virtual CntrlComparison CntrlComparison { get; set; }
}
}
+18
View File
@@ -0,0 +1,18 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace LeafWeb.Core.Entities
{
public class FluxnetSite
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public string FluxnetId { get; set; }
public string SiteName { get; set; }
public string Country { get; set; }
public string LandUnit { get; set; }
}
}
+36
View File
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace LeafWeb.Core.Entities
{
public class LeafInput
{
public int Id { get; set; }
public virtual ICollection<LeafInputFile> LeafInputFiles { get; set; }
public virtual ICollection<LeafInputStatus> LeafInputStatuses { get; set; }
[Required(ErrorMessage = "Name required")]
public string Name { get; set; }
[Required(ErrorMessage = "An email address is required")]
public string Email { get; set; }
[Required(ErrorMessage = "A unique identifier is required")]
public string Identifier { get; set; }
[Required(ErrorMessage = "")]
public string SiteId { get; set; }
[Required(ErrorMessage = "PhotosynthesisType required")]
public virtual PhotosynthesisType PhotosynthesisType { get; set; }
[DataType(DataType.Date)]
[Required]
public DateTime Created { get; set; }
[DataType(DataType.Date)]
public DateTime? Processed { get; set; }
}
}
+147
View File
@@ -0,0 +1,147 @@
using System.ComponentModel.DataAnnotations;
using LeafWeb.Core.Utility;
namespace LeafWeb.Core.Entities
{
/// <summary>
/// A/Ci data for a variety of analyses, including photosynthesis, stomatal conductance, internal conductance, water use efficiency.
/// </summary>
public class LeafInputData
{
public int Id { get; set; }
public virtual LeafInputInfo LeafInputInfo { get; set; }
public int ListOrder { get; set; }
/// <summary>the data point No.</summary>
[ParseInfo(1, units: "no unit")]
public double? Obs { get; set; }
/// <summary>clock time</summary>
[StringLength(8)]
[ParseInfo(2, units: "hh:mm:ss")]
public string HHMMSS { get; set; }
/// <summary>number of seconds since file opened</summary>
[ParseInfo(3, units: "seconds")]
public double? FTime { get; set; }
/// <summary>photosynthetic rate</summary>
[ParseInfo(4, units: "umol/m2/s")]
public double? Photo { get; set; }
/// <summary>adjusted photosynthetic rate (leakage corrected)</summary>
/// <remarks>required</remarks>
[ParseInfo(5, alternateTitle: "!AdjPhoto", units: "umol/m2/s")]
public double? AdjPhoto { get; set; }
/// <summary>stomatal conductance</summary>
/// <remarks>required</remarks>
[ParseInfo(6, alternateTitle: "!StomCond", units: "mol/m2/s")]
public double? StomCond { get; set; }
/// <summary>intercellular CO2 concentration (umol CO2 / mol moist air)</summary>
[ParseInfo(7, alternateTitle: "!Ci", units: "umol/mol")]
public double? Ci { get; set; }
/// <summary>transpiration rate</summary>
/// <remarks>must provide</remarks>
[ParseInfo(8, alternateTitle: "!Trmmol", units:"mmol/m2/s")]
public double? Trmmol { get; set; }
/// <summary>water vapor pressure deficit based on leaf temperature, must provide</summary>
[ParseInfo(9, alternateTitle: "!VpdL", units: "KPa")]
public double? VpdL { get; set; }
/// <summary>leaf area</summary>
[ParseInfo(10, units:"cm2")]
public double? Area { get; set; }
/// <summary>estimate of the ratio of stomatal conductances of one side of the leaf to the other</summary>
[ParseInfo(11, units: "NA")]
public double? StmRat { get; set; }
/// <summary>total boundary layer conductance</summary>
[ParseInfo(12, units: "mol/m2/s")]
public double? BLCond { get; set; }
/// <summary>temperature in sample cell</summary>
[ParseInfo(13, units: "oC")]
public double? Tair { get; set; }
/// <summary>temperature of leaf thermocouple</summary>
/// <remarks>required</remarks>
[ParseInfo(14, alternateTitle: "!Tleaf", units: "oC")]
public double? Tleaf { get; set; }
/// <summary>IRGA Block temperature</summary>
[ParseInfo(15, units: "oC")]
public double? TBlk { get; set; }
/// <summary>reference CO2 concentration</summary>
[ParseInfo(16, units: "umol/mol")]
public double? CO2R { get; set; }
/// <summary>Sample CO2 concentration</summary>
[ParseInfo(17, units: "umol/mol")]
public double? CO2S { get; set; }
/// <summary>reference cell water vapor concentration</summary>
[ParseInfo(18, units: "mmol/mol")]
public double? H2OR { get; set; }
/// <summary>sample cell water vapor concentration</summary>
[ParseInfo(19, units: "mmol/mol")]
public double? H2OS { get; set; }
/// <summary>(%) Reference cell relative humidity</summary>
[ParseInfo(20)]
public double? RH_R { get; set; }
/// <summary>(%) sample cell relative humidity</summary>
[ParseInfo(21)]
public double? RH_S { get; set; }
/// <summary>(umol/s) molar flow rate of air entering the leaf chamber</summary>
[ParseInfo(22)]
public double? Flow { get; set; }
/// <summary> PAR measured by the in-chamber quantum sensor</summary>
/// <remarks>required</remarks>
[ParseInfo(23, alternateTitle: "!PARi", units: "umol/m2/s")]
public double? PARi { get; set; }
/// <summary>PAR measured by the external quantum sensor</summary>
[ParseInfo(24, units: "umol/m2/s")]
public double? PARo { get; set; }
/// <summary>atmospheric pressure</summary>
[ParseInfo(25, units: "KPa")]
public double? Press { get; set; }
/// <summary>sample CO2 offset</summary>
[ParseInfo(26, units: "umol/mol")]
public double? CsMch { get; set; }
/// <summary>sample H2O offset</summary>
[ParseInfo(27, units: "mmol/mol")]
public double? HsMch { get; set; }
/// <summary>a stability indicator as a decimal value</summary>
[ParseInfo(28, units: "NA")]
public double? StableF { get; set; }
/// <summary>status flag</summary>
[ParseInfo(29, units: "NA")]
public string Status { get; set; }
/// <summary>DeltaF/Fm, the fraction of absorbed PSII photons that are used in photochemistry</summary>
[ParseInfo(30, units: "NA")]
public double? PhiPS2 { get; set; }
/// <summary>atmospheric O2 partial pressure</summary>
[ParseInfo(31, units: "Pa")]
public double? OxygenPress { get; set; }
}
}
+18
View File
@@ -0,0 +1,18 @@
namespace LeafWeb.Core.Entities
{
public class LeafInputFile
{
public int Id { get; set; }
public virtual LeafInput LeafInput { get; set; }
/// <summary>
/// Parsed values from the LeafInput used in LeafWeb for filtering/searching
/// </summary>
// public virtual LeafInputInfo LeafInputInfo { get; set; }
public string Filename { get; set; }
public byte[] Contents { get; set; }
}
}
+50
View File
@@ -0,0 +1,50 @@
using System.Collections.Generic;
using LeafWeb.Core.Utility;
namespace LeafWeb.Core.Entities
{
/// <summary>
/// Descriptive information about the investigator,
/// contact information, the site,the sample leaf and its general environmental condition
/// </summary>
public class LeafInputInfo
{
public int Id { get; set; }
public virtual LeafInputSite Site { get; set; }
public virtual LeafInputPhotosynthetic Photosynthetic { get; set; }
public virtual ICollection<LeafInputData> Data { get; set; }
[ParseInfo(1, exampleValue: "First and last name")]
public string InvestigatorName { get; set; }
[ParseInfo(2, exampleValue: "Your email / mail addresses")]
public string ContactInformation { get; set; }
[ParseInfo(3, alternateTitle: "Site name in full", exampleValue: "Your site's identifier / name")]
public string SiteName { get; set; }
[ParseInfo(4, exampleValue: "Mixed forest / grasslands / croplands/ etc")]
public string VegetationType { get; set; }
[ParseInfo(5, exampleValue: "Soil type at your site")]
public string SoilType { get; set; }
[ParseInfo(6, exampleValue: "List of major species at the site")]
public string MajorSpecies { get; set; }
[ParseInfo(7,
alternateTitle: "Sample leaf light environment",
exampleValue: "The general light environment in which the leaf is in (e.g. heavily shaded from above)")]
public string SampleLeafLightEnv { get; set; }
[ParseInfo(8, exampleValue: "Indicate whether there is water stress at the time of sampling")]
public string WaterStressAssessment { get; set; }
[ParseInfo(9, exampleValue: "For example - Licor-6400")]
public string InstrumentUsed { get; set; }
[ParseInfo(10, exampleValue: "Any extra information you feel would be helpful to put the sampled leaf in context")]
public string ExtraInfo { get; set; }
}
}
+43
View File
@@ -0,0 +1,43 @@
using LeafWeb.Core.Utility;
namespace LeafWeb.Core.Entities
{
/// <summary>
/// Photosynthetic parameters of Leaf Input
/// </summary>
public class LeafInputPhotosynthetic
{
public int Id { get; set; }
public virtual LeafInputInfo LeafInputInfo { get; set; }
/// <summary>chloroplastic CO2 photocompensation point</summary>
/// <remarks>must be positive</remarks>
[ParseInfo(1, alternateTitle:"Gamma*", units: "Pa")]
public double GammaStar { get; set; }
/// <summary>Michaelis-Menten constant for RuBP carboxylation</summary>
/// <remarks>must be positive</remarks>
[ParseInfo(2, units: "Pa")]
public double Kc { get; set; }
/// <summary>Michaelis-Menten constant for RuBP oxygenation</summary>
/// <remarks>must be positive</remarks>
[ParseInfo(3, units: "Pa")]
public double Ko { get; set; }
/// <summary>the fraction of glycolate carbon not returned to the chloroplast</summary>
/// <remarks>must be between 0~1 if provided</remarks>
[ParseInfo(4)]
public double Alpha { get; set; }
/// <summary>dark respiration</summary>
/// <remarks>must be positive if provided</remarks>
[ParseInfo(5, units: "umol/m2/s")]
public double Rd { get; set; }
/// <summary>internal (also known as mesophyll) conductance</summary>
[ParseInfo(6, units: "umol/m2/s/Pa")]
public double gi { get; set; }
}
}
+99
View File
@@ -0,0 +1,99 @@
using LeafWeb.Core.Utility;
namespace LeafWeb.Core.Entities
{
/// <summary>
/// Contains info about the site such as elevation, canopy height, site ID, etc
/// </summary>
public class LeafInputSite
{
public int Id { get; set; }
public virtual LeafInputInfo LeafInputInfo { get; set; }
/// <summary>Site identifier</summary>
/// <remarks>do not leave blank between letters</remarks>
[ParseInfo(1)]
public string SiteId { get; set; }
/// <summary>Site latitude, northern hermisphere positive</summary>
[ParseInfo(2, units:"degrees")]
public double? Latitude { get; set; }
/// <summary>Site longitude, east positive</summary>
[ParseInfo(3, units: "degrees")]
public double? Longitude { get; set; }
/// <summary>site elevation</summary>
[ParseInfo(4, units: "m")]
public double? Elevation { get; set; }
/// <summary>the year when the A/Ci data is taken</summary>
[ParseInfo(5, units: "year")]
public int? SampleYear { get; set; }
/// <summary>the day of year (since 1 Jan) when the A/Ci data is taken</summary>
[ParseInfo(6, units: "day")]
public int? SampleDayOfYear { get; set; }
/// <summary>the approximate start day (since 1 Jan) of growing season</summary>
[ParseInfo(7, units: "day")]
public int? GrowSeasonStart { get; set; }
/// <summary>the approximate end day (since 1 Jan) of growing season</summary>
[ParseInfo(8, units: "day")]
public int? GrowSeasonEnd { get; set; }
/// <summary>stand age since the last disturbance</summary>
[ParseInfo(9, units: "year")]
public double? StandAge { get; set; }
/// <summary>the height of the canopy</summary>
[ParseInfo(10, units: "m")]
public double? CanopyHeight { get; set; }
/// <summary>the leaf area index in the middle of growing season</summary>
[ParseInfo(11, units: "m2/m2")]
public double? LeafAreaIndex { get; set; }
/// <summary>the species of the leaf sample</summary>
/// <remarks>don't leave blank between letters</remarks>
[ParseInfo(12, units: "dimensionless")]
public string SpeciesSampled { get; set; }
/// <summary>the average time interval between two consecutive A/Ci data points</summary>
[ParseInfo(13, alternateTitle: "AveTimeResolution", units: "minutes")]
public double? AverageTimeResolution { get; set; }
/// <summary>the height at which the leaf is located</summary>
[ParseInfo(14, units: "m")]
public double? SampleHeight { get; set; }
/// <summary>the age of the leaf</summary>
[ParseInfo(15, units: "day")]
public int? LeafAge { get; set; }
/// <summary>specific leaf area of the sample</summary>
[ParseInfo(16, units: "cm2/g")]
public double? SpecificLeafArea { get; set; }
/// <summary>dry leaf nitrogen content of the sample</summary>
[ParseInfo(17, units: "%")]
public double? LfNitrogenContent { get; set; }
/// <summary>dry leaf carbon content of the sample</summary>
[ParseInfo(18, units: "%")]
public double? LfCarbonContent { get; set; }
/// <summary>dry leaf phosphorus content of the sample</summary>
[ParseInfo(19, units: "%")]
public double? LfPhosphContent { get; set; }
// WoodPorosity
// SapWoodDensity
// DataType,TissueArea,TissueMass,Fo'_or_Fo,Fm'_or_Fm,Fs,MeasLight
}
}
+16
View File
@@ -0,0 +1,16 @@
using System;
namespace LeafWeb.Core.Entities
{
/// <summary>
/// Status of processing LeafInput
/// </summary>
public class LeafInputStatus
{
public int Id { get; set; }
public virtual LeafInput LeafInput { get; set; }
public string Status { get; set; }
public string Description { get; set; }
public DateTime DateTime { get; set; }
}
}
+16
View File
@@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace LeafWeb.Core.Entities
{
public class PhotosynthesisType
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public string Id { get; set; }
public string Name { get; set; }
public int SortOrder { get; set; }
}
}