UNPKG

@nqminds/crop-doc-constants

Version:

Cropdoc constants

3 lines (2 loc) 5.3 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@nqminds/crop-doc-translations"),t=require("moment"),r=require("shortid");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a,i=o(e),n=o(t),l=o(r);function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function d(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){u(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var h,f,c,m,g={alert:"alert",advice:"advice"},p={type:g,typeText:(a={},u(a,g.alert,i.default.alert),u(a,g.advice,i.default.advice),a)},y={info:"info",alert:"alert",weather:"weather",pest:"pest",event:"event"},v={category:y,categoryText:(h={},u(h,y.info,i.default.info),u(h,y.alert,i.default.alert),u(h,y.weather,i.default.weather),u(h,y.pest,i.default.pest),u(h,y.event,i.default.event),h),categoryIcons:(f={},u(f,y.info,"info"),u(f,y.alert,"warning"),u(f,y.weather,"cloud"),u(f,y.pest,"emoji_nature"),u(f,y.event,"event"),f)},O={low:"low",medium:"medium",high:"high"},k={priority:O,priorityText:(c={},u(c,O.low,i.default.low),u(c,O.medium,i.default.medium),u(c,O.high,i.default.high),c),priorityColors:(m={},u(m,O.low,"#4caf50"),u(m,O.medium,"#ffc107"),u(m,O.high,"#f44336"),m)},w={get template(){return{id:l.default.generate(),createdOn:n.default().valueOf(),createdBy:"cropdoc-model-databot",recipients:[],message:"",start:n.default().startOf("day").valueOf(),end:n.default().endOf("day").valueOf(),header:"",alertType:p.type.alert,alertCategories:v.category.info,priority:k.priority.low}}},b=d(d(d(d({},p),v),k),w),x={harvestAlertThreshold:n.default.duration(2,"weeks").valueOf(),blightAlertThreshold:n.default.duration(4,"weeks").valueOf(),blightSeverityThreshold:{medium:2,high:5},tempThreshold:{low:5,high:25},heatwaveThreshold:{temp:28,days:5},rainThresholdHourlyMm:{moderate:2.5,heavy:10,violent:50},get rainThresholdDailyMm(){return{moderate:this.hoursInDay*this.rainThresholdHourlyMm.moderate,heavy:this.hoursInDay*this.rainThresholdHourlyMm.heavy,violent:this.hoursInDay*this.rainThresholdHourlyMm.violent}},get rainThresholdWeeklyMm(){return{moderate:this.hoursInWeek*this.rainThresholdHourlyMm.moderate,heavy:this.hoursInWeek*this.rainThresholdHourlyMm.heavy,violent:this.hoursInWeek*this.rainThresholdHourlyMm.violent}},humidityThreshold:{low:30,high:70},sensorThresholdKm:50,geoSearchDelta:50/111,pixelSearchDelta:.1,controlThresholdKm:5,blightValidMonths:6,blightForecastStart:-8,blightForecastEnd:7},D={msInDay:n.default.duration(1,"day").valueOf(),msInYear:n.default.duration(1,"year").valueOf(),hoursInDay:n.default.duration(1,"day").as("hours"),hoursInWeek:n.default.duration(1,"week").as("hours"),dateFormat:"YYYY-MM-DD",timeZone:"Asia/Shanghai",get forecastRangeFilter(){return{$gte:n.default().startOf("day").valueOf(),$lte:n.default().startOf("day").add(6,"day").endOf("day").valueOf()}}},M={none:i.default.none,unconfirmed:i.default.unconfirmed,confirmed:i.default.confirmed},T={none:i.default.none,primaryInfection:i.default.primaryInfection,nearInfection:i.default.nearInfection},P={missing:i.default.noData,low:i.default.riskSafe,moderate:i.default.riskDanger,high:i.default.riskHighDanger},j={0:i.default.noData,1:i.default.riskSafe,11:i.default.riskDanger,111:i.default.riskHighDanger},I={1:i.default.fieldBlightPredictionMessageSafe,11:i.default.fieldBlightPredictionMessageRisk,111:i.default.fieldBlightPredictionMessageHighRisk},S={0:i.default.noData,1:i.default.riskSafe,10:i.default.riskDanger,11:i.default.riskHighDanger};exports.alert=b,exports.blightConfirmation={confirmedBlight:"confirmedBlight",confirmedNotBlight:"confirmedNotBlight",unconfirmed:"unconfirmed"},exports.conditions=T,exports.confirmationStatus={confirmedBlight:"confirmedBlight",confirmedNotBlight:"confirmedNotBlight",unconfirmed:"unconfirmed"},exports.defaultMapViewState={longitude:104.1954,latitude:35.8617,zoom:4,maxZoom:20,pitch:0,bearing:0},exports.maxO4DataPoints=1e4,exports.permissionLevel={farmer:"farmers",advisor:"advisors",policyMaker:"policyMakers",decisionMaker:"decisionMakers",admin:"sysAdmins"},exports.riskLevels=P,exports.riskLevelsHebau={0:"missing",1:"low",10:"moderate",11:"high"},exports.riskO6=j,exports.riskO6Enum={missing:0,low:1,moderate:11,high:111},exports.riskO6Message=I,exports.riskO7=S,exports.riskO7Enum={missing:0,low:1,moderate:10,high:11},exports.severityLevels=M,exports.tags={resourceTag:{region:"crop-doc-region",localArea:"crop-doc-local-area"},typeTags:{region:"crop-doc-region",localArea:"crop-doc-local-area",role:"crop-doc-role"}},exports.thresholds=x,exports.timedate=D,exports.units={temp:"°C",precipitation:"mm",humidity:"%",areaLevels:{province:"province",district:"district",county:"county"},geoShapes:{polygon:"Polygon",multiPolygon:"MultiPolygon"}}; //# sourceMappingURL=index.js.map