Skip to content

Commit

Permalink
fix analytics params
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielzxccc committed May 1, 2024
1 parent 8dbe876 commit 37040c5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/modules/Analytics/AnalyticsInteractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export async function getLatestHarvestRate(farmid: string, userid: string) {
farmid
)

console.log(latestReport, '!!')
console.log(lastTwoReports, '22')
const { kilogram, planted_qty, previous_planted_qty } = latestReport

if (lastTwoReports.length !== 2) {
Expand Down Expand Up @@ -64,16 +66,26 @@ export async function getLatestHarvestRate(farmid: string, userid: string) {
descriptiveMessage = `You are ${difference}% in harvest rate compared to your previous harvest`
}

const cropYield =
parseFloat(kilogram) /
parseFloat(planted_qty === '0' ? previous_planted_qty : planted_qty)

const results = await axios.post(
`${process.env.PYTHON_API}/predict-prescription`,
[
{
crop_yield: latestHarvestRate,
crop_yield: cropYield,
withered_crops: Number(latestReport.withered_crops),
},
]
)

console.log(
latestHarvestRate,
Number(latestReport.withered_crops),
'PRESCRIPTIOn'
)

const prescriptionMessages = results.data[0]
.predicted_prescription as string[]

Expand Down

0 comments on commit 37040c5

Please sign in to comment.