-
Notifications
You must be signed in to change notification settings - Fork 1
Residential Registry Markups
For an explanation of the Markups logic, please see General Description
The code below gives an example of how you would use the client to fetch all markups.
import mysql.connector
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()
update_at_min = "2018-02-11"
limit = 20000
i = 0
while True:
data = vgClient.residential_registry_markups(offset=i, limit=limit,
search_criteria={"updated_at_min": update_at_min})
for markup_data in data['residences']:
markup_data_id = markup_data['id']
del markup_data['id']
sql_set_part = ""
val = []
for field_to_update in markup_data:
val.append(markup_data[field_to_update])
if sql_set_part == "":
sql_set_part = "SET " + field_to_update + " = %s"
else:
sql_set_part += ", " + field_to_update + " = %s"
sql = "UPDATE residential_registry " + sql_set_part + " WHERE id =%s;"
val.append(markup_data_id)
mycursor.execute(sql, val)
mydb.commit()
if data['meta_data']['total_nr_records'] <= data['meta_data']['offset'] + data['meta_data']['response_rows']:
break
i += data['meta_data']['response_rows']
The code below gives an example of how would you use the client to fetch all markups.
import mysql.connector
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()
update_at_min = "2018-02-11"
limit = 20000
i = 0
while True:
data = vgClient.residential_registry_markups(offset=i, limit=limit,
search_criteria={"updated_at_min": update_at_min})
for markup_data in data['residences']:
sql_fields_list = ""
sql_val_prep = ""
val = []
for field_to_update in markup_data:
val.append(markup_data[field_to_update])
if sql_fields_list == "":
sql_fields_list = "(" + field_to_update
sql_val_prep = "(%s"
else:
sql_fields_list += "," + field_to_update
sql_val_prep += ",%s"
sql_fields_list += ")"
sql_val_prep += ")"
sql = "insert into <database_table> " + sql_fields_list + " VALUES " + sql_val_prep + ";"
mycursor.execute(sql, val)
mydb.commit()
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>")
limit=1
print (vgClient.residential_registry_markups(offset=0, limit=limit, search_criteria={
"id":"324312"
}))
OBS! You will only get update with fields that you have access to.
Field name | Type | Example | Description |
---|---|---|---|
id | varchar(255) | 481515 | unique id (serial number) for all residences source: Valueguard |
property_key | int(8) | 170053749 | unique id for all properties source: Fastighetsregistret LMV |
address | varchar(60) | 1:a villagatan 1, 65341 | address of the residence (street, nr, letter, postal code, postal area) source: Fastighetsregistret LMV |
street | varchar(60) | 1:a villagatan | street name in address |
number | varchar(10) | 1 | number of the street in address |
letter | char(5) | A | letter of the street in address |
entrance | varchar(5) | U1 | entance of the address |
is_meter_address | tinyint(1) | 1 | 1 = the address is a meter address (i.e. the number of the address is of type "302-12") 0 = the address is not a meter address |
postal_code | varchar(7) | 65341 | postal code |
postal_area | varchar(40) | Karlstad | postal area |
house_nr | mediumint(5) | 1 | unique number on every house belonging to the same property |
apartment_nr | smallint(4) | 1101 | unique number on every apartment at the same address |
living_space | double | 137 | area of residence in sqm (only for houses) source: Lägenhetsregistret washed with Fastighetsregistret LMV |
apartment_area | smallint(4) | 137 | area of residence in sqm (all home types) source: Lägenhetsregistret LMV |
rooms | double | 5 | number of rooms for areas above 7sqm, excluding kitchen and bathroom (not available for houses) |
floor | double | 2 | the floor of the residence |
floors | double | 2 | the highest floor on the address |
apartment_category | tinyint(2) | 1 | 1 = ordinary apartment 2 = special apartment customized for elderly or disabled 3 = student residence 4 = other special residence 9 = missing |
kitchen_type | tinyint(2) | 1 | 1 = kitchen 2 = kitchenette 3 = kitchen cabinet 4 = no kitchen equipment 9 = unknown |
building_purpose | tinyint(2) | 1 | 1 = home 2 = industry 3 = society 4 = organization 5 = business building 6 = complement buildning 7 = other buildning |
sweref99x | int(7) | 6583373 | X-coordinate (longitude) from SWEREF a Swedish positioning system by LMV used from 2007 |
sweref99y | int(7) | 413689 | Y-coordinate (latitude) from SWEREF a Swedish positioning system by LMV used from 2007 |
rt90x | double | 6586700 | X-coordinate (longitude) from RT90 a Swedish positioning system by LMV used before 2007 |
rt90y | double | 1367905 | Y-coordinate (latitude) from RT90 a Swedish positioning system by LMV used before 2007 |
wgs84lat | double | 59.3801951334688 | Y-coordinate (latitude) from WGS84 a global positioning system |
wgs84lon | double | 13.4808053113366 | X-coordinate (longitude) from WGS84 a global positioning system |
construction_year | smallint(4) | 1920 | building year The construction_year = 1909 for houses and 1929 for flats/apartments are in some cases used by Lantmäteriet when the true year of construction is unknown. For more info see detailed explanation |
owner_id | char(11) | 769613-3375 | organizational number |
building_type | tinyint(2) | 33 | -1 = missing 1 = bathhouse 2 = fire station 3 = bus station 4 = distribution building 5 = veterinary 6 = army 7 = health care center 8 = university 9 = ice rink 10 = railway station 11 = municipality building 12 = correctional institution 13 = cultural building 14 = police station 15 = treatment plant 16 = riding area 17 = community 18 = hospital 19 = school 20 = sports area 21 = university 22 = water treatment plant 24 = multi arena 30 = detached house 31 = terraced house 32 = townhouse 33 = block of apartments 35 = house with several apartments 40 = other production industry 41 = gas turbine facility 42 = hotel for industries 43 = chemical industry 44 = condensing plant 45 = nuclear plant 46 = food industry 47 = metal- or machine industry 48 = textile industry 49 = wood industry 50 = hydroelectric plant 51 = windmills 52 = heating plant 53 = other industry building 99 = unspecified |
type_code | smallint(3) | 320 | 113 = farm unit (building value < 50000 SEK) 120 = farm unit (built-up) 213 = house (building value < 50000 SEK) 220 = house (built-up) 221* = house (cottege) 222* = house (3 or more residence buildnings) 320 = rental (residences) 321 = rental (residences & local places) 325 = rental (local places) 823 = special unit. * = type code ended in 2015 but is in the register. These are the codes for number of residences of 10000 or more. Complete list can be found at the Swedish Tax Agency. |
home_type | varchar(20) | lägenhet | the different types of residence are divided into: radhus (townhouse) lägenhet (apartment) kedjehus (terraced house) villa (house) lantbruk (farm) småhus övriga (other houses) lantbruk övriga (other farms) okänd (unknown) |
ownership_type | varchar(30) | bostadsrätt | the different types of ownership are divided into: äganderätt (property rights) bostadsrätt (co-operative apartment) hyresrätt (rented apartment) tomträtt (site leasehold) okänd (unknown), vast majority rentals |
living_area | smallint(5) | 130 | area of residence in sqm based on apartment_area but using other sources where apartment_area has missing values source: Fastighetsregistret LMV |
ancillary_area | smallint(5) | 40 | ancillary area in sqm, not part of the primary building area |
standard_points | tinyint(2) | 32 | a number between 0-59 based on assessed value measuring the condition of the residence, higher number represents better condition (not available for co-operative apartments) |
plot_area | int(9) | 896 | area of the plot belonging to the residence in sqm |
error_code | tinyint(1) | 0 | 1 = suspected error in data 0 = no suspected error in data Variable explanation |
deleted | tinyint(1) | 0 | 0 = not deleted 1 = deleted 2 = maybe deleted (see probablity_deleted) Variable explanation |
probability_deleted | decimal(3,2) | 0.00 | percentage that it no longer exists |
area_id | int(9) | 7850 | id for area_name |
area_name | varchar(60) | Karlstad_Romstad/Strand | Valueguard's own neighbourhood definitions |
updated_at | varchar(10) | 2016-06-19 | latest date of update from the sources. ads: ad date commercial_site: update date with bank-id private_user: date for register in system public_data: date for delivery from LM sales: contract date |
updated_from | varchar(60) | public_data | designates the source of an update. List of sources |
county_code | varchar(2) | 05 | County code |
municipality_code | varchar(2) | 13 | Municipality code |
parish_code | varchar(2) | 02 | Parish code |
grade | tinyint(2) | 1 | From 1 to 3, where 1 is the most reliable |
vacation_like_home | tinyiny(1) | 1 | 3 = Estimated to be a vacation home 2 = Estimated to be a vaction home but there is someone registered at the address 1 = Estimated to not be a vacation home but no one is registered at the address 0 = Estimated to not be a vacation home |
person_registered | tinyiny(1) | 0 | 1 = Someone is registered at the address 0 = No one is registered at the address, or we have not been able to match the address. |
person_registered_date | varchar(10) | 2016-06-19 | Update date for person_registered |
name | Description |
---|---|
public_data | official update from Lantmäteriet |
private_user | update from someone who manually writes us to inform us of an error (usually resident) |
ads | update originating in a broker ad for this object |
sales | update originating in sales data |
commercial_site | update where a user at some commercial site sends in corrections through that website |
valueguard_internal | Updates of internal variables, for example vacation_like_home |
- These fields exist to inform the user that an object either doesn't exist or that there's something weird with it
- deleted = 1 means that a home has been removed from the official registries. The most frequent reason for this is that it has been demolished, the second most frequent reason is that it was wrongly registered and the third most common reason is that it was merged with another home
- error_code = 1 means that there's something wrong with this object and that it should be used with caution or not at all. The most common reason for a home to get error_code = 1 is that the number of homes grouped together differs depending on definition in ways that it shouldn't, for example that number of duplicates on FNR and coordinates differ. The second most frequent reason is that the coordinates are outside of Sweden. In both cases, something is off and we suspect the data is wrong.
- construction_year = null could mean that the register lacks a construction year for the building. For newer buidlings this is most likely caused by the taxation register, from which the build year is collected for newer buildings, being updated every third year. This in combination with that we on our end only update our Residential Registry (bostadsregistret) with changes to the apartment information and not changes on the information about the buildings. Thus if the taxation register lacks a build year when we first receive the information about new apartments, we are not able to retrieve the information at a later point in time when the taxation register is updated with the information about the build year.
- The construction_year = 1909 for houses and 1929 for flats/apartments are in some cases used by Lantmäteriet when the true year of construction is unknown. The true year of construction is probably older than 1909/1929.
- The cause of the problem is probably this:
A new Real Property Register (fastighetsregister) was created in 1910, which most likely is the cause of why in-reality-older buildings have a registered build year of 1909 (i.e. many buildings built prior to 1909 have a false build year of 1909 in the register). In the register there are also build years older than 1909 and these may be due to owners having corrected the information about their properties in the register. - Above applies for houses but flats/apartments have the corresponding issue with build year 1929 due to different but similar reasons.
- The field "deleted" is a boolean that is 1 when a residence no longer exists
- The field "probability_deleted" is the probability that this residence no longer exists when we are unsure. For example, a piece of property which previously had 5 homes may have been rearranged in a way that 4 of the previous homes no longer exists but we do not know which home still exists. In such a case, all five homes will have 0.80 (4/5 deleted) in this field.
We recommend that you set update_at_min to the latest updated_at date you currently have for data where updated_from is 'public_data'. That way you will get all changes since then. Do not put the date when you get a notification from Valueguard that new updates are available since this update may include changes entered between this update and the last one.
When you get NULL for a field in this table, that means that it has changed from it's previous state to NULL. It does NOT mean that there is no new value for this field.
Field name | Example | Description |
---|---|---|
id | 1234 | The id of the object |
updated_at_max | 2019-10-01 | Maximum update date |
updated_at_min | 1995-03-19 | Minimum update date |
updated_from | public_data | Designates the source of an update. List of sources |
curl https://api.valueguard.se/v1/residential/registry/markups?access_token={ACCESS_TOKEN}&offset={OFFSET}&limit={LIMIT}&{SEARCH_CRITERA AS VALUE-KEY PAIR &id="22133"...}
- 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