mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
31 lines
761 B
Python
31 lines
761 B
Python
import pandas as pd
|
|
from utils.logger import setup_logger
|
|
|
|
logger = setup_logger()
|
|
|
|
|
|
class OpenUprnClient:
|
|
"""
|
|
Specs for this dataset can be found here:
|
|
https://www.ordnancesurvey.co.uk/documents/product-support/tech-spec/open-uprn-techspec-v1.pdf
|
|
"""
|
|
|
|
# TODO: Document this
|
|
|
|
def __init__(self, path, uprns=None):
|
|
self.path = path
|
|
self.uprns = [int(x) for x in uprns] if uprns else None
|
|
self.data = None
|
|
|
|
def read(self):
|
|
"""
|
|
This methodology is placeholder, while data sits localls
|
|
:return:
|
|
"""
|
|
logger.info("Reading in open uprn data")
|
|
|
|
df = pd.read_csv(self.path)
|
|
if self.uprns:
|
|
df = df[df["UPRN"].isin(self.uprns)]
|
|
|
|
self.data = df
|