dwelldelta-mcp 0.10.1 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
22
 
23
23
  The data files in vendor/ (rents-index.json, indicators.json, nsw-suburbs.json, vic-rents.json,
24
- nsw-rents.json, qld-rents.json, wa-rents.json, nsw-sales.json) are
24
+ nsw-rents.json, qld-rents.json, wa-rents.json, sa-rents.json, nsw-sales.json) are
25
25
  not covered by this licence. Each figure keeps its source's own licence and
26
26
  attribution, which the data files and every answer state (for example, ABS data:
27
27
  CC BY 4.0, "Based on Australian Bureau of Statistics data"; the NSW suburb list:
@@ -30,5 +30,8 @@ NSW rents: CC BY 4.0, State of New South Wales (Department of Communities and
30
30
  Justice); Queensland rents: CC BY 4.0, The State of Queensland (Residential
31
31
  Tenancies Authority); WA rents: based on WA Rental Bonds Data, CC BY 4.0,
32
32
  Government of Western Australia, with medians calculated by DwellDelta;
33
+ SA rents: South Australian Housing Trust, Government of South Australia,
34
+ Private Rent Report, whose own page states no licence - the national
35
+ catalogues list CC BY 4.0 and CC BY 3.0 AU;
33
36
  NSW sale prices: CC BY 4.0, State of New South Wales (Department of
34
37
  Communities and Justice)).
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # dwelldelta-mcp - is an Australian rent fair?
2
2
 
3
3
  An MCP server that lets an AI assistant check a weekly rent against the ABS rents index, look up median rents
4
- by area in four states and NSW median sale prices, and quote sourced Australian property and lending indicators. From
4
+ by area in five states and NSW median sale prices, and quote sourced Australian property and lending indicators. From
5
5
  [DwellDelta](https://dwelldelta.com.au/), a service of Xcelerent Pty Ltd, built on public data.
6
6
 
7
7
  Six read-only tools, and one that adds the user's own rent when they ask:
@@ -11,7 +11,7 @@ Six read-only tools, and one that adds the user's own rent when they ask:
11
11
  | `rent_check` | a weekly rent, and any proposed new rent, against the ABS rents index for the capital city since the lease began (the same arithmetic as the rent check at tools.dwelldelta.com.au) |
12
12
  | `market_indicators` | the latest RBA cash rate, unemployment, wage growth, rents for all eight capitals, NSW lending, lending standards and arrears, approvals and completions - each with period, source, licence and limits; filter by `geography` |
13
13
  | `vic_rents` | Victorian rents by suburb group from Homes Victoria's Rental Report: the median weekly rent of new leases, the lease count and the change on a year before, for 146 suburb groups and 13 regions; filter by `suburb_group` or `region` (from 0.5.0) |
14
- | `area_rents` | median weekly rent of new bonds, all dwellings together, with the bond count and the change on a year before, for one state per call: NSW by postcode or council (NSW Department of Communities and Justice), Queensland by suburb or council (Residential Tenancies Authority), WA by locality (calculated by DwellDelta from the Government of Western Australia's bond records); each CC BY 4.0 (from 0.6.0) |
14
+ | `area_rents` | median weekly rent of new bonds, all dwellings together, with the bond count and the change on a year before, for one state per call: NSW by postcode or council (NSW Department of Communities and Justice), Queensland by suburb or council (Residential Tenancies Authority), WA by locality (calculated by DwellDelta from the Government of Western Australia's bond records), SA by suburb (SA Housing Trust, Private Rent Report; its publisher's page states no licence, and the national catalogues list CC BY); each file states CC BY 4.0 (from 0.6.0; SA from 0.11.0) |
15
15
  | `nsw_sale_prices` | NSW median sale prices by postcode or council from the NSW Department of Communities and Justice's Rent and Sales Report (CC BY 4.0): the median, the quartiles, the number of sales and the change on a year before, each for all dwellings, houses (non-strata) and units and town houses (strata). Medians of homes sold - never what any one home sold for; a line set by a few very large sales or by many sales at one identical price is marked UNUSUAL (from 0.7.0), and is not a going price |
16
16
  | `data_sources` | the sources, their licences, and what DwellDelta cannot answer |
17
17
  | `contribute_rent` | adds the user's own rent, anonymously, to DwellDelta's suburb benchmarks - only when the user asks, and only after they have read and agreed to the consent wording (from 0.5.0) |
@@ -70,15 +70,22 @@ median rent of new leases in postcode 2148?" or "What is NSW unemployment doing?
70
70
 
71
71
  ## Rents by area (from 0.6.0)
72
72
 
73
- `area_rents` answers for one state at a time, because the three publishers measure in their own ways and the WA
73
+ `area_rents` answers for one state at a time, because the four publishers measure in their own ways and the WA
74
74
  medians are DwellDelta's own calculation from the Government's one-record-per-bond data. They must not be added
75
75
  or ranked as one series. Every answer carries that state's quarter, its source line, what DwellDelta selected or
76
76
  calculated, and its limits. These are medians of new bonds, all dwellings together - not advertised rents, not
77
77
  what sitting tenants pay, and not the rent of a home of a given size. Where a publisher reports nothing for a
78
78
  small area the answer says so; it never shows a zero. The feeds are public at
79
- https://tools.dwelldelta.com.au/market/nsw-rents.json, `qld-rents.json` and `wa-rents.json`; the server reads them
80
- at start the way it reads the indicators, and `DWELLDELTA_STATE_RENTS_DIR` points it at a folder of copies.
81
- Victoria, measured differently again, stays in `vic_rents`.
79
+ https://tools.dwelldelta.com.au/market/nsw-rents.json, `qld-rents.json`, `wa-rents.json` and `sa-rents.json`; the
80
+ server reads them at start the way it reads the indicators, and `DWELLDELTA_STATE_RENTS_DIR` points it at a folder of
81
+ copies. Victoria, measured differently again, stays in `vic_rents`.
82
+
83
+ South Australia's file holds one quarter today, so its `compared_with`, year-ago medians and changes are null and no
84
+ answer names a year it is compared with. Its counts of bonds are rounded to the nearest 5 (the SA Housing Trust's note says so of its totals;
85
+ every count in the file is a multiple of 5), and the publisher
86
+ prints a median where it shows the count as `*` (1 to 5 bonds; the file's `new_bonds_range`): that median is
87
+ refused, never given. The publisher's own page states no licence; the file's `licence_note` says which licence the
88
+ national catalogues list.
82
89
 
83
90
  ### By dwelling type and bedrooms (from 0.8.0)
84
91
 
@@ -89,7 +96,8 @@ every type. A combination with no published median is said to have none; it is n
89
96
  all-dwellings figure, a neighbouring area or a wider group. Many of these figures rest on few bonds, and each
90
97
  small sample is marked. The Residential Tenancies Authority does not define its labels: reading "Flat 2" as a
91
98
  two-bedroom flat is DwellDelta's reading, and every Queensland answer says so. WA's bond records carry neither
92
- dwelling type nor bedrooms, so WA has no such figures. DCJ's largest size is "4 or more Bedrooms": a number above
99
+ dwelling type nor bedrooms, so WA has no such figures; DwellDelta publishes South Australia's rents for all
100
+ dwellings together only. DCJ's largest size is "4 or more Bedrooms": a number above
93
101
  four is answered under that label, and the answer says it is not for that number alone. A number followed by a
94
102
  plus means "or more", which only that one size has; anything else with a plus is refused, not answered as exactly
95
103
  that many.
@@ -134,7 +142,8 @@ published data file. The structured result says the same, in new fields; every f
134
142
 
135
143
  - each entry of `sources` adds `licence_id`, `licence_url`, `source_url`, `source_notice_url`, `feed_url` and
136
144
  `period`. `source_url` is only ever an address of the data's own page that the data file itself holds: for WA
137
- the National Housing Data Exchange dataset page, for Victoria the DataVic page in its source line. It is null
145
+ the National Housing Data Exchange dataset page, for SA the data.sa.gov.au dataset page, for Victoria the DataVic
146
+ page in its source line. It is null
138
147
  where the file holds none - DCJ's files (NSW rents, rents by type, sale prices), the RTA's (Queensland), the ABS
139
148
  rents index and the indicators snapshot. DCJ's and the RTA's files name only a copyright notice
140
149
  (https://dcj.nsw.gov.au/statements/copyright-and-disclaimer.html, which DCJ's attribution also names, and
@@ -158,8 +167,9 @@ published data file. The structured result says the same, in new fields; every f
158
167
  - A figure that rests on too few records is a refusal, never a weak number: `{ refused: true, type:
159
168
  "too_few_records", reason, n, n_band, unit, min_n, rule }` (`type` is `not_published` for a combination the
160
169
  publisher does not list). The rules are each file's own: DCJ reports nothing for 10 or fewer bonds or sales
161
- (`min_n` 11), a WA locality needs 10 bonds, and the RTA and Homes Victoria withhold small medians without
162
- stating a number. A median the file gives below its rule is refused in the text as well; the file's own figure
170
+ (`min_n` 11), a WA locality needs 10 bonds, the RTA and Homes Victoria withhold small medians without stating a
171
+ number, and an SA median whose count the publisher shows as `*` (1 to 5 bonds) is refused (`min_n` null: the
172
+ publisher's counts are rounded to the nearest 5, so no number is a cut-off). A median the file gives below its rule is refused in the text as well; the file's own figure
163
173
  is left as it is in the structured rows.
164
174
  - Each structured row says on itself whether the text refused its figure (from 0.9.0; additions only - no field a
165
175
  row had is changed or removed): `refused: true` and `refusal_type` (`too_few_records` or `not_published`, the same
@@ -1,13 +1,17 @@
1
1
  /**
2
2
  * area_rents (0.6.0, 2026-10-10): rents by area for NSW (postcodes and councils, NSW Department of Communities and
3
- * Justice), Queensland (suburbs and councils, Residential Tenancies Authority) and Western Australia (localities,
4
- * calculated by DwellDelta from the Government's bond records), as published at
5
- * tools.dwelldelta.com.au/market/{nsw,qld,wa}-rents.json - each CC BY 4.0, republishable with attribution.
3
+ * Justice), Queensland (suburbs and councils, Residential Tenancies Authority), Western Australia (localities,
4
+ * calculated by DwellDelta from the Government's bond records) and, from 2026-11-01, South Australia (suburbs, the SA
5
+ * Housing Trust's Private Rent Report), as published at tools.dwelldelta.com.au/market/{nsw,qld,wa,sa}-rents.json -
6
+ * each CC BY 4.0, republishable with attribution; SA's licence is the one the national catalogues list, which its
7
+ * publisher's own page does not state (the file's licence_note).
8
+ *
9
+ * SA's file may hold one quarter only: then compared_with is null, and no answer names a quarter it is compared with.
6
10
  *
7
11
  * One state per call, never pooled: each publisher measures in its own way, and the WA medians are our own
8
12
  * calculation, so every answer carries that state's own source line, what was changed, and its limits.
9
13
  *
10
- * Loaded like vic_rents: DWELLDELTA_STATE_RENTS_DIR (a folder holding the three files), else the owner's live store,
14
+ * Loaded like vic_rents: DWELLDELTA_STATE_RENTS_DIR (a folder holding the four files), else the owner's live store,
11
15
  * else the published file (fetched once at start - one public file each; nothing about the user or their questions is
12
16
  * sent - and used if well formed, for the right state, and not older than the bundled copy), else the copy bundled at
13
17
  * pack time. DWELLDELTA_OFFLINE=1 never fetches. The data changes once a quarter, so every answer states its quarter.
@@ -38,9 +42,14 @@ export const STATES = {
38
42
  WA: { file: "wa-rents.json", name: "Western Australia", notice_is_data: true,
39
43
  hint: "WA rents are by locality (area: \"Fremantle\"; part of a name works). There are no councils in the " +
40
44
  "bond records." },
45
+ // SA's source_notice is the dataset's own page on data.sa.gov.au, so it is the source's URL.
46
+ SA: { file: "sa-rents.json", name: "South Australia", notice_is_data: true,
47
+ hint: "South Australian rents are by suburb, as the SA Housing Trust names it (area: \"Mount Gambier\"; part " +
48
+ "of a name works). There are no councils in this file." },
41
49
  };
42
50
  /** Each state's small-sample rule (tools.mjs SAMPLE_RULES): below it a figure is refused, never given. */
43
- export const RULES = { NSW: SAMPLE_RULES.NSW_RENTS, QLD: SAMPLE_RULES.QLD_RENTS, WA: SAMPLE_RULES.WA_RENTS };
51
+ export const RULES = { NSW: SAMPLE_RULES.NSW_RENTS, QLD: SAMPLE_RULES.QLD_RENTS, WA: SAMPLE_RULES.WA_RENTS,
52
+ SA: SAMPLE_RULES.SA_RENTS };
44
53
  /** Rows shown in one answer; a wider match says how many more there are instead of dropping them silently. */
45
54
  export const MAX_ROWS = 25;
46
55
 
@@ -78,7 +87,7 @@ export async function loadAreaRents(state, { env = process.env, fetchImpl = glob
78
87
  }
79
88
 
80
89
  /**
81
- * Every state's feed, loaded together at start: { NSW: feed-with-origin | null, QLD: ..., WA: ... }. A state whose copy
90
+ * Every state's feed, loaded together at start: { NSW: feed-with-origin | null, QLD: ..., WA: ..., SA: ... }. A state whose copy
82
91
  * was refused is named, with that copy, in its refused property - not enumerable, so the states are all there is to
83
92
  * list - for the tool to say that copy could not be used (withRefused).
84
93
  */
@@ -105,9 +114,16 @@ export const signed = (v) => `${v >= 0 ? "+" : ""}${v}%`;
105
114
  const whyNone = (r) => r.withheld ?? (r.new_bonds == null ? "too few bonds"
106
115
  : `${r.new_bonds} new bond${r.new_bonds === 1 ? "" : "s"} - too few for a median`);
107
116
 
108
- /** One figure's sample and, if it rests on too few bonds, its refusal (see judgeFigure in tools.mjs). */
117
+ /**
118
+ * One figure's sample and, if it rests on too few bonds, its refusal (see judgeFigure in tools.mjs). A count the
119
+ * publisher withholds is in new_bonds_band (DCJ's "10 to 30") or, for SA, new_bonds_range ("1 to 5": the SA Housing
120
+ * Trust's '*'); either is the figure's n_band.
121
+ */
109
122
  export const rentFigure = (r, name, rule) => judgeFigure(r, { name, median: "median_weekly_rent_aud", count: "new_bonds",
110
- band: "new_bonds_band", rule, why: r && r.median_weekly_rent_aud == null ? whyNone(r) : null });
123
+ band: r?.new_bonds_range != null ? "new_bonds_range" : "new_bonds_band", rule,
124
+ why: r && r.median_weekly_rent_aud == null ? whyNone(r) : null });
125
+ /** "Quarter: Jun 2026, against Jun 2025." - or, where no year-before figures are held (SA, one quarter), says so. */
126
+ const against = (f) => (f.compared_with ? `, against ${f.compared_with}` : " (no figures for a year before are held)");
111
127
 
112
128
  function line(r, name, rule = null) {
113
129
  if (r.median_weekly_rent_aud == null) return `${name}: no median (${whyNone(r)}).`;
@@ -156,8 +172,8 @@ export function areaRentsResult({ state, area, council, dwelling_type, bedrooms
156
172
  const info = STATES[state];
157
173
  if (!info) {
158
174
  throw new ToolError(`No area rents for ${JSON.stringify(state)}.`,
159
- `Call area_rents with state NSW, QLD or WA. Victoria is in vic_rents; South Australia, Tasmania, the ACT and ` +
160
- `the Northern Territory are not covered.`);
175
+ `Call area_rents with state NSW, QLD, WA or SA. Victoria is in vic_rents; Tasmania, the ACT and the Northern ` +
176
+ `Territory are not covered.`);
161
177
  }
162
178
  const feed = feeds[state];
163
179
  if (!feed && feeds.refused?.[state]) {
@@ -214,7 +230,7 @@ export function areaRentsResult({ state, area, council, dwelling_type, bedrooms
214
230
  const marked = (r) => ({ ...r, ...refusalMark(judged.get(r)) });
215
231
  const text = [
216
232
  ...staleNote(env),
217
- `${feed.what}. Quarter: ${feed.quarter}, against ${feed.compared_with}.`,
233
+ `${feed.what}. Quarter: ${feed.quarter}${against(feed)}.`,
218
234
  "",
219
235
  ...shown.map(([name, r]) => line(r, name, rule)),
220
236
  ...dropped,
@@ -227,9 +243,9 @@ export function areaRentsResult({ state, area, council, dwelling_type, bedrooms
227
243
  "",
228
244
  `Source: ${feed.attribution}`,
229
245
  `What DwellDelta changed: ${feed.changes_made}`,
230
- citeLine({ source: feed.source, period: `${feed.quarter} (against ${feed.compared_with})`, licence: feed.licence,
231
- n: nWords(figures, rule.unit), url: env.sources[0].source_url, notice: env.sources[0].source_notice_url,
232
- feedUrl, stale: flagged(env) }),
246
+ citeLine({ source: feed.source, period: feed.compared_with ? `${feed.quarter} (against ${feed.compared_with})` : feed.quarter,
247
+ licence: feed.licence, n: nWords(figures, rule.unit), url: env.sources[0].source_url,
248
+ notice: env.sources[0].source_notice_url, feedUrl, stale: flagged(env) }),
233
249
  FOOTER,
234
250
  ].join("\n");
235
251
  return { text, structured: { ...env, state, state_name: info.name, area_kind: kind, quarter: feed.quarter,
@@ -440,9 +456,11 @@ function qldAsked(file, dwelling_type, bedrooms) {
440
456
  function byTypeResult({ state, info, feed, dwelling_type, bedrooms, whole, areas, councils, file, refusedFile = null,
441
457
  hosted = false }, now) {
442
458
  if (!BY_TYPE[state]) {
443
- throw new ToolError(`${info.name} rents are not published by dwelling type or bedrooms.`,
444
- "WA's bond records carry neither. Call area_rents for WA without dwelling_type and bedrooms: every WA figure " +
445
- "is all dwellings together.");
459
+ throw new ToolError(`${info.name} rents are not published by dwelling type or bedrooms.`, state === "WA"
460
+ ? "WA's bond records carry neither. Call area_rents for WA without dwelling_type and bedrooms: every WA figure " +
461
+ "is all dwellings together."
462
+ : `DwellDelta publishes ${info.name}'s rents for all dwellings together only. Call area_rents for ${state} ` +
463
+ `without dwelling_type and bedrooms: every ${state} figure is all dwellings together.`);
446
464
  }
447
465
  // On the hosted server (hosted: remote/endpoint.mjs) the user can set no variable on it: the error says the server
448
466
  // could not load the file, and what to ask instead.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dwelldelta-mcp",
3
- "version": "0.10.1",
4
- "description": "Is an Australian rent fair? A rent check on the ABS rents index, rents by area for four states, NSW median sale prices, and sourced property and lending indicators, for AI agents.",
3
+ "version": "0.11.0",
4
+ "description": "Is an Australian rent fair? A rent check on the ABS rents index, rents by area for five states, NSW median sale prices, and sourced property and lending indicators, for AI agents.",
5
5
  "mcpName": "au.com.dwelldelta/dwelldelta",
6
6
  "license": "MIT",
7
7
  "homepage": "https://dwelldelta.com.au/",
@@ -152,7 +152,7 @@ export function registerReadOnlyTools(server, data, { byTypeWaitMs = null, hoste
152
152
  server.registerTool("data_sources", titled({
153
153
  title: "What DwellDelta covers",
154
154
  description: "The sources behind DwellDelta's figures, their licences, and what it cannot answer (what any one " +
155
- "home sold for, the rent of a single street or home, rents by area outside NSW, Victoria, Queensland and WA, " +
155
+ "home sold for, the rent of a single street or home, rents by area outside NSW, Victoria, Queensland, WA and SA, " +
156
156
  "sale prices outside NSW, advice).",
157
157
  inputSchema: {},
158
158
  outputSchema: OUTPUT_SCHEMAS.data_sources,
@@ -185,11 +185,13 @@ export function registerReadOnlyTools(server, data, { byTypeWaitMs = null, hoste
185
185
  }));
186
186
 
187
187
  server.registerTool("area_rents", titled({
188
- title: "NSW, Queensland and WA rents by postcode, suburb or locality",
188
+ title: "NSW, Queensland, WA and SA rents by postcode, suburb or locality",
189
189
  description: "Median weekly rent of new bonds lodged in the latest quarter, all dwellings together, with the bond " +
190
190
  "count and the change on a year before, for one state per call: NSW by postcode or council (NSW Department of " +
191
191
  "Communities and Justice), QLD by suburb or council (Residential Tenancies Authority), WA by locality " +
192
- "(calculated by DwellDelta from the Government of Western Australia's bond records). Each CC BY 4.0. area or " +
192
+ "(calculated by DwellDelta from the Government of Western Australia's bond records), SA by suburb (SA Housing " +
193
+ "Trust, Private Rent Report; one quarter held, so no change on a year; its publisher's page states no licence, " +
194
+ "the catalogues list CC BY). Each file states CC BY 4.0. area or " +
193
195
  "council names the place the question is about; with neither, the answer is the state's own figure. The " +
194
196
  "figures are new-bond medians, not advertised rents. Each state measures in its own way, so the states are not " +
195
197
  "one series: their figures cannot be added together or compared as one. Each answer states its quarter, its " +
@@ -197,11 +199,11 @@ export function registerReadOnlyTools(server, data, { byTypeWaitMs = null, hoste
197
199
  "give the publisher's figure for that kind of home instead - a two-bedroom unit, a three-bedroom house. Only " +
198
200
  "combinations the publisher reports are answered: one with no published median is said to have none, and " +
199
201
  "neither another area's figure nor the all-dwellings figure stands in for it. Many such figures rest on few " +
200
- "bonds. WA has no figures by dwelling type or bedrooms.",
202
+ "bonds. WA and SA have no figures by dwelling type or bedrooms.",
201
203
  inputSchema: {
202
- state: z.enum(Object.keys(STATES)).describe("NSW, QLD or WA - one state per call"),
204
+ state: z.enum(Object.keys(STATES)).describe("NSW, QLD, WA or SA - one state per call"),
203
205
  area: z.string().optional().describe("NSW: a four-digit postcode (a suburb name returns its postcodes to try). " +
204
- "QLD: a suburb. WA: a locality. Part of a suburb or locality name works"),
206
+ "QLD: a suburb. WA: a locality. SA: a suburb. Part of a suburb or locality name works"),
205
207
  council: z.string().optional().describe("A council (NSW or QLD), or part of its name"),
206
208
  dwelling_type: z.string().optional().describe("NSW and QLD only. NSW (DCJ's labels): House, Townhouse, " +
207
209
  "Flat/Unit, Other. QLD (the RTA's): Flat, House, Townhouse. 'unit' and 'apartment' are read as flat/unit. " +
package/tools.mjs CHANGED
@@ -112,7 +112,7 @@ export async function loadSnapshot({ env = process.env, fetchImpl = globalThis.f
112
112
  }
113
113
 
114
114
  export const FOOTER = "Information, not advice. From DwellDelta (dwelldelta.com.au), built on public data.";
115
- export const SERVER_VERSION = "0.10.1";
115
+ export const SERVER_VERSION = "0.11.0";
116
116
  // The indicators snapshot is rebuilt every Monday. Older than this and the answer says so, in words and in the
117
117
  // structured result, rather than serving a stale figure as current.
118
118
  export const STALE_DAYS = 10;
@@ -280,6 +280,12 @@ export const SAMPLE_RULES = {
280
280
  NSW_RENTS: { unit: "new bonds", min_n: 11, rule: "DCJ reports nothing where 10 or fewer new bonds were lodged" },
281
281
  QLD_RENTS: { unit: "new bonds", min_n: null, rule: "the RTA publishes no median where too few bonds were lodged, and states no number" },
282
282
  WA_RENTS: { unit: "new bonds", min_n: 10, rule: "a locality needs 10 bonds in the quarter for a median (DwellDelta's rule for its own calculation)" },
283
+ // The SA Housing Trust prints a median beside a count it shows as '*' (1 to 5 bonds), and its counts are rounded to
284
+ // the nearest 5 (its note says so of its totals; every count in the file is a multiple of 5) - so a count of 5 is 6 or 7 bonds, and no number is a cut-off. refuse_unknown_count: a figure
285
+ // whose count is not given is refused (judgeFigure), never printed as a median.
286
+ SA_RENTS: { unit: "new bonds", min_n: null, refuse_unknown_count: true,
287
+ rule: "the SA Housing Trust shows '*' for the count where 1 to 5 bonds were lodged, and its counts are " +
288
+ "rounded to the nearest 5; DwellDelta gives no median that rests on a count shown as '*'" },
283
289
  VIC_RENTS: { unit: "new leases", min_n: null, rule: "Homes Victoria publishes no median where too few leases began, and states no number" },
284
290
  NSW_SALES: { unit: "sales", min_n: 11, rule: "DCJ reports nothing where 10 or fewer dwellings sold" },
285
291
  };
@@ -297,7 +303,10 @@ export function judgeFigure(r, { name, median, count, band = null, rule, why = n
297
303
  let refusal = null;
298
304
  if (r == null) refusal = { refused: true, type: "not_published", reason: why ?? "no row in the publisher's table", ...base };
299
305
  else if (r[median] == null) refusal = { refused: true, type: missing, reason: why ?? `too few ${rule.unit}`, ...base };
300
- else if (rule.min_n != null && n != null && n < rule.min_n) {
306
+ else if (rule.refuse_unknown_count && n == null) {
307
+ refusal = { refused: true, type: "too_few_records",
308
+ reason: `${nBand ?? "an unstated number of"} ${rule.unit}, a count the publisher does not give (${rule.rule})`, ...base };
309
+ } else if (rule.min_n != null && n != null && n < rule.min_n) {
301
310
  refusal = { refused: true, type: "too_few_records",
302
311
  reason: `${n} ${rule.unit}, fewer than the ${rule.min_n} a published median needs (${rule.rule})`, ...base };
303
312
  }
@@ -431,7 +440,16 @@ export function rentCheckResult({ city, lease_start, current_rent, proposed_rent
431
440
  n: `not applicable (${INDEX_N})`, url: env.sources[0].source_url, feedUrl: RENTS_FEED_URL, stale: flagged(env) }),
432
441
  FOOTER,
433
442
  ].join("\n");
434
- return { text, structured: { ...env, result: r, limits: LIMITS, sample_size: null, sample_size_note: INDEX_N } };
443
+ return { text, structured: { ...env, result: rounded(r), limits: LIMITS, sample_size: null, sample_size_note: INDEX_N } };
444
+ }
445
+
446
+ // The computed figures to two decimals, as the page prints them; the rents given stay as given (2026-10-29: the
447
+ // hosted server sent indexPct 3.290000000000015 and trackedRent 723.0300000000001). Same fields, same types.
448
+ export const ROUNDED = ["indexPct", "trackedRent", "proposedPct", "gapPoints", "gapDollars"];
449
+
450
+ function rounded(r) {
451
+ return Object.fromEntries(Object.entries(r).map(([k, v]) =>
452
+ [k, ROUNDED.includes(k) && typeof v === "number" ? Math.round(v * 100) / 100 + 0 : v]));
435
453
  }
436
454
 
437
455
  const INDEX_N = "an index of what tenants pay, not a count of leases; the ABS publishes no sample size with it";