Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/loading and unloading place importer import all fields #310

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion mobility_data/importers/loading_unloading_places.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,35 @@ class LoadingPlace(MobileUnitDataBase):
"Saavutettavuus": {
"type": FieldTypes.MULTILANG_STRING,
},
"rajoitukset": {
"type": FieldTypes.MULTILANG_STRING,
},
"lastauspiste": {
"type": FieldTypes.MULTILANG_STRING,
},
"rajoitustyyppi": {
"type": FieldTypes.MULTILANG_STRING,
},
"paikkoja_y": {"type": FieldTypes.INTEGER},
"Lisätieto": {
"max_aika_h": {"type": FieldTypes.STRING},
"max_aika_m": {"type": FieldTypes.STRING},
"rajoitus_m": {"type": FieldTypes.STRING},
"rajoitus_l": {"type": FieldTypes.STRING},
"rajoitus_s": {"type": FieldTypes.STRING},
"rajoitettu_ark": {"type": FieldTypes.STRING},
"rajoitettu_l": {"type": FieldTypes.STRING},
"rajoitettu_s": {"type": FieldTypes.STRING},
"voimassaol": {"type": FieldTypes.STRING},
"varattu_tie_ajoon": {"type": FieldTypes.MULTILANG_STRING},
"erityisluv": {"type": FieldTypes.MULTILANG_STRING},
"vuoropys": {"type": FieldTypes.STRING},
"päiväys": {"type": FieldTypes.STRING},
"lisätieto": {
"type": FieldTypes.MULTILANG_STRING,
},
"maksuvyöh": {"type": FieldTypes.STRING},
"rajoit_lis": {"type": FieldTypes.MULTILANG_STRING},
"talvikunno": {"type": FieldTypes.STRING},
}

def __init__(self, feature):
Expand Down Expand Up @@ -102,6 +121,8 @@ def __init__(self, feature):
self.extra[field_name][lang] = strings[i].strip()
case FieldTypes.INTEGER:
self.extra[field_name] = feature[field].as_int()
case FieldTypes.STRING:
self.extra[field_name] = feature[field].as_string()


def get_geojson_file_name():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,7 @@ def test_import(get_geojson_file_name_mock, municipalities):
assert lantinen_rantakatu.extra["rajoitustyyppi"]["en"] == "Special area"

assert lantinen_rantakatu.extra["paikkoja_y"] == 2
assert lantinen_rantakatu.extra["max_aika_h"] == "3"
assert lantinen_rantakatu.extra["rajoitus_l"] == "test"
assert lantinen_rantakatu.extra["rajoitettu_ark"] == "4"
assert lantinen_rantakatu.extra["päiväys"] == "21.7.2022"
Loading