dwelldelta-mcp 0.16.1 → 0.17.1
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 +2 -2
- package/README.md +45 -22
- package/area-rents-tool.mjs +30 -9
- package/contribute-tool.mjs +1 -1
- package/cover-tool.mjs +2 -1
- package/output-schemas.mjs +6 -3
- package/package.json +1 -1
- package/pages.mjs +27 -8
- package/register-tools.mjs +42 -20
- package/sale-prices-tool.mjs +21 -15
- package/tools.mjs +40 -10
- package/vendor/act-rents-interim.json +2 -2
- package/vendor/contribute.mjs +7 -4
- package/vendor/indicators.json +12 -12
- package/vendor/nsw-rents.json +7 -2
- package/vendor/nsw-sales.json +11 -5
- package/vendor/nt-rents-interim.json +2 -2
- package/vendor/nz-rents.json +10 -6
- package/vendor/tas-rents.json +3 -3
- package/vendor/vic-rents.json +602 -602
- package/vendor/wa-rents.json +15 -55
- package/vic-rents-tool.mjs +1 -1
package/LICENSE
CHANGED
|
@@ -38,8 +38,8 @@ SA rents: South Australian Housing Trust, Government of South Australia,
|
|
|
38
38
|
Private Rent Report, whose own page states no licence - the national
|
|
39
39
|
catalogues list CC BY 4.0 and CC BY 3.0 AU;
|
|
40
40
|
Tasmanian rents: based on Department of Justice (Tasmania), Rental Bond and
|
|
41
|
-
Rental Data, CC BY 4.0 as data.gov.au
|
|
42
|
-
DwellDelta;
|
|
41
|
+
Rental Data, CC BY 4.0 as read on data.gov.au by DwellDelta's owner in a
|
|
42
|
+
browser, with medians calculated by DwellDelta;
|
|
43
43
|
NSW sale prices: CC BY 4.0, State of New South Wales (Department of
|
|
44
44
|
Communities and Justice); New Zealand rents: CC BY 3.0 NZ, the Ministry of
|
|
45
45
|
Business, Innovation and Employment, Tenancy Services rental bond data; ACT,
|
package/README.md
CHANGED
|
@@ -10,11 +10,11 @@ Seven read-only tools, and one that adds the user's own rent when they ask:
|
|
|
10
10
|
|
|
11
11
|
| Tool | What it answers |
|
|
12
12
|
|---|---|
|
|
13
|
-
| `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); or, given a `place` instead of
|
|
13
|
+
| `rent_check` | a weekly rent, and any proposed new rent, against the ABS rents index for the capital city since the current rent began (`rent_since`, the last rise) or, without it, since the lease began (`lease_start`) (the same arithmetic as the rent check at tools.dwelldelta.com.au); or, given a `place` instead of either month, against that place's median of new bonds or leases, and its quartiles where published (from 0.12.0) |
|
|
14
14
|
| `property_rents` | the rents of a place asked with no state - a suburb, locality or postcode - answered from the state that holds it (NSW, Victoria, Queensland, WA, SA or, from 0.16.0, Tasmania); an NSW or Tasmanian suburb is answered for its postcode, and a name held in more than one state is listed, not chosen (from 0.12.0). From 0.14.0 also a New Zealand council or region (MBIE's bonds for one month, in NZ$, provisional) and an ACT, NT or Tasmanian postcode (interim ABS cover: the rent paid at the 2021 Census, the capital's rents index, sale prices - not new-bond medians; for Tasmania from 0.16.0 only a postcode its bond medians give no figure for) |
|
|
15
15
|
| `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` |
|
|
16
16
|
| `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) |
|
|
17
|
-
| `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), Tasmania by postcode (calculated by DwellDelta from the Department of Justice's bond records, private housing, one month at a time; CC BY 4.0 as data.gov.au
|
|
17
|
+
| `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), Tasmania by postcode (calculated by DwellDelta from the Department of Justice's bond records, private housing, one month at a time; CC BY 4.0 as read on data.gov.au by DwellDelta's owner in a browser); each file states CC BY 4.0 (from 0.6.0; SA from 0.11.0; Tasmania from 0.16.0) |
|
|
18
18
|
| `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 |
|
|
19
19
|
| `data_sources` | the sources, their licences, and what DwellDelta cannot answer |
|
|
20
20
|
| `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) |
|
|
@@ -41,16 +41,18 @@ nothing: it returns the consent wording, the [Contributor Terms](https://tools.d
|
|
|
41
41
|
that wording and you have said yes does it call again, with the token. What is then stored, in AWS Sydney, is the
|
|
42
42
|
suburb (in Western Australia the locality, in Victoria the Homes Victoria suburb group), home type, bedrooms, rent,
|
|
43
43
|
lease month and lease kind, and whether it is a rent you pay or the rent of a
|
|
44
|
-
property you own - never an address, name or email. You get a deletion code; email it to
|
|
44
|
+
property you own - never an address, name or email. You get a deletion code; email it to hello@dwelldelta.com.au
|
|
45
45
|
and the record is deleted. Only your own rent may be added: an assistant must not add a figure it read on a
|
|
46
46
|
website or a listing.
|
|
47
47
|
|
|
48
|
-
From 0.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
From 0.17.0 it sends terms version 2026-11-11, whose Contributor Terms and Privacy Notice give hello@dwelldelta.com.au
|
|
49
|
+
as DwellDelta's address; nothing else in them changed for a contributor. 0.15.0 to 0.16.1 send 2026-11-03, whose
|
|
50
|
+
consent, Contributor Terms and Privacy Notice name the lease kind (whether it is a new lease or a renewal), which
|
|
51
|
+
every contribution has recorded; 0.10.1 to 0.14.0 send 2026-10-27. The endpoint accepts both for now; once it stops
|
|
52
|
+
accepting one, contributions sent under it are refused (HTTP 409) - update to the latest version. From 0.15.0 a
|
|
53
|
+
refusal the endpoint is known to give also says what to do, in the package's own words ("Not added: the
|
|
54
|
+
contribution was not saved (HTTP 409): the terms have changed: update dwelldelta-mcp (npx -y dwelldelta-mcp@latest).");
|
|
55
|
+
any other reason gives the status alone.
|
|
54
56
|
|
|
55
57
|
## NSW sale prices (from 0.7.0)
|
|
56
58
|
|
|
@@ -107,9 +109,10 @@ bonds lodged in the month (community housing left out); a postcode needs 10 bond
|
|
|
107
109
|
30 is a small sample. One month is held, so no change on a year is given. `area` takes a postcode or a suburb name
|
|
108
110
|
the month's bonds were lodged under (each postcode's line lists them), answered for its whole postcode with a note
|
|
109
111
|
saying so. The state alone also gives the state's medians by bedrooms and by dwelling type (`state_breakdown`); no
|
|
110
|
-
postcode has them, so `dwelling_type` and `bedrooms` are refused for a postcode. The licence is CC BY 4.0
|
|
111
|
-
data.gov.au
|
|
112
|
-
`
|
|
112
|
+
postcode has them, so `dwelling_type` and `bedrooms` are refused for a postcode. The licence is CC BY 4.0, read on
|
|
113
|
+
the dataset's page on data.gov.au by DwellDelta's owner in a browser on 2026-11-08: data.gov.au refuses DwellDelta's
|
|
114
|
+
reader, so no automated check reads that page. `cite_as` says "CC BY 4.0 as read on data.gov.au by DwellDelta's owner in a browser" (0.16.x said "as data.gov.au lists it",
|
|
115
|
+
when the licence had been read only in a search result), and `source_url` is data.gov.au's listing.
|
|
113
116
|
|
|
114
117
|
South Australia's file holds one quarter today, so its `compared_with`, year-ago medians and changes are null and no
|
|
115
118
|
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;
|
|
@@ -149,10 +152,11 @@ bonds lodged in an Australian quarter, in Australian dollars. Nothing is compare
|
|
|
149
152
|
"Canterbury Region"; "Wellington, NZ" lists the city and the region, and
|
|
150
153
|
"Wellington" alone, an NSW suburb too, lists all three): MBIE Tenancy Services' median weekly rent of
|
|
151
154
|
the bonds for private tenancies that began in the latest month, with its geometric mean, quartiles and bond count,
|
|
152
|
-
CC BY 3.0 NZ. Every amount is in New Zealand dollars, written NZ$, in fields ending `_nzd`;
|
|
153
|
-
provisional, so no change on a year is given.
|
|
154
|
-
|
|
155
|
-
|
|
155
|
+
CC BY 3.0 NZ. Every amount is in New Zealand dollars, written NZ$, in fields ending `_nzd`; DwellDelta treats the
|
|
156
|
+
data as provisional, so no change on a year is given. The answer's `Provisional:` line, taken from the data file,
|
|
157
|
+
gives what MBIE's page says of this (the file's `source_wording` field says it too; the answer has no such field). A
|
|
158
|
+
figure on fewer than 30 bonds is a small sample; MBIE gives none below 5. The answer carries `country: "NZ"`,
|
|
159
|
+
`currency: "NZD"`, `provisional: true`, `nz_place`, and the place's page at tools.dwelldelta.com.au/area/nz/.
|
|
156
160
|
- **The ACT, the Northern Territory and Tasmania**, by postcode, or the state or its capital alone (from 0.16.0, for
|
|
157
161
|
Tasmania only Hobart, the city as before, and a postcode its bond medians give no figure for, saying so; the state
|
|
158
162
|
alone and a postcode with a bond median are answered from the bonds, as `area_rents` answers them, and Hobart's
|
|
@@ -175,6 +179,8 @@ attribution), `data_as_of`, `snapshot_built`, `snapshot_origin` (`published` for
|
|
|
175
179
|
tools.dwelldelta.com.au, `bundled` for the copy in the package), `server_version`, `retrieved_at`, and `stale` /
|
|
176
180
|
`stale_reason`.
|
|
177
181
|
Every failure is marked `isError` and ends with `Next step:` - an unknown city or geography names the valid ones.
|
|
182
|
+
An unexpected error's next step is "Report this to hello@dwelldelta.com.au." (from 0.17.0; to 0.16.1 the package
|
|
183
|
+
named the owner's own address, which still reaches DwellDelta; the hosted server has given hello@ since 2026-11-10).
|
|
178
184
|
|
|
179
185
|
The indicators are a weekly snapshot, rebuilt every Monday and published at
|
|
180
186
|
https://tools.dwelldelta.com.au/market/indicators.json. The server uses that file when it is newer than the copy it
|
|
@@ -192,6 +198,21 @@ copy city by city (each city's series starts no later and ends no earlier than i
|
|
|
192
198
|
later than the current one; otherwise, or with `DWELLDELTA_OFFLINE=1`, the bundled copy answers.
|
|
193
199
|
`data_as_of` and the `Cite:` line's period say which month the answer runs to.
|
|
194
200
|
|
|
201
|
+
### rent_check from the month the current rent began: `rent_since` (from 0.17.0)
|
|
202
|
+
|
|
203
|
+
- `rent_since` is a new, optional input: the month the current rent began - the last rent rise, or the lease start
|
|
204
|
+
if the rent has not risen - read in the same forms as `lease_start` ("2024-03", "2024-03-01", "March 2024"). Given,
|
|
205
|
+
the comparison runs from it, as the rent check at tools.dwelldelta.com.au does since tools #157.
|
|
206
|
+
- `lease_start` keeps the meaning it was released with: the month the lease began. With `lease_start` alone the
|
|
207
|
+
comparison runs from it as before, and the answer's text opens (after any STALE line) with one line more: "No
|
|
208
|
+
rent_since was given, so this compares from the lease start (lease_start). If the rent has risen since the lease
|
|
209
|
+
began, give rent_since, the month of the last rise." The structured result is unchanged.
|
|
210
|
+
- With both, `rent_since` is the month compared from, and a `rent_since` earlier than `lease_start` is refused (the
|
|
211
|
+
current rent cannot have begun before the lease did). `city` is needed with either.
|
|
212
|
+
- In the structured `result`, `leaseStart` is `lease_start` as given, and is there whenever `lease_start` is; the new
|
|
213
|
+
field `rentSince` is `rent_since` as given, there only when it is. Neither ever stands for the other.
|
|
214
|
+
- `contribute_rent`'s `lease_start` is unchanged: the month the lease began.
|
|
215
|
+
|
|
195
216
|
### rent_check reads common input shapes (from 0.13.0)
|
|
196
217
|
|
|
197
218
|
- `city` is read in any case ("sydney"), as "Greater Sydney", or as "Sydney, NSW" (the state must be the city's
|
|
@@ -233,12 +254,14 @@ later than the current one; otherwise, or with `DWELLDELTA_OFFLINE=1`, the bundl
|
|
|
233
254
|
tools.dwelldelta.com.au, the state's page for the state's own figure, else null), `pages` and `cite_as` (null when
|
|
234
255
|
every figure is refused); the text gains `Page:` and `Cite as:` lines. Results stay text only, readable by clients
|
|
235
256
|
on every protocol version the server accepts. No earlier field changes.
|
|
236
|
-
- (From 0.16.0.) A WA answer's `cite_as`, and its text's `Cite as:` line, say "Median calculated by
|
|
237
|
-
from bond records." before the source ("Medians calculated ..." where the answer gives more than one
|
|
238
|
-
given and the other places matched refused is "Median"): the
|
|
239
|
-
bond and no medians, so the line quoted alone no longer credits
|
|
240
|
-
always one place's, says the same. The field's meaning is unchanged, and no other
|
|
241
|
-
their publishers' own medians.
|
|
257
|
+
- (From 0.16.0.) A WA or Tasmanian answer's `cite_as`, and its text's `Cite as:` line, say "Median calculated by
|
|
258
|
+
DwellDelta from bond records." before the source ("Medians calculated ..." where the answer gives more than one
|
|
259
|
+
median; one given and the other places matched refused is "Median"): the Governments of Western Australia and
|
|
260
|
+
Tasmania publish one row per bond and no medians, so the line quoted alone no longer credits them with DwellDelta's
|
|
261
|
+
figure. The area page's line, always one place's, says the same. The field's meaning is unchanged, and no other
|
|
262
|
+
state's line changes: theirs are their publishers' own medians. From 0.17.0, this line and the
|
|
263
|
+
answer's `derived` hold for both states even if their file loses its `derived` flag: the server writes one line to
|
|
264
|
+
stderr saying so, and nothing else changes.
|
|
242
265
|
- (From 0.16.0.) Tasmania's bond medians (see "Rents by area" above): `area_rents` takes `state: "TAS"`.
|
|
243
266
|
`property_rents` answers from them a Tasmanian postcode with a median, the state alone, and a suburb the month's
|
|
244
267
|
bonds were lodged under that no other file holds ("Sandy Bay"), or any with ", TAS" ("Kingston, TAS"), for its whole
|
package/area-rents-tool.mjs
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* SA's file may hold one quarter only: then compared_with is null, and no answer names a quarter it is compared with.
|
|
10
10
|
*
|
|
11
11
|
* From 0.16.0, Tasmania (postcodes, calculated by DwellDelta from the Department of Justice's bond records, private
|
|
12
|
-
* housing only, tools.dwelldelta.com.au/market/tas-rents.json; CC BY 4.0 as data.gov.au
|
|
12
|
+
* housing only, tools.dwelldelta.com.au/market/tas-rents.json; CC BY 4.0 as read on data.gov.au by DwellDelta's owner in a browser, the file's
|
|
13
13
|
* licence_note). Its file is a MONTH's, not a quarter's: it has month and month_words and no quarter, so a Tasmanian
|
|
14
14
|
* answer's quarter is null and it carries month and month_words, fields of its own (a released field keeps its
|
|
15
15
|
* meaning: quarter is never a month). A suburb name its bonds were lodged under that month finds the whole postcode.
|
|
@@ -32,11 +32,12 @@ import { loadJson, envelope, ToolError, FOOTER, FETCH_TIMEOUT_MS, feedSource, CA
|
|
|
32
32
|
figureFields, nWords, citeLine, staleNote, flagged, refusalMark, isRecord, passes, readChecked, quiet,
|
|
33
33
|
warnPublished, fromCopy } from "./tools.mjs";
|
|
34
34
|
import { quarterKey } from "./vic-rents-tool.mjs";
|
|
35
|
-
import { rentPage, citeFields, withPlace, listedLicence, LISTED } from "./pages.mjs";
|
|
35
|
+
import { rentPage, citeFields, withPlace, listedLicence, LISTED, ALWAYS_CALCULATED, calculatedByUs } from "./pages.mjs";
|
|
36
36
|
import { checkFetched, MAPS } from "./feed-text.mjs";
|
|
37
37
|
|
|
38
38
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
39
|
-
|
|
39
|
+
// DWELLDELTA_LIVE_DIR: a test run on the owner's PC names an empty folder, so a file refused in the store cannot redden it.
|
|
40
|
+
const LIVE_DIR = process.env.DWELLDELTA_LIVE_DIR || join(HERE, "..", "..", "dwelldelta-data", "market");
|
|
40
41
|
export const BUNDLED_DIR = join(HERE, "vendor");
|
|
41
42
|
export const PUBLISHED_BASE = "https://tools.dwelldelta.com.au/market/";
|
|
42
43
|
export const STATES = {
|
|
@@ -92,9 +93,27 @@ const wellFormed = (f, state) => f && f.state === state && periodKey(f, state) >
|
|
|
92
93
|
&& Array.isArray(f.areas) && f.areas.length > 0 && Array.isArray(f.councils) && Array.isArray(f.regions)
|
|
93
94
|
&& f.state_total && Array.isArray(f.limits) && f.licence && f.attribution && f.changes_made;
|
|
94
95
|
|
|
95
|
-
/**
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
/** Where a loaded copy came from, in a warning's words. */
|
|
97
|
+
const ORIGIN_WORDS = { env: "the copy named by DWELLDELTA_STATE_RENTS_DIR", live: "the copy in the owner's store",
|
|
98
|
+
published: "the published copy", bundled: "the bundled copy" };
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* One state's feed and where it came from ("env", "live", "published" or "bundled"); { feed: null } if none. A
|
|
102
|
+
* Tasmanian or WA copy that answers without derived: true is still credited to DwellDelta (pages.mjs ALWAYS_CALCULATED),
|
|
103
|
+
* and warn says so in one line, as it says a refused copy (never stdout: on stdio that is the MCP channel).
|
|
104
|
+
*/
|
|
105
|
+
export async function loadAreaRents(state, opts = {}) {
|
|
106
|
+
const loaded = await loadOneCopy(state, opts);
|
|
107
|
+
if (loaded.feed && ALWAYS_CALCULATED.has(state) && loaded.feed.derived !== true) {
|
|
108
|
+
(opts.warn ?? quiet)(`the ${STATES[state].name} rents feed: ${ORIGIN_WORDS[loaded.origin] ?? "the copy"} does not ` +
|
|
109
|
+
`say derived: true, but ${STATES[state].name}'s medians are always DwellDelta's calculation from bond records: ` +
|
|
110
|
+
"credited to DwellDelta");
|
|
111
|
+
}
|
|
112
|
+
return loaded;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async function loadOneCopy(state, { env = process.env, fetchImpl = globalThis.fetch, liveDir = LIVE_DIR,
|
|
116
|
+
bundledDir = BUNDLED_DIR, warn = quiet } = {}) {
|
|
98
117
|
const { file } = STATES[state];
|
|
99
118
|
const what = `the ${STATES[state].name} rents feed`;
|
|
100
119
|
// A copy that is not this state's feed is no copy: the wrong file under the right name must never answer.
|
|
@@ -410,7 +429,8 @@ export function areaRentsResult({ state, area, council, dwelling_type, bedrooms,
|
|
|
410
429
|
allRefused: res.structured.all_refused === true,
|
|
411
430
|
// "Medians calculated by ..." where the answer gives more than one median; one median, or one given and the rest
|
|
412
431
|
// refused (too few bonds), is "Median" (review of #105: counting places matched said "Medians" for one figure).
|
|
413
|
-
|
|
432
|
+
// Tasmania's and WA's are always DwellDelta's, flag or none (pages.mjs ALWAYS_CALCULATED); others' by the flag.
|
|
433
|
+
calculated: calculatedByUs(state, feed), several: res.structured.figures.filter((f) => !f.refusal).length > 1 });
|
|
414
434
|
if (councils.length) cite.pages = places.filter((p) => p.url).map((p) => ({ place: p.name, url: p.url }));
|
|
415
435
|
const note = resolved?.note ?? null;
|
|
416
436
|
return { text: withPlace(res.text, { note, ...cite }, FOOTER),
|
|
@@ -479,12 +499,13 @@ export function areaRentsResult({ state, area, council, dwelling_type, bedrooms,
|
|
|
479
499
|
return finish({ text, structured: { ...env, state, state_name: info.name, area_kind: kind, quarter: feed.quarter ?? null,
|
|
480
500
|
compared_with: feed.compared_with,
|
|
481
501
|
// Tasmania (0.16.0): its month, and the state's breakdown (whole state only).
|
|
482
|
-
// licence_note: where the licence was read (Tasmania:
|
|
502
|
+
// licence_note: where the licence was read (Tasmania: by DwellDelta's owner, by hand).
|
|
483
503
|
...(monthly ? { month: feed.month, month_words: feed.month_words,
|
|
484
504
|
licence_note: feed.licence_note ?? null,
|
|
485
505
|
state_breakdown: breakdown ? { by_bedrooms: markRows(breakdown.by_bedrooms),
|
|
486
506
|
by_dwelling_type: markRows(breakdown.by_dwelling_type) } : null } : {}),
|
|
487
|
-
derived:
|
|
507
|
+
// derived: the medians are DwellDelta's own calculation, as cite_as says.
|
|
508
|
+
derived: calculatedByUs(state, feed),
|
|
488
509
|
state_total: whole ? marked(feed.state_total) : null, regions: regions.map(marked),
|
|
489
510
|
councils: councils.map(marked), areas: areas.map(marked),
|
|
490
511
|
truncated: dropped.length > 0, limits: feed.limits, changes_made: feed.changes_made,
|
package/contribute-tool.mjs
CHANGED
|
@@ -42,7 +42,7 @@ export function contributionList(nswSuburbs, places = JSON.parse(readFileSync(PL
|
|
|
42
42
|
export const TERMS_URL = "https://tools.dwelldelta.com.au/terms/";
|
|
43
43
|
export const PRIVACY_URL = "https://tools.dwelldelta.com.au/privacy/";
|
|
44
44
|
export const TOKEN_MINUTES = 30;
|
|
45
|
-
export const DELETE_BY = "
|
|
45
|
+
export const DELETE_BY = "hello@dwelldelta.com.au";
|
|
46
46
|
|
|
47
47
|
export const NOT_COLLECTING = "Contributions are not being collected yet, so nothing was stored or sent.";
|
|
48
48
|
export const WHOSE_REFUSAL = "Only the user's own rent can be added: their own tenancy, or a property they own. " +
|
package/cover-tool.mjs
CHANGED
|
@@ -34,7 +34,8 @@ import { SITE, slug } from "./pages.mjs";
|
|
|
34
34
|
import { checkFetched } from "./feed-text.mjs";
|
|
35
35
|
|
|
36
36
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
37
|
-
|
|
37
|
+
// DWELLDELTA_LIVE_DIR: a test run on the owner's PC names an empty folder, so a file refused in the store cannot redden it.
|
|
38
|
+
const LIVE_DIR = process.env.DWELLDELTA_LIVE_DIR || join(HERE, "..", "..", "dwelldelta-data", "market");
|
|
38
39
|
const BUNDLED_DIR = join(HERE, "vendor");
|
|
39
40
|
const PUBLISHED_BASE = "https://tools.dwelldelta.com.au/market/";
|
|
40
41
|
export const NZ_FILE = "nz-rents.json";
|
package/output-schemas.mjs
CHANGED
|
@@ -166,11 +166,13 @@ const cited = { page_url: opt(nstr), cite_as: opt(nstr) };
|
|
|
166
166
|
|
|
167
167
|
export const OUTPUT_SCHEMAS = {
|
|
168
168
|
// result: the comparison - the ABS rents index's move from startUsed to latest, and the rent it tracks to. Every
|
|
169
|
-
// field of it, and the limits, are the rent check's own (vendor/rent-check.mjs), not a data file's.
|
|
169
|
+
// field of it, and the limits, are the rent check's own (vendor/rent-check.mjs), not a data file's. leaseStart is
|
|
170
|
+
// lease_start as given, the month the lease began, and is there whenever lease_start is; rentSince (new, 2026-11-12) is
|
|
171
|
+
// rent_since as given, the month the current rent began, and is there only when it is. Neither stands for the other.
|
|
170
172
|
rent_check: obj({
|
|
171
173
|
...envelope,
|
|
172
174
|
result: obj({
|
|
173
|
-
city: str, leaseStart: str, startUsed: str, latest: str, truncated: z.boolean(),
|
|
175
|
+
city: str, leaseStart: opt(str), rentSince: opt(str), startUsed: str, latest: str, truncated: z.boolean(),
|
|
174
176
|
indexPct: z.number(), currentRent: z.number(), trackedRent: z.number(),
|
|
175
177
|
proposedRent: opt(z.number()), proposedPct: opt(z.number()), gapPoints: opt(z.number()), gapDollars: opt(z.number()),
|
|
176
178
|
}).nullable(),
|
|
@@ -219,7 +221,8 @@ export const OUTPUT_SCHEMAS = {
|
|
|
219
221
|
// shown place with a page; cite_as, a line to quote with a figure from the answer.
|
|
220
222
|
// Two kinds of answer: all dwellings together (state_total, regions, councils, areas), or by dwelling type and
|
|
221
223
|
// bedrooms (asked, rows) - so the keys of each kind are optional. area_kind: postcode, suburb or locality, from the
|
|
222
|
-
// file. derived: the medians are DwellDelta's own calculation from the bond records (WA
|
|
224
|
+
// file. derived: the medians are DwellDelta's own calculation from the bond records (WA and Tasmania: always true for
|
|
225
|
+
// both, whether or not the file still says so, pages.mjs ALWAYS_CALCULATED). A row's figure is the
|
|
223
226
|
// publisher's cell, as the file gives it; null where none is published.
|
|
224
227
|
area_rents: obj({
|
|
225
228
|
...envelope,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dwelldelta-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"description": "Australian rents by area for six states, New Zealand rents by council and region and interim ABS cover for the ACT and NT, asked by place with no state, a rent placed against its local median, NSW median sale prices, an ABS rents index check, and sourced property and lending indicators, for AI agents.",
|
|
5
5
|
"mcpName": "au.com.dwelldelta/dwelldelta",
|
|
6
6
|
"license": "MIT",
|
package/pages.mjs
CHANGED
|
@@ -61,8 +61,8 @@ export function salePage(row) {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
|
-
* What a cite_as line says, before its source, where the file's medians are DwellDelta's own calculation (
|
|
65
|
-
*
|
|
64
|
+
* What a cite_as line says, before its source, where the file's medians are DwellDelta's own calculation (WA's and
|
|
65
|
+
* Tasmania's, whose Governments publish one row per bond and no medians: calculatedByUs below): without it, a line quoted alone
|
|
66
66
|
* would credit the publisher with DwellDelta's figure (owner, 2026-11-04: "fix the WA cite line"). The area pages'
|
|
67
67
|
* "Cite as" line (tools/render-area-pages.mjs citeLine) says the same words.
|
|
68
68
|
*/
|
|
@@ -72,19 +72,38 @@ export const CALCULATED = "Median calculated by DwellDelta from bond records";
|
|
|
72
72
|
export const CALCULATED_SEVERAL = "Medians calculated by DwellDelta from bond records";
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* (
|
|
75
|
+
* The states whose rents medians are always DwellDelta's own calculation, whatever the file's flags say: Tasmania's
|
|
76
|
+
* Department of Justice and Western Australia's Department of Mines, Industry Regulation and Safety publish one row per
|
|
77
|
+
* bond and no medians (dwelldelta-local tools/macro/tas_rents.py and wa_rents.py), so every median in tas-rents.json and
|
|
78
|
+
* wa-rents.json is DwellDelta's. The same set as the area pages' ALWAYS_CALCULATED (tools/render-area-pages.mjs, tools
|
|
79
|
+
* #175 and #176); this package is published on its own and cannot import it, so tests/mcp-pages.test.mjs holds the two
|
|
80
|
+
* sets equal. A file of one of these states that lost its derived: true is still credited to DwellDelta (the safe
|
|
81
|
+
* default: a line never credits the Department with DwellDelta's median), and the loader says so in one line to its
|
|
82
|
+
* warn (area-rents-tool.mjs loadAreaRents).
|
|
78
83
|
*/
|
|
79
|
-
export const
|
|
84
|
+
export const ALWAYS_CALCULATED = new Set(["TAS", "WA"]);
|
|
85
|
+
/**
|
|
86
|
+
* Whether a state's rents medians are DwellDelta's own calculation: a state in ALWAYS_CALCULATED, or a file that says
|
|
87
|
+
* derived: true. What an answer's cite_as says before its source, and its derived field: who calculated the medians.
|
|
88
|
+
*/
|
|
89
|
+
export const calculatedByUs = (state, feed) => ALWAYS_CALCULATED.has(state) || feed?.derived === true;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* A licence DwellDelta's reader could not read, so a person read it by hand (Tasmania, from 0.16.0: data.gov.au refuses
|
|
93
|
+
* DwellDelta's reader; until 2026-11-08 the licence was "as data.gov.au lists it", read in a search result, and on
|
|
94
|
+
* 2026-11-08 DwellDelta's owner read it on the dataset's page in a browser): the cite_as line says where and how the
|
|
95
|
+
* licence was read, after the licence, as the area pages' Cite as line does (render-area-pages.mjs LISTED, held to this
|
|
96
|
+
* by tests/mcp-pages.test.mjs). It never claims an automated read.
|
|
97
|
+
*/
|
|
98
|
+
export const LISTED = { TAS: "as read on data.gov.au by DwellDelta's owner in a browser" };
|
|
80
99
|
export const listedLicence = (state, licence) => (licence && LISTED[state] ? `${licence} ${LISTED[state]}` : licence);
|
|
81
100
|
|
|
82
101
|
/**
|
|
83
102
|
* The fields an answer gains (new in 0.12.0; no earlier field changes): page_url, the one page for the answer (the
|
|
84
103
|
* place's own when one place is shown, the state's when the state's own figure is), else null; pages, every shown
|
|
85
104
|
* place that has a page; cite_as, a line to quote with a figure from the answer - null when the answer gives no
|
|
86
|
-
* figure to quote (every one refused, allRefused: review of #74). calculated: the
|
|
87
|
-
* (CALCULATED is said before the source, or CALCULATED_SEVERAL where the answer gives more than one median, several;
|
|
105
|
+
* figure to quote (every one refused, allRefused: review of #74). calculated: the medians are DwellDelta's
|
|
106
|
+
* (calculatedByUs; CALCULATED is said before the source, or CALCULATED_SEVERAL where the answer gives more than one median, several;
|
|
88
107
|
* from 0.16.0).
|
|
89
108
|
*/
|
|
90
109
|
export function citeFields({ state, places, whole, what, period, by, licence, allRefused = false, calculated = false,
|
package/register-tools.mjs
CHANGED
|
@@ -79,13 +79,25 @@ export const SERVER_INSTRUCTIONS = "DwellDelta answers Australian property quest
|
|
|
79
79
|
"no state needed; area_rents one known state of NSW, Queensland, WA, SA or Tasmania - its own figure, a council " +
|
|
80
80
|
"(NSW, QLD), or part of a name (QLD, WA, SA, TAS); vic_rents Victoria's regions and suburb groups; rent_check a given rent. " +
|
|
81
81
|
PLACE_INSTRUCTIONS;
|
|
82
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Where an unexpected error tells the caller to report it: hello@dwelldelta.com.au for both servers. The hosted
|
|
84
|
+
* server has given it since 2026-11-10 (owner, T6 of tools #36's follow-ups); the npm package (the stdio server) from
|
|
85
|
+
* 0.17.0, its own release (owner, 2026-11-12), when it stopped giving the owner's own address. The two keys stay so a
|
|
86
|
+
* test can hold each server's text on its own (mcp/test/hosted-contact.test.mjs).
|
|
87
|
+
*/
|
|
88
|
+
export const REPORT_TO = Object.freeze({ local: "hello@dwelldelta.com.au", hosted: "hello@dwelldelta.com.au" });
|
|
89
|
+
const guardTo = (address) => (fn) => async (args) => {
|
|
83
90
|
try {
|
|
84
91
|
return ok(await fn(args));
|
|
85
92
|
} catch (err) {
|
|
86
|
-
return fail(err instanceof ToolError ? err : new ToolError(err.message,
|
|
93
|
+
return fail(err instanceof ToolError ? err : new ToolError(err.message, `Report this to ${address}.`));
|
|
87
94
|
}
|
|
88
95
|
};
|
|
96
|
+
/** A handler's answer, or its error as an MCP error result: the stdio server's, naming REPORT_TO.local. */
|
|
97
|
+
export const guard = guardTo(REPORT_TO.local);
|
|
98
|
+
const localGuard = guard;
|
|
99
|
+
/** The same, for the hosted server (registerReadOnlyTools with hosted: true), naming REPORT_TO.hosted. */
|
|
100
|
+
export const hostedGuard = guardTo(REPORT_TO.hosted);
|
|
89
101
|
/**
|
|
90
102
|
* rent_check's inputs in the shapes agents send them (2026-11-03: the hosted logs held 4 of 4 genuine rent_check
|
|
91
103
|
* calls refused; the logs keep no arguments, so the cause is inferred - a lower-case city, a rent sent as text, a
|
|
@@ -165,9 +177,13 @@ export function readMonth(v) {
|
|
|
165
177
|
}
|
|
166
178
|
return v;
|
|
167
179
|
}
|
|
168
|
-
|
|
180
|
+
const monthRefusal = (field, what) => `${field} is ${what}, as "2024-03" (YYYY-MM), "2024-03-01" ` +
|
|
169
181
|
"(YYYY-MM-DD, a real date; its month is used) or \"March 2024\" (a month's name or its first three letters, then " +
|
|
170
182
|
"the year).";
|
|
183
|
+
export const MONTH_REFUSAL = monthRefusal("lease_start", "the month the lease began");
|
|
184
|
+
// rent_since (2026-11-12): a field of its own, so lease_start keeps the meaning it was released with.
|
|
185
|
+
export const RENT_SINCE_REFUSAL = monthRefusal("rent_since", "the month the current rent began (the last rent rise, " +
|
|
186
|
+
"or the lease start if the rent has not risen)");
|
|
171
187
|
|
|
172
188
|
/** An answer with a first line naming the arguments it did not use, and why (0.12.0, rent_check's two modes). */
|
|
173
189
|
const ignoring = (res, keys, why) => (keys.length ? { text: `Not used: ${keys.join(", ")} (${why}).\n${res.text}`,
|
|
@@ -252,6 +268,8 @@ const BY_TYPE_LATE = Symbol("by-type files not loaded in time");
|
|
|
252
268
|
export function registerReadOnlyTools(server, data, { byTypeWaitMs = null, hosted = false } = {}) {
|
|
253
269
|
const { rents, suburbs, snapshot, vic, areaRents, rentsByType, nswSales } = data;
|
|
254
270
|
const refused = data.refused ?? {};
|
|
271
|
+
// The hosted server's errors give its own contact address (REPORT_TO); every tool below, property_rents included.
|
|
272
|
+
const guard = hosted ? hostedGuard : localGuard;
|
|
255
273
|
const needSnapshot = () => {
|
|
256
274
|
if (!snapshot && refused.snapshot) {
|
|
257
275
|
throw new ToolError(`The indicators snapshot could not be used: ${refused.snapshot} failed the check of the file.`,
|
|
@@ -269,21 +287,20 @@ export function registerReadOnlyTools(server, data, { byTypeWaitMs = null, hoste
|
|
|
269
287
|
|
|
270
288
|
server.registerTool("rent_check", titled({
|
|
271
289
|
title: "Australian rent check",
|
|
272
|
-
description: "Compares a weekly rent, and any proposed
|
|
273
|
-
"
|
|
274
|
-
"
|
|
275
|
-
"
|
|
276
|
-
"NSW, VIC, QLD, WA, SA or TAS) gives instead where the rent sits against that place's median of new bonds, and " +
|
|
277
|
-
"between its quartiles where the publisher gives them.",
|
|
290
|
+
description: "Compares a weekly rent, and any proposed rent, with how the ABS rents index for the tenant's capital " +
|
|
291
|
+
"city has moved since rent_since, else lease_start: city-wide, not suburb-level. Information, not advice, with " +
|
|
292
|
+
"the months compared, the source and the limits. Without either month, place (in NSW, VIC, QLD, WA, SA or TAS) " +
|
|
293
|
+
"places the rent against its median of new bonds, and its quartiles where published.",
|
|
278
294
|
inputSchema: {
|
|
279
295
|
// Each is read through z.preprocess (readCity, readMonth, readRent above): tools/list still declares the
|
|
280
296
|
// canonical form, byte for byte (current_rent's description sits inside, where it keeps its place in the JSON
|
|
281
297
|
// Schema), and the handler still receives it; the refusals name every form that is read.
|
|
282
|
-
city: z.preprocess(readCity(cities), z.enum(cities, { error: cityRefusal(cities) })).optional().describe("Capital city whose ABS rents index the rent is compared with
|
|
298
|
+
city: z.preprocess(readCity(cities), z.enum(cities, { error: cityRefusal(cities) })).optional().describe("Capital city whose ABS rents index the rent is compared with"),
|
|
283
299
|
lease_start: z.preprocess(readMonth, z.string({ error: MONTH_REFUSAL }).regex(/^\d{4}-(0[1-9]|1[0-2])$/, { error: MONTH_REFUSAL })).optional().describe("Month the lease began, YYYY-MM"),
|
|
300
|
+
rent_since: z.preprocess(readMonth, z.string({ error: RENT_SINCE_REFUSAL }).regex(/^\d{4}-(0[1-9]|1[0-2])$/, { error: RENT_SINCE_REFUSAL })).optional().describe("Month current rent began (last rise, else lease start), YYYY-MM"),
|
|
284
301
|
current_rent: z.preprocess(readRent, z.number({ error: rentRefusal("current_rent") }).positive({ error: rentRefusal("current_rent") }).describe("Current weekly rent in Australian dollars")),
|
|
285
|
-
proposed_rent: z.preprocess(readRent, z.number({ error: rentRefusal("proposed_rent") }).positive({ error: rentRefusal("proposed_rent") })).optional().describe("Proposed
|
|
286
|
-
place: z.string().optional().describe("Without
|
|
302
|
+
proposed_rent: z.preprocess(readRent, z.number({ error: rentRefusal("proposed_rent") }).positive({ error: rentRefusal("proposed_rent") })).optional().describe("Proposed weekly rent in Australian dollars"),
|
|
303
|
+
place: z.string().optional().describe("Without either month: a suburb, locality or postcode; a state may follow (\"Richmond, VIC\")"),
|
|
287
304
|
dwelling_type: z.string().optional().describe("With place: as area_rents (NSW and QLD only)"),
|
|
288
305
|
bedrooms: z.string().optional().describe("With place: as area_rents (NSW and QLD only)"),
|
|
289
306
|
},
|
|
@@ -291,15 +308,19 @@ export function registerReadOnlyTools(server, data, { byTypeWaitMs = null, hoste
|
|
|
291
308
|
annotations: readOnly,
|
|
292
309
|
}), guard(async (args) => {
|
|
293
310
|
// With lease_start: the city-wide index check, as it has been since 0.1.0. Without it: the local mode (0.12.0).
|
|
294
|
-
|
|
311
|
+
// rent_since (2026-11-12) opens the same check; given, it is the month compared from (rentCheckResult).
|
|
312
|
+
if (args.lease_start != null || args.rent_since != null) {
|
|
313
|
+
// The month fields given, in words; with lease_start alone, "lease_start", so its answers are as they were.
|
|
314
|
+
const given = [args.rent_since != null ? "rent_since" : null, args.lease_start != null ? "lease_start" : null]
|
|
315
|
+
.filter(Boolean).join(" and ");
|
|
295
316
|
if (args.city == null) {
|
|
296
|
-
throw new ToolError(
|
|
297
|
-
`Give city (${Object.keys(rents.cities).sort().join(", ")}), or leave
|
|
317
|
+
throw new ToolError(`rent_check with ${given} needs city: the ABS rents index is by capital city.`,
|
|
318
|
+
`Give city (${Object.keys(rents.cities).sort().join(", ")}), or leave ${given} out and give place for ` +
|
|
298
319
|
"the local median of new bonds.");
|
|
299
320
|
}
|
|
300
321
|
// An argument of the other mode is said to be unused, never silently dropped.
|
|
301
322
|
return ignoring(rentCheckResult(args, rents), ["place", "dwelling_type", "bedrooms"].filter((k) => args[k] != null),
|
|
302
|
-
|
|
323
|
+
`with ${given}, the rent is compared with the city's ABS rents index; leave ${given} out for the place's ` +
|
|
303
324
|
"median of new bonds");
|
|
304
325
|
}
|
|
305
326
|
if (args.place == null || !String(args.place).trim()) {
|
|
@@ -313,10 +334,11 @@ export function registerReadOnlyTools(server, data, { byTypeWaitMs = null, hoste
|
|
|
313
334
|
|
|
314
335
|
server.registerTool("market_indicators", titled({
|
|
315
336
|
title: "Australian property market indicators",
|
|
316
|
-
description: "Latest
|
|
337
|
+
description: "Latest Australian property market indicators - RBA cash rate, unemployment, wage growth, " +
|
|
317
338
|
"rents by capital city, new housing lending, lending standards and arrears, dwelling approvals and completions - " +
|
|
318
|
-
"each with its period, source, licence and limits.
|
|
319
|
-
"
|
|
339
|
+
"each with its period, source, licence and limits. Some figures are the publisher's own and some are " +
|
|
340
|
+
"calculated by DwellDelta from the publisher's figures; none is a forecast. geography, if given, narrows the " +
|
|
341
|
+
"answer to the figures for one place.",
|
|
320
342
|
inputSchema: { geography: z.string().optional().describe("NSW, Australia, or a capital city") },
|
|
321
343
|
outputSchema: OUTPUT_SCHEMAS.market_indicators,
|
|
322
344
|
annotations: readOnly,
|
|
@@ -368,7 +390,7 @@ export function registerReadOnlyTools(server, data, { byTypeWaitMs = null, hoste
|
|
|
368
390
|
"Tenancies Authority), WA by locality (calculated by DwellDelta from the Government of Western Australia's bond " +
|
|
369
391
|
"records), SA by suburb (SA Housing Trust, Private Rent Report; its page states no licence, the catalogues " +
|
|
370
392
|
"list CC BY), TAS by postcode (calculated by DwellDelta from Department of Justice bond records, private " +
|
|
371
|
-
"housing; licence
|
|
393
|
+
"housing; licence read on data.gov.au by DwellDelta's owner in a browser); SA and TAS hold one period, so no change on a year. Each file " +
|
|
372
394
|
"states CC BY 4.0. The figures are new-bond medians, not advertised rents. Each state measures in its own way: " +
|
|
373
395
|
"the states are not one series, and their figures cannot be added or compared as one. Each answer states its " +
|
|
374
396
|
"period, its source line " +
|
package/sale-prices-tool.mjs
CHANGED
|
@@ -34,7 +34,8 @@ import { salePage, citeFields, withPlace } from "./pages.mjs";
|
|
|
34
34
|
import { checkFetched } from "./feed-text.mjs";
|
|
35
35
|
|
|
36
36
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
37
|
-
|
|
37
|
+
// DWELLDELTA_LIVE_DIR: a test run on the owner's PC names an empty folder, so a file refused in the store cannot redden it.
|
|
38
|
+
const LIVE_DIR = process.env.DWELLDELTA_LIVE_DIR || join(HERE, "..", "..", "dwelldelta-data", "market");
|
|
38
39
|
export const SALES_FILE = "nsw-sales.json";
|
|
39
40
|
export const DWELLING_TYPES = ["total", "non_strata", "strata"];
|
|
40
41
|
const LABEL = { total: "all dwellings", non_strata: "houses (non-strata)", strata: "units and town houses (strata)" };
|
|
@@ -42,19 +43,24 @@ const LABEL = { total: "all dwellings", non_strata: "houses (non-strata)", strat
|
|
|
42
43
|
* another threshold included - is a mark this version does not know, and is not called UNUSUAL. */
|
|
43
44
|
const REASONS = ["the median equals a quartile: many sales at one identical price", "the third quartile is more than 3 times the median"];
|
|
44
45
|
/** `unusual_part` as the builder writes it: "its strata row is marked unusual_prices (...), and that row is 466 of this total's 613 sales". */
|
|
45
|
-
const KNOWN_PART = new RegExp(`^its (
|
|
46
|
+
const KNOWN_PART = new RegExp(`^its (non-strata|strata) row is marked unusual_prices \\((${REASONS.join("|")})\\), and that row is (\\d+) of this total's (\\d+) sales$`);
|
|
47
|
+
const PART_KEY = { "non-strata": "non_strata", strata: "strata" };
|
|
46
48
|
const has = (v) => v != null && v !== false && v !== "";
|
|
47
49
|
const knownMark = (v) => REASONS.includes(v);
|
|
48
|
-
/** The builder's note, and
|
|
49
|
-
|
|
50
|
+
/** The builder's note, and the rows bear it out: its second number is this total's sales and its first is more than
|
|
51
|
+
* half of that, and the row it names is in the same place, carries the mark the note gives, and has that many sales.
|
|
52
|
+
* (tools #21: the note was read as "mostly a marked row" without looking at the row it names.) */
|
|
53
|
+
function knownPart(r, g) {
|
|
50
54
|
const m = typeof r.unusual_part === "string" ? KNOWN_PART.exec(r.unusual_part) : null;
|
|
51
|
-
|
|
55
|
+
if (m === null || Number(m[4]) !== r.sales || !(2 * Number(m[3]) > Number(m[4]))) return false;
|
|
56
|
+
const named = g?.[PART_KEY[m[1]]];
|
|
57
|
+
return named != null && named.unusual_prices === m[2] && named.sales === Number(m[3]);
|
|
52
58
|
}
|
|
53
|
-
/** What a row carries, as this version can read it: a mark and a note, each "known", "unknown" or null.
|
|
54
|
-
* known only as the builder writes it: on a total, with no mark of the total's own. */
|
|
55
|
-
function reads(r, type) {
|
|
59
|
+
/** What a row of place g carries, as this version can read it: a mark and a note, each "known", "unknown" or null.
|
|
60
|
+
* The note is known only as the builder writes it: on a total, with no mark of the total's own. */
|
|
61
|
+
function reads(r, type, g) {
|
|
56
62
|
const mark = !has(r.unusual_prices) ? null : knownMark(r.unusual_prices) ? "known" : "unknown";
|
|
57
|
-
const part = !has(r.unusual_part) ? null : type === "total" && mark === null && knownPart(r) ? "known" : "unknown";
|
|
63
|
+
const part = !has(r.unusual_part) ? null : type === "total" && mark === null && knownPart(r, g) ? "known" : "unknown";
|
|
58
64
|
return { mark, part };
|
|
59
65
|
}
|
|
60
66
|
const HINT = "NSW sale prices are by four-digit postcode (area: \"2148\") or by council (council: \"Blacktown\").";
|
|
@@ -107,7 +113,7 @@ export function saleFigure(r, label) {
|
|
|
107
113
|
missing: r && r.withheld ? "too_few_records" : "not_published" });
|
|
108
114
|
}
|
|
109
115
|
|
|
110
|
-
function line(r, name, type) {
|
|
116
|
+
function line(r, name, type, g) {
|
|
111
117
|
const label = `${name}, ${LABEL[type]}`;
|
|
112
118
|
if (r == null) return `${label}: no row in DCJ's table.`;
|
|
113
119
|
if (r.median_price_k_aud == null) return `${label}: no median (${r.withheld ?? "not reported"}).`;
|
|
@@ -119,9 +125,9 @@ function line(r, name, type) {
|
|
|
119
125
|
const change = r.change_pct == null ? "" : `, ${signed(r.change_pct)} on a year before`;
|
|
120
126
|
const spread = r.first_quartile_k_aud == null || r.third_quartile_k_aud == null ? ""
|
|
121
127
|
: `; half of sales between ${price(r.first_quartile_k_aud)} and ${price(r.third_quartile_k_aud)}`;
|
|
122
|
-
// UNUSUAL is the word the tool's description says means "set by a few very large sales
|
|
123
|
-
// reasons
|
|
124
|
-
const carries = reads(r, type);
|
|
128
|
+
// UNUSUAL is the word the tool's description says means "set by a few very large sales or by many sales at one
|
|
129
|
+
// identical price", so only the two reasons the builder writes, which say those two things, are printed under it.
|
|
130
|
+
const carries = reads(r, type, g);
|
|
125
131
|
const mark = carries.mark === null ? ""
|
|
126
132
|
: (carries.mark === "known" ? ` UNUSUAL - ${r.unusual_prices}`
|
|
127
133
|
: ` MARKED (unusual_prices) - ${typeof r.unusual_prices === "string" ? r.unusual_prices : "a mark this version of the tool cannot put in words"}`) +
|
|
@@ -185,7 +191,7 @@ export function salePricesResult({ area, council, dwelling_type } = {}, feed, no
|
|
|
185
191
|
const shown = [...(whole ? [["New South Wales (whole state)", feed.state_total]] : []),
|
|
186
192
|
...councils.map((g) => [`${g.council} (council)`, g]), ...areas.map((g) => [`${g.area} (postcode)`, g])];
|
|
187
193
|
// Only rows that are shown and have a median are spoken of: line() says nothing of a mark on any other.
|
|
188
|
-
const seen = shown.flatMap(([, g]) => types.filter((t) => g[t] && g[t].median_price_k_aud != null).map((t) => reads(g[t], t)));
|
|
194
|
+
const seen = shown.flatMap(([, g]) => types.filter((t) => g[t] && g[t].median_price_k_aud != null).map((t) => reads(g[t], t, g)));
|
|
189
195
|
const marked = seen.some((s) => s.mark !== null), noted = seen.some((s) => s.part !== null);
|
|
190
196
|
const setByAFew = seen.some((s) => s.mark === "known"), mostlyARow = seen.some((s) => s.part === "known");
|
|
191
197
|
const unknown = seen.some((s) => s.mark === "unknown" || s.part === "unknown");
|
|
@@ -200,7 +206,7 @@ export function salePricesResult({ area, council, dwelling_type } = {}, feed, no
|
|
|
200
206
|
`${feed.what}. Quarter: ${feed.quarter}, against ${feed.compared_with}. Medians of homes sold - not asking ` +
|
|
201
207
|
"prices, not valuations, and not the price or value of any one home.",
|
|
202
208
|
"",
|
|
203
|
-
...shown.flatMap(([name, g]) => types.map((t) => line(g[t], name, t))),
|
|
209
|
+
...shown.flatMap(([name, g]) => types.map((t) => line(g[t], name, t, g))),
|
|
204
210
|
...dropped,
|
|
205
211
|
...(whole ? ["", `${feed.areas.length.toLocaleString("en-AU")} postcode rows and ${feed.councils.length} councils ` +
|
|
206
212
|
"are available: call again with area or council."] : []),
|