Skip to content

Instantly share code, notes, and snippets.

@zapkub
Created May 20, 2019 10:12
Show Gist options
  • Save zapkub/c039630cb0439ec4bfcd6dca2b93a4df to your computer and use it in GitHub Desktop.
Save zapkub/c039630cb0439ec4bfcd6dca2b93a4df to your computer and use it in GitHub Desktop.
Assessment API abstraction
import { CommonEntityAttrs } from './default'
// Reference to ./docs/assessment-specs.md
export interface PlantFieldAssessment extends CommonEntityAttrs {
kind: 'PlantFieldAssessment'
plantSeasonId: number
seasonId: number
tierNo: 2 | 3
cropEstimateByAskingFullName?: string
cropEstimateByAskingAtCurrent: number
cropEstimateByAskingAtHarvest: number
cropEstimateByUserAtCurrent: number
cropEstimateByUserAtHarvest: number
cropEstimateByMetricToolAtCurrent?: number
cropEstimateByMetricToolAtHarvest?: number
cropEstimateByApplicationCalculateAtCurrent?: number
cropEstimateByApplicationCalculateAtHarvest?: number
growingType: 'NORMAL' | 'IRREGULAR' | 'CHANGE'
// Irregular growing information
irregularGrowingType: 'SOME' | 'ALL'
irregularGrowingSizeAsRai: number // only if IrregularGrowingType is 'SOME'
isIrregularGrowingByDisease: boolean
isIrregularGrowingByInsect: boolean
isIrregularGrowingByDrought: boolean
isIrregularGrowingByFlood: boolean
growingTypeChangeToPlantKindId?: number
waterType: 'WHOLE' | 'SURVIVE' | 'NON'
rainfallMeasurementAsMilimeter?: number
borderPlantKindIdNorth?: number
borderPlantFertilizerTypeIdNorth?: number
borderPlantKindIdSouth?: number
borderPlantFertilizerTypeIdSouth?: number
borderPlantKindIdEast?: number
borderPlantFertilizerTypeIdEast?: number
borderPlantKindIdWest?: number
borderPlantFertilizerTypeIdWest?: number
extraWorkComment?: string
otherComment?: string
surveyDate?: Date
surveyBy?: string
// Relate data ( no pagination )
survies: PlantFieldAssessmentSurvey[]
chemicalUsages: PlantFieldAssessmentChemicalUsage[]
fertilizerUsages: PlantFieldAssessmentFertilizerUsage[]
pictures: PlantFieldAssessmentPicture[]
}
export interface PlantFieldAssessmentSurvey extends CommonEntityAttrs {
kind: 'PlantFieldAssessmentSurvey'
assessmentId: number
stalkPerTenMeter: number
averageHeight: number
averageWeight: number
averageGirth?: number
waterCourse?: number
note?: string
}
export interface PlantFieldAssessmentChemicalUsage extends CommonEntityAttrs {
kind: 'PlantFieldAssessmentChemicalUsage'
assessmentId: number
chemicalId: number
startedAt:number
amountPerUnit: number
unitId: number
}
export interface PlantFieldAssessmentPicture extends CommonEntityAttrs {
kind: 'PlantFieldAssessmentPicture'
assessmentId: number
lat?: number
long?: number
note: string
pictureTypeId: number
key: string
url?: string
}
export interface PlantFieldAssessmentFertilizerUsage extends CommonEntityAttrs {
kind: 'PlantFieldAssessmentFertilizerUsage'
assessmentId: number
usageMonth: number
fertilizerTypeId: number
usageAmountAsKiligram?: number
// วิธีการใช้ปุ๋ย 4 แบบ reference from
// https://homeguides.sfgate.com/four-methods-applying-fertilizers-25517.html
// Vocab fix from column naming
isBroadcasting: boolean // AssessFertilizer_Sow การใช้ปุ๋ยแบบหว่าน
isDeepSoil: boolean // AssessFertilizer_Inter, การใช้ปุ๋ยแบบฝัง
isLiquidSpray: boolean // AssessFertilizer_Spray การใช้ปุ๋ยแบบพ่น
isBanding: boolean // AssessFertilizer_Bottom การใข้ปุ๋ยแบบฝังใต้หลุม
note: string
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment