-
Notifications
You must be signed in to change notification settings - Fork 1
Residential Registry Valuations
valueguard edited this page Apr 8, 2021
·
13 revisions
The valuations fetched here are made using the same model described here: https://github.com/Valueguard-Index-Sweden/valueguard-python-client/wiki/valuations
The code below gives an example of how to use the client to fetch all the valuations.
import valueguard
vgClient = valueguard.Client()
vgClient.authenticate("<username>", "<password>")
mydb = mysql.connector.connect(
host="<db_host>",
user="<db_username>",
passwd="<db_password>",
database="<db_name>"
)
mycursor = mydb.cursor()
limit = 20000
i = 0
while True:
data = vgClient.residential_registry_valuations(i, limit)
for residence in data['residences']:
residence_id = residence['id']
for valuation in residence['valuations']:
sql = "INSERT IGNORE INTO <RESIDENTIAL_REGISTRY_VALUATIONS-TABLE> (`id`,`valuation_date`, `value`, `quality`) " \
"VALUES (`%s`,`%s`,`%s`,`%s`)"
sql_val = (residence_id, valuation['valuation_date'], valuation['value'], valuation['quality'])
mycursor.execute(sql, sql_val)
mydb.commit()
print(sql_val)
fetched_data = data['meta_data']['offset'] + data['meta_data']['response_rows']
if data['meta_data']['total_nr_records'] <= data['meta_data']['offset'] + data['meta_data']['response_rows']:
break
i += data['meta_data']['response_rows']
Example:
import valueguard
vgClient = valueguard.Client()
vgClient.authenticate("<username>", "<password>")
print (vgClient.residential_registry_valuations(offset=0, limit=1, search_criteria={
"id":"1144425"
}))
{
"meta_data": {
"total_nr_records": 1,
"offset": 0,
"limit": 1,
"response_rows": 1
},
"residences": [
{
"id": "1144675",
"valuations": [
{
"value": 1725427,
"quality": 5,
"valuation_date": "2019-10-27"
}
]
}
]
}
Field name | Type | Example | Description |
---|---|---|---|
id | varchar(255) | 1234 | The id of the object |
valuation_date | varchar(10) | 2018-02-13 | Date of valuation |
value | int(11) | 1234 | Valuation in SEK |
quality | tinyiny(1) | 4 | Quality of valuations |
Name | Description |
---|---|
1 | Should not be used |
2 | Low quality |
3 | Okay |
4 | Good |
5 | High quality |
Sometimes we are unable to give a valuation for an object. For example, sometimes there are no valid objects to base it on. In such cases, the value is -1 in both 'price' and 'quality'.
Field name | Description |
---|---|
id | The id of the object |
curl https://api.valueguard.se/v1/residential/registry/valuations?access_token={ACCESS_TOKEN}&offset={OFFSET}&limit={LIMIT}&{SEARCH_CRITERA AS VALUE-KEY PAIR &id="123"...}
- General description
- Residential Registry
- Residential Registry Markups
- Residential Registry Valuations
- General description
- Index normalized
- Index definitions*
- Publishing calendar
- Best index
- Index recount
- Index statistics
- Index volume
- General description
- Area
- Area polygon
- Area category
- Area information
- Area information field
- Area information tag
- Area information dates
- Area map
*= only for internal use