Commit 168eef3f authored by Daniel W Bond's avatar Daniel W Bond
Browse files

killing off the myriad old ways of loading in building information

parent b7ef4e1f
import re
from housing.models import Building, Floor, Room
with open('buildingFloors.txt','r') as building_floors:
for lines in building_floors:
lines.strip("\n")
pattern = re.compile("[A-Z a-z]")
if (pattern.match(lines))
greg_building = Building.objects.create(name=lines)
greg_building.save()
else
building_floor = Floor.objects.create(number=int(lines), building = greg_building)
building_floor.save()
with open('roomNunbers.txt','r') as roomnums:
for (morelines in roomnums):
morelines.strip("\n")
pattern = re.compile("[A-Z a-z]")
if (morelines is "Shenandoah" or morelines is "Aquia" or morelines is "Rappahannock"):
neighborhood = morelines
else (pattern.match(morelines)):
roomBuilding = morelines
while not(pattern.match(morelines))):
if (roomBuilding is "Commonwealth" or roomBuilding is "Dominion"):
room = Room.objects.create(number=int(morelines), floor=int(morelines[1]))
room.save()
else:
room = Room.objects.create(number=int(morelines), floor=int(morelines[0]))
room.save()
\ No newline at end of file
[{
"fields": {
"name": "Adams",
"building_name": "adams",
"slug": "0skh5s",
"campus": "ff",
"neighbourhood": "sh"
},
"model": "housing.building",
"pk": 1
}, {
"fields": {
"building": 1,
"number": 1,
"slug": "rxcziV",
"floor_num": "1"
},
"model": "housing.floor",
"pk": 1
}, {
"fields": {
"building": 1,
"number": 2,
"slug": "nUZJE4",
"floor_num": "2"
},
"model": "housing.floor",
"pk": 2
}, {
"fields": {
"building": 1,
"number": 3,
"slug": "wYHWvW",
"floor_num": "3"
},
"model": "housing.floor",
"pk": 3
}, {
"fields": {
"name": "Harrison",
"building_name": "harrison",
"slug": "cxKpwi",
"campus": "ff",
"neighbourhood": "sh"
},
"model": "housing.building",
"pk": 2
}, {
"fields": {
"building": 2,
"number": 1,
"slug": "gRU76r",
"floor_num": "1"
},
"model": "housing.floor",
"pk": 4
}, {
"fields": {
"building": 2,
"number": 2,
"slug": "QbjvUV",
"floor_num": "2"
},
"model": "housing.floor",
"pk": 5
}, {
"fields": {
"building": 2,
"number": 3,
"slug": "jx5DvV",
"floor_num": "3"
},
"model": "housing.floor",
"pk": 6
}, {
"fields": {
"name": "Jackson",
"building_name": "jackson",
"slug": "KSFMlV",
"campus": "ff",
"neighbourhood": "sh"
},
"model": "housing.building",
"pk": 3
}, {
"fields": {
"building": 3,
"number": 1,
"slug": "WjkTko",
"floor_num": "1"
},
"model": "housing.floor",
"pk": 7
}, {
"fields": {
"building": 3,
"number": 2,
"slug": "g7KNQR",
"floor_num": "2"
},
"model": "housing.floor",
"pk": 8
}, {
"fields": {
"building": 3,
"number": 3,
"slug": "UX6uNZ",
"floor_num": "3"
},
"model": "housing.floor",
"pk": 9
}, {
"fields": {
"name": "Jefferson",
"building_name": "jefferson",
"slug": "THuNuC",
"campus": "ff",
"neighbourhood": "sh"
},
"model": "housing.building",
"pk": 4
}, {
"fields": {
"building": 4,
"number": 1,
"slug": "jfEtMr",
"floor_num": "1"
},
"model": "housing.floor",
"pk": 10
}, {
"fields": {
"building": 4,
"number": 2,
"slug": "fVne6S",
"floor_num": "2"
},
"model": "housing.floor",
"pk": 11
}, {
"fields": {
"building": 4,
"number": 3,
"slug": "Nj8ZE9",
"floor_num": "3"
},
"model": "housing.floor",
"pk": 12
}, {
"fields": {
"name": "Kennedy",
"building_name": "kennedy",
"slug": "HeEQws",
"campus": "ff",
"neighbourhood": "sh"
},
"model": "housing.building",
"pk": 5
}, {
"fields": {
"building": 5,
"number": 1,
"slug": "8S5ypu",
"floor_num": "1"
},
"model": "housing.floor",
"pk": 13
}, {
"fields": {
"building": 5,
"number": 2,
"slug": "VEl3hp",
"floor_num": "2"
},
"model": "housing.floor",
"pk": 14
}, {
"fields": {
"building": 5,
"number": 3,
"slug": "Nkv6Ir",
"floor_num": "3"
},
"model": "housing.floor",
"pk": 15
}, {
"fields": {
"name": "Lincoln",
"building_name": "lincoln",
"slug": "VMzC5Z",
"campus": "ff",
"neighbourhood": "sh"
},
"model": "housing.building",
"pk": 6
}, {
"fields": {
"building": 6,
"number": 1,
"slug": "lBzMZ0",
"floor_num": "1"
},
"model": "housing.floor",
"pk": 16
}, {
"fields": {
"building": 6,
"number": 2,
"slug": "z2rkNb",
"floor_num": "2"
},
"model": "housing.floor",
"pk": 17
}, {
"fields": {
"building": 6,
"number": 3,
"slug": "qJs1Um",
"floor_num": "3"
},
"model": "housing.floor",
"pk": 18
}, {
"fields": {
"name": "Madison",
"building_name": "madison",
"slug": "EqX3rD",
"campus": "ff",
"neighbourhood": "sh"
},
"model": "housing.building",
"pk": 7
}, {
"fields": {
"building": 7,
"number": 1,
"slug": "pF0mNK",
"floor_num": "1"
},
"model": "housing.floor",
"pk": 19
}, {
"fields": {
"building": 7,
"number": 2,
"slug": "b253Iy",
"floor_num": "2"
},
"model": "housing.floor",
"pk": 20
}, {
"fields": {
"building": 7,
"number": 3,
"slug": "TrouAj",
"floor_num": "3"
},
"model": "housing.floor",
"pk": 21
}, {
"fields": {
"name": "Monroe",
"building_name": "monroe",
"slug": "FGYDfG",
"campus": "ff",
"neighbourhood": "sh"
},
"model": "housing.building",
"pk": 8
}, {
"fields": {
"building": 8,
"number": 1,
"slug": "8h09ty",
"floor_num": "1"
},
"model": "housing.floor",
"pk": 22
}, {
"fields": {
"building": 8,
"number": 2,
"slug": "gmlsOo",
"floor_num": "2"
},
"model": "housing.floor",
"pk": 23
}, {
"fields": {
"building": 8,
"number": 3,
"slug": "5blUnk",
"floor_num": "3"
},
"model": "housing.floor",
"pk": 24
}, {
"fields": {
"name": "Roosevelt",
"building_name": "roosevelt",
"slug": "z2CfHh",
"campus": "ff",
"neighbourhood": "sh"
},
"model": "housing.building",
"pk": 9
}, {
"fields": {
"building": 9,
"number": 1,
"slug": "L4TiBd",
"floor_num": "1"
},
"model": "housing.floor",
"pk": 25
}, {
"fields": {
"building": 9,
"number": 2,
"slug": "r3dO25",
"floor_num": "2"
},
"model": "housing.floor",
"pk": 26
}, {
"fields": {
"building": 9,
"number": 3,
"slug": "KPNv5H",
"floor_num": "3"
},
"model": "housing.floor",
"pk": 27
}, {
"fields": {
"name": "Truman",
"building_name": "truman",
"slug": "YAgLwL",
"campus": "ff",
"neighbourhood": "sh"
},
"model": "housing.building",
"pk": 10
}, {
"fields": {
"building": 10,
"number": 1,
"slug": "SyYUwN",
"floor_num": "1"
},
"model": "housing.floor",
"pk": 28
}, {
"fields": {
"building": 10,
"number": 2,
"slug": "7cB5dx",
"floor_num": "2"
},
"model": "housing.floor",
"pk": 29
}, {
"fields": {
"building": 10,
"number": 3,
"slug": "npMwxP",
"floor_num": "3"
},
"model": "housing.floor",
"pk": 30
}, {
"fields": {
"name": "Wilson",
"building_name": "wilson",
"slug": "emchOM",
"campus": "ff",
"neighbourhood": "sh"
},
"model": "housing.building",
"pk": 11
}, {
"fields": {
"building": 11,
"number": 1,
"slug": "UAke5l",
"floor_num": "1"
},
"model": "housing.floor",
"pk": 31
}, {
"fields": {
"building": 11,
"number": 2,
"slug": "4spsx6",
"floor_num": "2"
},
"model": "housing.floor",
"pk": 32
}, {
"fields": {
"building": 11,
"number": 3,
"slug": "sc2Tg1",
"floor_num": "3"
},
"model": "housing.floor",
"pk": 33
}, {
"fields": {
"name": "Washingon",
"building_name": "washingon",
"slug": "psyZ6h",
"campus": "ff",
"neighbourhood": "sh"
},
"model": "housing.building",
"pk": 12
}, {
"fields": {
"building": 12,
"number": 1,
"slug": "u4BUHi",
"floor_num": "1"
},
"model": "housing.floor",
"pk": 34
}, {
"fields": {
"building": 12,
"number": 2,
"slug": "F4OQUG",
"floor_num": "2"
},
"model": "housing.floor",
"pk": 35
}, {
"fields": {
"building": 12,
"number": 3,
"slug": "iyMocE",
"floor_num": "3"
},
"model": "housing.floor",
"pk": 36
}, {
"fields": {
"name": "Amherst",
"building_name": "amherst",
"slug": "QdKxQh",
"campus": "ff",
"neighbourhood": "ra"
},
"model": "housing.building",
"pk": 13
}, {
"fields": {
"building": 13,
"number": 1,
"slug": "DFVmql",
"floor_num": "1"
},
"model": "housing.floor",
"pk": 37
}, {
"fields": {
"building": 13,
"number": 2,
"slug": "zuzd2F",
"floor_num": "2"
},
"model": "housing.floor",
"pk": 38
}, {
"fields": {
"building": 13,
"number": 3,
"slug": "MtTq1z",
"floor_num": "3"
},
"model": "housing.floor",
"pk": 39
}, {
"fields": {
"name": "Brunswick",
"building_name": "brunswick",
"slug": "39P5De",
"campus": "ff",
"neighbourhood": "ra"
},
"model": "housing.building",
"pk": 14
}, {
"fields": {
"building": 14,
"number": 1,
"slug": "VICTbg",
"floor_num": "1"
},
"model": "housing.floor",
"pk": 40
}, {
"fields": {
"building": 14,
"number": 2,
"slug": "cMG2KG",
"floor_num": "2"
},
"model": "housing.floor",
"pk": 41
}, {
"fields": {
"building": 14,
"number": 3,
"slug": "47eIVT",
"floor_num": "3"
},
"model": "housing.floor",
"pk": 42
}, {
"fields": {
"name": "Carroll",
"building_name": "carroll",
"slug": "b73fkm",
"campus": "ff",
"neighbourhood": "ra"
},
"model": "housing.building",
"pk": 15
}, {
"fields": {
"building": 15,
"number": 1,
"slug": "6Aja6j",
"floor_num": "1"
},
"model": "housing.floor",
"pk": 43
}, {
"fields": {
"building": 15,
"number": 2,
"slug": "pHGDC0",
"floor_num": "2"
},
"model": "housing.floor",
"pk": 44