Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ jobs:
run: pnpm check-types
working-directory: ./fdm-calculator

- name: Typecheck fdm-rvo
run: pnpm check-types
working-directory: ./fdm-rvo

- name: Typecheck fdm-agents
run: pnpm check-types
working-directory: ./fdm-agents

# - name: Typecheck fdm-app
# run: pnpm typecheck
# working-directory: ./fdm-app
10 changes: 10 additions & 0 deletions fdm-agents/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# @nmi-agro/fdm-agents

## 0.2.1

### Patch Changes

- [#552](https://github.com/nmi-agro/fdm/pull/552) [`bc66091`](https://github.com/nmi-agro/fdm/commit/bc660919b72abf951d7cbc42f3cd5c527d03fac5) Thanks [@BoraIneviNMI](https://github.com/BoraIneviNMI)! - Fix type issue where `fieldMetrics` could possibly be null

- Updated dependencies [[`45718ae`](https://github.com/nmi-agro/fdm/commit/45718ae5288f59797612d8a382f042598ecec163), [`9dfd545`](https://github.com/nmi-agro/fdm/commit/9dfd545b834f90492d3599a0e82fe66978e56889)]:
- @nmi-agro/fdm-calculator@0.13.1
- @nmi-agro/fdm-core@0.31.1

## 0.2.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion fdm-agents/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@nmi-agro/fdm-agents",
"private": false,
"version": "0.2.0",
"version": "0.2.1",
"description": "AI Agent for Fertilizer Planning",
"license": "MIT",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion fdm-agents/src/tools/fertilizer-planner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ export function createFertilizerPlannerTools(fdm: FdmType) {
}

for (const r of validFieldResults) {
if (r.fieldMetrics.omBalance && r.fieldMetrics.omBalance < 0) {
if (r.fieldMetrics?.omBalance && r.fieldMetrics.omBalance < 0) {
agronomicWarnings.push(
`Strategy warning (Organic Matter): Field ${r.b_id} has a negative organic matter balance (${Math.round(r.fieldMetrics.omBalance)} kg EOM/ha). Consider applying compost or other fertilizer with a high EOM content.`,
)
Expand Down
14 changes: 14 additions & 0 deletions fdm-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog fdm-app

## 0.29.1

### Patch Changes

- [#552](https://github.com/nmi-agro/fdm/pull/552) [`24a2010`](https://github.com/nmi-agro/fdm/commit/24a2010f22eaa1b024e0f44344c62e6a9ac8c39f) Thanks [@BoraIneviNMI](https://github.com/BoraIneviNMI)! - In the rotation and field table fertilizer application details table, if a field has equivalent fertilizer applications, each of those will now be displayed on separate rows.

- [#552](https://github.com/nmi-agro/fdm/pull/552) [`eb3ebcb`](https://github.com/nmi-agro/fdm/commit/eb3ebcb2b18230de84ce1ce3c3d2b5a9fa6a5804) Thanks [@BoraIneviNMI](https://github.com/BoraIneviNMI)! - Update react-router and vite config for vite v8

- Updated dependencies [[`45718ae`](https://github.com/nmi-agro/fdm/commit/45718ae5288f59797612d8a382f042598ecec163), [`9dfd545`](https://github.com/nmi-agro/fdm/commit/9dfd545b834f90492d3599a0e82fe66978e56889), [`bc66091`](https://github.com/nmi-agro/fdm/commit/bc660919b72abf951d7cbc42f3cd5c527d03fac5)]:
- @nmi-agro/fdm-calculator@0.13.1
- @nmi-agro/fdm-core@0.31.1
- @nmi-agro/fdm-agents@0.2.1
- @nmi-agro/fdm-rvo@0.2.0

## 0.29.0

### Minor Changes
Expand Down
26 changes: 24 additions & 2 deletions fdm-app/app/components/blocks/fertilizer-applications/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,26 @@ export const mappers = {
mapByField: createMapper((application) => application.b_id),
mapBySimilar: createMapper(
(application) =>
`${createDateKey(application.p_app_date)}#${application.p_app_amount?.toPrecision(4)}`,
`${createDateKey(application.p_app_date)}#${application.p_app_amount?.toPrecision(4)}#${application.p_app_method}`,
),
mapBySimilarAndOrder: (
record: FertAppRecord,
applications: ApplicationExtended[],
) => {
const occurrenceBySimilarKey: Record<string, number> = {}
applications.forEach((application) => {
if (!application.p_app_date) return
const similarKey = `${createDateKey(application.p_app_date)}#${application.p_app_amount?.toPrecision(4)}#${application.p_app_method}`
const occurrence = occurrenceBySimilarKey[similarKey] ?? 0
occurrenceBySimilarKey[similarKey] = occurrence + 1
const key = `${similarKey}#${occurrence}`
record[key] ??= {
id: `${application.p_id}_${key}`,
applications: [],
}
record[key].applications.push(application)
})
},
mapEach: createMapper((application) => application.p_app_id),
} as const

Expand Down Expand Up @@ -176,7 +194,11 @@ export function DataTable({
returnUrl: string
}) {
const records = useMemo(
() => groupAndOrderFertApps(fertilizerApplications, "mapBySimilar"),
() =>
groupAndOrderFertApps(
fertilizerApplications,
"mapBySimilarAndOrder",
),
[fertilizerApplications],
)

Expand Down
27 changes: 13 additions & 14 deletions fdm-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nmi-agro/fdm-app",
"version": "0.29.0",
"version": "0.29.1",
"private": true,
"sideEffects": false,
"type": "module",
Expand Down Expand Up @@ -29,8 +29,8 @@
"@react-email/components": "^1.0.11",
"@react-email/tailwind": "^2.0.7",
"@react-pdf/renderer": "^4.3.2",
"@react-router/node": "^7.13.2",
"@react-router/serve": "^7.13.2",
"@react-router/node": "^7.14.0",
"@react-router/serve": "^7.14.0",
"@remix-run/file-storage": "^0.13.3",
"@remix-run/form-data-parser": "^0.15.0",
"@sentry/profiling-node": "^10.47.0",
Expand Down Expand Up @@ -60,19 +60,19 @@
"nanoid": "^5.1.7",
"next-themes": "^0.4.6",
"postgres": "^3.4.8",
"posthog-js": "^1.364.4",
"posthog-node": "^5.28.9",
"posthog-js": "^1.364.6",
"posthog-node": "^5.28.11",
"postmark": "^4.0.7",
"proj4": "^2.20.4",
"proj4": "^2.20.6",
"radix-ui": "^1.4.3",
"react": "^19.2.4",
"react-day-picker": "9.14.0",
"react-dom": "^19.2.4",
"react-hook-form": "^7.72.0",
"react-hook-form": "^7.72.1",
"react-map-gl": "^8.1.0",
"react-markdown": "^10.1.0",
"react-router": "^7.13.2",
"react-router-dom": "^7.13.2",
"react-router": "^7.14.0",
"react-router-dom": "^7.14.0",
"recharts": "^2.15.4",
"remark-gfm": "^4.0.1",
"remix-hook-form": "7.1.1",
Expand All @@ -82,7 +82,7 @@
"sonner": "^2.0.7",
"tailwind-merge": "^3.5.0",
"tailwindcss-animate": "^1.0.7",
"validator": "^13.15.26",
"validator": "^13.15.35",
"zod": "^4.3.6",
"zustand": "^5.0.12"
},
Expand All @@ -92,8 +92,8 @@
"@nmi-agro/fdm-core": "workspace:*",
"@nmi-agro/fdm-data": "workspace:*",
"@nmi-agro/fdm-rvo": "workspace:*",
"@react-router/dev": "^7.13.2",
"@react-router/fs-routes": "^7.13.2",
"@react-router/dev": "^7.14.0",
"@react-router/fs-routes": "^7.14.0",
"@tailwindcss/postcss": "^4.2.2",
"@types/geojson": "^7946.0.16",
"@types/lodash.throttle": "^4.1.9",
Expand All @@ -106,8 +106,7 @@
"tailwindcss": "^4.2.2",
"typescript": "catalog:",
"vite": "^8.0.3",
"vite-node": "^6.0.0",
"vite-tsconfig-paths": "^6.1.1"
"vite-node": "^6.0.0"
},
"engines": {
"node": ">=24.0.0"
Expand Down
6 changes: 3 additions & 3 deletions fdm-app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { reactRouter } from "@react-router/dev/vite"
import { sentryReactRouter } from "@sentry/react-router"
import tailwindcss from "@tailwindcss/vite"
import { defineConfig } from "vite"
import tsconfigPaths from "vite-tsconfig-paths"

const __dirname = path.dirname(fileURLToPath(import.meta.url))
const calculatorPackagePath = path.resolve(
Expand Down Expand Up @@ -45,7 +44,6 @@ export default defineConfig((env) => {
plugins: [
replaceCalculatorVersion,
reactRouter(),
tsconfigPaths(),
tailwindcss(),
enableSentry &&
sentryReactRouter(
Expand Down Expand Up @@ -74,7 +72,6 @@ export default defineConfig((env) => {
"posthog-js",
"posthog-js/react",
"@geomatico/maplibre-cog-protocol",
"@nmi-agro/fdm-agents",
],
},
build: {
Expand All @@ -90,5 +87,8 @@ export default defineConfig((env) => {
"@nmi-agro/fdm-agents",
],
},
resolve: {
tsconfigPaths: true,
},
}
})
9 changes: 9 additions & 0 deletions fdm-calculator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# fdm-calculator

## 0.13.1

### Patch Changes

- [#552](https://github.com/nmi-agro/fdm/pull/552) [`45718ae`](https://github.com/nmi-agro/fdm/commit/45718ae5288f59797612d8a382f042598ecec163) Thanks [@BoraIneviNMI](https://github.com/BoraIneviNMI)! - Fix type error in tests where errors are expected to be catched

- Updated dependencies [[`9dfd545`](https://github.com/nmi-agro/fdm/commit/9dfd545b834f90492d3599a0e82fe66978e56889)]:
- @nmi-agro/fdm-core@0.31.1

## 0.13.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion fdm-calculator/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@nmi-agro/fdm-calculator",
"private": false,
"version": "0.13.0",
"version": "0.13.1",
"description": "Calculate various insights based on the Farm Data Model",
"license": "MIT",
"homepage": "https://github.com/nmi-agro/fdm",
Expand Down
4 changes: 2 additions & 2 deletions fdm-calculator/src/norms/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,18 +200,18 @@ describe("createUncachedFunctionsForFertilizerApplicationFilling", () => {

it("should throw an error for an unsupported year", () => {
expect(() =>
//@ts-expect-error
createUncachedFunctionsForFertilizerApplicationFilling(
"NL",
//@ts-expect-error
"2024",
),
).toThrow("Year not supported")
})

it("should throw an error for an unsupported region", () => {
expect(() =>
//@ts-expect-error
createUncachedFunctionsForFertilizerApplicationFilling(
//@ts-expect-error
"BE",
"2025",
),
Expand Down
6 changes: 6 additions & 0 deletions fdm-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog fdm-core

## 0.31.1

### Patch Changes

- [#552](https://github.com/nmi-agro/fdm/pull/552) [`9dfd545`](https://github.com/nmi-agro/fdm/commit/9dfd545b834f90492d3599a0e82fe66978e56889) Thanks [@BoraIneviNMI](https://github.com/BoraIneviNMI)! - Fixes some type issues at tests for missing invitations

## 0.31.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion fdm-core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@nmi-agro/fdm-core",
"private": false,
"version": "0.31.0",
"version": "0.31.1",
"description": "Interface for the Farm Data Model",
"license": "MIT",
"homepage": "https://svenvw.github.io/fdm/",
Expand Down
7 changes: 6 additions & 1 deletion fdm-core/src/farm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,13 @@ describe("Farm Functions", () => {
expect(invitation?.role).toBe("advisor")
expect(invitation?.status).toBe("pending")

if (!invitation) {
throw new Error(
"Test did not create an invitation as expected, cannot continue with test",
)
}
// Accept the invitation so subsequent tests (updateRole, revoke) work
await acceptInvitation(fdm, invitation?.invitation_id, target_id)
await acceptInvitation(fdm, invitation.invitation_id, target_id)

// Now the role should be granted
const principals = await listPrincipalsForResource(
Expand Down
Loading
Loading