WikiWatershed / model-my-watershed

The web application front end for Model My Watershed.
https://modelmywatershed.org
Apache License 2.0
57 stars 31 forks source link

Add Input Validation, Tests for GWLF-E Endpoints #3484

Closed rajadain closed 2 years ago

rajadain commented 2 years ago

The inputs for gwlf-e/prepare and gwlf-e/run endpoints should be validated.

Validating the values of input may be too complicated and extraneous, since crashes further down will report any errors there.

rajadain commented 2 years ago

layer_overrides keys should be validated against:

https://github.com/WikiWatershed/model-my-watershed/blob/4c8714ba7acdcd91118c1a04711a7a5115e26ec1/src/mmw/mmw/settings/base.py#L474-L488

and the values should be validated against:

https://github.com/WikiWatershed/model-my-watershed/blob/4c8714ba7acdcd91118c1a04711a7a5115e26ec1/src/mmw/apps/geoprocessing_api/schemas.py#L194-L201

https://github.com/WikiWatershed/model-my-watershed/blob/4c8714ba7acdcd91118c1a04711a7a5115e26ec1/src/mmw/apps/geoprocessing_api/schemas.py#L227

rajadain commented 2 years ago

Keys for the gwlf-e/run endpoint:

[
  "AEU",
  "AWMSGrPct",
  "AWMSNgPct",
  "Acoef",
  "AgLength",
  "AgSlope3",
  "AgSlope3To8",
  "AnimalDailyN",
  "AnimalDailyP",
  "AnimalFlag",
  "AnimalName",
  "AntMoist",
  "Area",
  "AttenFlowDist",
  "AttenFlowVel",
  "AttenLossRateN",
  "AttenLossRateP",
  "AttenLossRatePath",
  "AttenLossRateTSS",
  "AvKF",
  "AvSlope",
  "AvgAnimalWt",
  "BankNFrac",
  "BankPFrac",
  "BasinArea",
  "BasinDeadStorage",
  "C",
  "CN",
  "CNI",
  "CNP",
  "Capacity",
  "CleanMon",
  "Contaminant",
  "CountyFlag",
  "DayHrs",
  "DaysToDrain",
  "DisFract",
  "ETFlag",
  "FCOrgsPerDay",
  "FilterWidth",
  "FirstManureMonth",
  "FirstManureMonth2",
  "GRAppFCRate",
  "GRAppNRate",
  "GRAppPRate",
  "GRAppSum",
  "GRBarnFCRate",
  "GRBarnNRate",
  "GRBarnPRate",
  "GRBarnSum",
  "GRLBFC",
  "GRLBN",
  "GRLBP",
  "GRPctManApp",
  "GRPctSoilIncRate",
  "GRSFC",
  "GRSN",
  "GRSP",
  "GRTotSum",
  "GWNFlag",
  "GrNitrConc",
  "GrPhosConc",
  "GrazingAnimal",
  "GrazingFCRate",
  "GrazingNRate",
  "GrazingPRate",
  "GroundWithdrawal",
  "Grow",
  "ISRA",
  "ISRR",
  "Imper",
  "InitGrFC",
  "InitGrN",
  "InitGrP",
  "InitNgFC",
  "InitNgN",
  "InitNgP",
  "InitSnow",
  "InstreamDieoff",
  "KF",
  "KV",
  "LS",
  "Landuse",
  "LastManureMonth",
  "LastManureMonth2",
  "LoadRateImp",
  "LoadRatePerv",
  "ManNitr",
  "ManPhos",
  "ManuredAreas",
  "MaxWaterCap",
  "Month",
  "NGAppFCRate",
  "NGAppNRate",
  "NGAppPRate",
  "NGAppSum",
  "NGBarnFCRate",
  "NGBarnNRate",
  "NGBarnPRate",
  "NGBarnSum",
  "NGLBFC",
  "NGLBN",
  "NGLBP",
  "NGLManP",
  "NGPctManApp",
  "NGPctSoilIncRate",
  "NGTotSum",
  "NRur",
  "NUrb",
  "NitrConc",
  "NitrPlantUptake",
  "NitrSepticLoad",
  "Nqual",
  "NumAnimals",
  "NumDischargeSys",
  "NumNormalSys",
  "NumPondSys",
  "NumSewerSys",
  "NumShortSys",
  "P",
  "PcntET",
  "PctAreaInfil",
  "PctGrazing",
  "PctStreams",
  "PctStrmBuf",
  "PhosConc",
  "PhosPlantUptake",
  "PhosSepticLoad",
  "PhysFlag",
  "PhytasePct",
  "PointFlag",
  "PointFlow",
  "PointNitr",
  "PointPhos",
  "Prec",
  "Qretention",
  "RecessionCoef",
  "RetentNLake",
  "RetentPLake",
  "RetentSedLake",
  "RunContPct",
  "SatStor",
  "SedAAdjust",
  "SedAFactor",
  "SedDelivRatio",
  "SedNitr",
  "SedPhos",
  "SeepCoef",
  "SeptSysFlag",
  "SepticFailure",
  "SepticFlag",
  "SepticOrgsDay",
  "ShedAreaDrainLake",
  "SoilPFlag",
  "StreamFlowVolAdj",
  "StreamLength",
  "StreamWithdrawal",
  "StreetSweepNo",
  "SweepType",
  "Temp",
  "TileDrainDensity",
  "TileDrainRatio",
  "TileNconc",
  "TilePConc",
  "TileSedConc",
  "TotArea",
  "TotSusSolids",
  "TranVersionNo",
  "UnsatStor",
  "UrbAreaTotal",
  "UrbBMPRed",
  "UrbBankStab",
  "UrbEMC",
  "UrbLength",
  "UrbSweepFrac",
  "WWTPConc",
  "WeatherStations",
  "WildDensity",
  "WildOrgsDay",
  "WuDieoff",
  "WxYrBeg",
  "WxYrEnd",
  "WxYrs",
  "n1",
  "n10",
  "n108",
  "n109",
  "n11",
  "n110",
  "n111",
  "n111b",
  "n111c",
  "n111d",
  "n112",
  "n112b",
  "n112c",
  "n112d",
  "n113",
  "n113b",
  "n113c",
  "n113d",
  "n114",
  "n115",
  "n115b",
  "n116",
  "n116b",
  "n117",
  "n118",
  "n119",
  "n12",
  "n120",
  "n121",
  "n122",
  "n123",
  "n124",
  "n125",
  "n126",
  "n127",
  "n128",
  "n129",
  "n13",
  "n130",
  "n131",
  "n132",
  "n133",
  "n134",
  "n135",
  "n136",
  "n137",
  "n138",
  "n139",
  "n13b",
  "n13c",
  "n13d",
  "n14",
  "n140",
  "n141",
  "n142",
  "n143",
  "n144",
  "n145",
  "n146",
  "n147",
  "n148",
  "n149",
  "n14b",
  "n15",
  "n150",
  "n151",
  "n16",
  "n17",
  "n18",
  "n19",
  "n2",
  "n20",
  "n21",
  "n22",
  "n23",
  "n23b",
  "n23c",
  "n24",
  "n24b",
  "n24c",
  "n24d",
  "n24e",
  "n25",
  "n25b",
  "n25c",
  "n25d",
  "n25e",
  "n26",
  "n26b",
  "n26c",
  "n27",
  "n27b",
  "n28",
  "n28b",
  "n29",
  "n2b",
  "n2c",
  "n2d",
  "n3",
  "n30",
  "n30b",
  "n30c",
  "n30d",
  "n30e",
  "n31",
  "n31b",
  "n31c",
  "n32",
  "n32b",
  "n32c",
  "n32d",
  "n33",
  "n33b",
  "n33c",
  "n33d",
  "n34",
  "n35",
  "n35b",
  "n36",
  "n37",
  "n38",
  "n38b",
  "n39",
  "n4",
  "n40",
  "n41",
  "n41b",
  "n41c",
  "n41d",
  "n41e",
  "n41f",
  "n41g",
  "n41h",
  "n41i",
  "n41j",
  "n41k",
  "n41l",
  "n42",
  "n42b",
  "n42c",
  "n43",
  "n43b",
  "n43c",
  "n43d",
  "n43e",
  "n43f",
  "n43g",
  "n43h",
  "n43i",
  "n43j",
  "n44",
  "n44b",
  "n45",
  "n45b",
  "n45c",
  "n45d",
  "n45e",
  "n45f",
  "n46",
  "n46b",
  "n46c",
  "n46d",
  "n46e",
  "n46f",
  "n46g",
  "n46h",
  "n46i",
  "n46j",
  "n46k",
  "n46l",
  "n46m",
  "n46n",
  "n46o",
  "n46p",
  "n47",
  "n48",
  "n49",
  "n5",
  "n50",
  "n51",
  "n52",
  "n53",
  "n54",
  "n55",
  "n56",
  "n57",
  "n58",
  "n59",
  "n6",
  "n60",
  "n61",
  "n62",
  "n63",
  "n64",
  "n65",
  "n66",
  "n66b",
  "n67",
  "n68",
  "n68b",
  "n69",
  "n69b",
  "n69c",
  "n6b",
  "n6c",
  "n6d",
  "n7",
  "n70",
  "n70b",
  "n71",
  "n71b",
  "n72",
  "n73",
  "n74",
  "n74b",
  "n75",
  "n76",
  "n76b",
  "n77",
  "n77b",
  "n77c",
  "n78",
  "n78b",
  "n79",
  "n79b",
  "n79c",
  "n7b",
  "n8",
  "n80",
  "n81",
  "n82",
  "n82b",
  "n83",
  "n84",
  "n84b",
  "n85",
  "n85b",
  "n85c",
  "n85d",
  "n85e",
  "n85f",
  "n85g",
  "n85h",
  "n85i",
  "n85j",
  "n85k",
  "n85l",
  "n85m",
  "n85n",
  "n85o",
  "n85p",
  "n85q",
  "n85r",
  "n85s",
  "n85t",
  "n85u",
  "n85v",
  "n9"
]