├── .gitignore ├── Week 2 Basic Structured Query Language └── Assignment │ ├── counting_email_in_a_database.py │ ├── mbox.txt │ └── orgs.sqlite ├── Week 3 Data Models and Relational SQL └── Assignment │ ├── Library.xml │ ├── trackdb.sqlite │ └── tracks.py ├── Week 4 Many-to-Many Relationships └── Assignment │ ├── roster.py │ ├── roster_data.json │ └── rosterdb.sqlite └── Week 5 Databases and Visualization └── Assignment ├── README.txt ├── geodump.py ├── geoload.py ├── where.data ├── where.html └── where.js /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | 3 | # Ignore all logfiles and tempfiles. 4 | /log/*.log 5 | /tmp 6 | 7 | tmp/**/* 8 | tmp/* 9 | *.swp 10 | *~ 11 | .DS_Store 12 | -------------------------------------------------------------------------------- /Week 2 Basic Structured Query Language/Assignment/counting_email_in_a_database.py: -------------------------------------------------------------------------------- 1 | import sqlite3 2 | 3 | conn = sqlite3.connect('orgs.sqlite') 4 | cur = conn.cursor() 5 | 6 | cur.execute('DROP TABLE IF EXISTS Counts') 7 | 8 | cur.execute('CREATE TABLE Counts (org TEXT, count INTEGER)') 9 | 10 | fname = input('Enter file name: ') 11 | if len(fname) < 1: 12 | fname = 'mbox.txt' 13 | fh = open(fname) 14 | for line in fh: 15 | if not line.startswith('From: '): 16 | continue 17 | pieces = line.split() 18 | email = pieces[1] 19 | org = email.split('@')[1] 20 | cur.execute('SELECT count FROM Counts WHERE org = ?', (org, )) 21 | try: 22 | count = cur.fetchone()[0] 23 | cur.execute('UPDATE Counts SET count = count + 1 WHERE org = ?', (org, )) 24 | except: 25 | cur.execute('INSERT INTO Counts (org, count) VALUES (?, 1)', (org, )) 26 | 27 | conn.commit() 28 | 29 | sqlstr = 'SELECT org, count FROM Counts ORDER BY count DESC LIMIT 10' 30 | for row in conn.execute(sqlstr): 31 | print(row[0], row[1]) 32 | 33 | conn.close() 34 | -------------------------------------------------------------------------------- /Week 2 Basic Structured Query Language/Assignment/orgs.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremy-wl/coursera-using-databases-with-python/cd3154f72cfaa8cb6dc12126d48cfa5fad63f9f6/Week 2 Basic Structured Query Language/Assignment/orgs.sqlite -------------------------------------------------------------------------------- /Week 3 Data Models and Relational SQL/Assignment/trackdb.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremy-wl/coursera-using-databases-with-python/cd3154f72cfaa8cb6dc12126d48cfa5fad63f9f6/Week 3 Data Models and Relational SQL/Assignment/trackdb.sqlite -------------------------------------------------------------------------------- /Week 3 Data Models and Relational SQL/Assignment/tracks.py: -------------------------------------------------------------------------------- 1 | import xml.etree.ElementTree as et 2 | import sqlite3 3 | 4 | conn = sqlite3.connect('trackdb.sqlite') 5 | cur = conn.cursor() 6 | 7 | # Make some fresh tables using executescript() 8 | cur.executescript(''' 9 | DROP TABLE IF EXISTS Artist; 10 | DROP TABLE IF EXISTS Genre; 11 | DROP TABLE IF EXISTS Album; 12 | DROP TABLE IF EXISTS Track; 13 | 14 | CREATE TABLE Artist ( 15 | id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, 16 | name TEXT UNIQUE 17 | ); 18 | 19 | CREATE TABLE Genre ( 20 | id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, 21 | name TEXT UNIQUE 22 | ); 23 | 24 | CREATE TABLE Album ( 25 | id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, 26 | artist_id INTEGER, 27 | title TEXT UNIQUE 28 | ); 29 | 30 | CREATE TABLE Track ( 31 | id INTEGER NOT NULL PRIMARY KEY 32 | AUTOINCREMENT UNIQUE, 33 | title TEXT UNIQUE, 34 | album_id INTEGER, 35 | genre_id INTEGER, 36 | len INTEGER, rating INTEGER, count INTEGER 37 | ); 38 | ''') 39 | 40 | 41 | fname = input('Enter file name: ') 42 | if len(fname) < 1: 43 | fname = 'Library.xml' 44 | 45 | # Track ID369 46 | # NameAnother One Bites The Dust 47 | # ArtistQueen 48 | 49 | 50 | def lookup(dict, key): 51 | found = False 52 | for tag in dict: 53 | if found: 54 | return tag.text 55 | if tag.tag == 'key' and tag.text == key: 56 | found = True 57 | return None 58 | 59 | stuff = et.parse(fname) 60 | all = stuff.findall('dict/dict/dict') 61 | print('Dict count:', len(all)) 62 | for entry in all: 63 | if lookup(entry, 'Track ID') is None: continue 64 | 65 | name = lookup(entry, 'Name') 66 | artist = lookup(entry, 'Artist') 67 | album = lookup(entry, 'Album') 68 | count = lookup(entry, 'Play Count') 69 | rating = lookup(entry, 'Rating') 70 | length = lookup(entry, 'Total Time') 71 | genre = lookup(entry, 'Genre') 72 | 73 | if name is None or artist is None or album is None or genre is None: 74 | continue 75 | 76 | print(name, artist, album, count, rating, length) 77 | 78 | cur.execute('''INSERT OR IGNORE INTO Artist (name) 79 | VALUES ( ? )''', (artist, )) 80 | cur.execute('SELECT id FROM Artist WHERE name = ? ', (artist, )) 81 | artist_id = cur.fetchone()[0] 82 | 83 | cur.execute('''INSERT OR IGNORE INTO Album (title, artist_id) 84 | VALUES ( ?, ? )''', (album, artist_id)) 85 | cur.execute('SELECT id FROM Album WHERE title = ? ', (album, )) 86 | album_id = cur.fetchone()[0] 87 | 88 | cur.execute('''INSERT OR IGNORE INTO Genre (name) 89 | VALUES ( ? )''', (genre, )) 90 | cur.execute('SELECT id FROM Genre WHERE name = ?', (genre, )) 91 | genre_id = cur.fetchone()[0] 92 | 93 | cur.execute('''INSERT OR REPLACE INTO Track 94 | (title, album_id, genre_id, len, rating, count) 95 | VALUES ( ?, ?, ?, ?, ?, ? )''', 96 | (name, album_id, genre_id, length, rating, count)) 97 | 98 | conn.commit() 99 | -------------------------------------------------------------------------------- /Week 4 Many-to-Many Relationships/Assignment/roster.py: -------------------------------------------------------------------------------- 1 | import json 2 | import sqlite3 3 | 4 | conn = sqlite3.connect('rosterdb.sqlite') 5 | cur = conn.cursor() 6 | 7 | # Do some setup 8 | cur.executescript(''' 9 | DROP TABLE IF EXISTS User; 10 | DROP TABLE IF EXISTS Member; 11 | DROP TABLE IF EXISTS Course; 12 | 13 | CREATE TABLE User ( 14 | id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, 15 | name TEXT UNIQUE 16 | ); 17 | 18 | CREATE TABLE Course ( 19 | id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, 20 | title TEXT UNIQUE 21 | ); 22 | 23 | CREATE TABLE Member ( 24 | user_id INTEGER, 25 | course_id INTEGER, 26 | role INTEGER, 27 | PRIMARY KEY (user_id, course_id) 28 | ) 29 | ''') 30 | 31 | fname = input('Enter file name: ') 32 | if len(fname) < 1: 33 | fname = 'roster_data.json' 34 | 35 | # [ 36 | # [ "Charley", "si110", 1 ], 37 | # [ "Mea", "si110", 0 ], 38 | 39 | str_data = open(fname).read() 40 | json_data = json.loads(str_data) 41 | 42 | for entry in json_data: 43 | 44 | name = entry[0] 45 | title = entry[1] 46 | role = entry[2] 47 | 48 | print(name, title) 49 | 50 | cur.execute('''INSERT OR IGNORE INTO User (name) 51 | VALUES ( ? )''', (name, )) 52 | cur.execute('SELECT id FROM User WHERE name = ? ', (name, )) 53 | user_id = cur.fetchone()[0] 54 | 55 | cur.execute('''INSERT OR IGNORE INTO Course (title) 56 | VALUES ( ? )''', (title, )) 57 | cur.execute('SELECT id FROM Course WHERE title = ? ', (title, )) 58 | course_id = cur.fetchone()[0] 59 | 60 | cur.execute('''INSERT OR REPLACE INTO Member 61 | (user_id, course_id, role) VALUES ( ?, ?, ? )''', 62 | (user_id, course_id, role)) 63 | 64 | conn.commit() 65 | -------------------------------------------------------------------------------- /Week 4 Many-to-Many Relationships/Assignment/roster_data.json: -------------------------------------------------------------------------------- 1 | [ 2 | [ 3 | "Aryankhan", 4 | "si110", 5 | 1 6 | ], 7 | [ 8 | "Vincenzo", 9 | "si110", 10 | 0 11 | ], 12 | [ 13 | "Waqaas", 14 | "si110", 15 | 0 16 | ], 17 | [ 18 | "Maximillian", 19 | "si110", 20 | 0 21 | ], 22 | [ 23 | "Oluwademilade", 24 | "si110", 25 | 0 26 | ], 27 | [ 28 | "Nash", 29 | "si110", 30 | 0 31 | ], 32 | [ 33 | "Heidi", 34 | "si110", 35 | 0 36 | ], 37 | [ 38 | "Miah", 39 | "si110", 40 | 0 41 | ], 42 | [ 43 | "Suzy", 44 | "si110", 45 | 0 46 | ], 47 | [ 48 | "Danika", 49 | "si110", 50 | 0 51 | ], 52 | [ 53 | "Daniela", 54 | "si110", 55 | 0 56 | ], 57 | [ 58 | "Anabelle", 59 | "si110", 60 | 0 61 | ], 62 | [ 63 | "Kyren", 64 | "si110", 65 | 0 66 | ], 67 | [ 68 | "Sera", 69 | "si110", 70 | 0 71 | ], 72 | [ 73 | "Zishan", 74 | "si110", 75 | 0 76 | ], 77 | [ 78 | "Kiern", 79 | "si110", 80 | 0 81 | ], 82 | [ 83 | "Jeemie", 84 | "si110", 85 | 0 86 | ], 87 | [ 88 | "Ege", 89 | "si110", 90 | 0 91 | ], 92 | [ 93 | "Benjamyn", 94 | "si110", 95 | 0 96 | ], 97 | [ 98 | "Sascha", 99 | "si110", 100 | 0 101 | ], 102 | [ 103 | "Rees", 104 | "si110", 105 | 0 106 | ], 107 | [ 108 | "Perrie", 109 | "si110", 110 | 0 111 | ], 112 | [ 113 | "Aneliese", 114 | "si110", 115 | 0 116 | ], 117 | [ 118 | "Tiona", 119 | "si106", 120 | 1 121 | ], 122 | [ 123 | "Sheriff", 124 | "si106", 125 | 0 126 | ], 127 | [ 128 | "Faizaan", 129 | "si106", 130 | 0 131 | ], 132 | [ 133 | "Giada", 134 | "si106", 135 | 0 136 | ], 137 | [ 138 | "Adrianna", 139 | "si106", 140 | 0 141 | ], 142 | [ 143 | "Vincent", 144 | "si106", 145 | 0 146 | ], 147 | [ 148 | "Roxana", 149 | "si106", 150 | 0 151 | ], 152 | [ 153 | "Avraham", 154 | "si106", 155 | 0 156 | ], 157 | [ 158 | "Taddy", 159 | "si106", 160 | 0 161 | ], 162 | [ 163 | "Mhirren", 164 | "si106", 165 | 0 166 | ], 167 | [ 168 | "Chintu", 169 | "si106", 170 | 0 171 | ], 172 | [ 173 | "Shuni", 174 | "si106", 175 | 0 176 | ], 177 | [ 178 | "Doha", 179 | "si106", 180 | 0 181 | ], 182 | [ 183 | "Bhaaldeen", 184 | "si106", 185 | 0 186 | ], 187 | [ 188 | "Maia", 189 | "si106", 190 | 0 191 | ], 192 | [ 193 | "Aliya", 194 | "si106", 195 | 0 196 | ], 197 | [ 198 | "Bailey", 199 | "si106", 200 | 0 201 | ], 202 | [ 203 | "Chukwuemeka", 204 | "si106", 205 | 0 206 | ], 207 | [ 208 | "Alasdair", 209 | "si106", 210 | 0 211 | ], 212 | [ 213 | "Roderick", 214 | "si106", 215 | 0 216 | ], 217 | [ 218 | "Carlynn", 219 | "si106", 220 | 0 221 | ], 222 | [ 223 | "Clementine", 224 | "si106", 225 | 0 226 | ], 227 | [ 228 | "Nadine", 229 | "si106", 230 | 0 231 | ], 232 | [ 233 | "Calleigh", 234 | "si106", 235 | 0 236 | ], 237 | [ 238 | "Wynn", 239 | "si106", 240 | 0 241 | ], 242 | [ 243 | "Audrey", 244 | "si106", 245 | 0 246 | ], 247 | [ 248 | "Melandra", 249 | "si106", 250 | 0 251 | ], 252 | [ 253 | "Aria", 254 | "si106", 255 | 0 256 | ], 257 | [ 258 | "Sabriyah", 259 | "si106", 260 | 0 261 | ], 262 | [ 263 | "Caitaidh", 264 | "si106", 265 | 0 266 | ], 267 | [ 268 | "Burak", 269 | "si106", 270 | 0 271 | ], 272 | [ 273 | "Dilan", 274 | "si106", 275 | 0 276 | ], 277 | [ 278 | "Zerah", 279 | "si106", 280 | 0 281 | ], 282 | [ 283 | "Christy", 284 | "si106", 285 | 0 286 | ], 287 | [ 288 | "Gemmalea", 289 | "si106", 290 | 0 291 | ], 292 | [ 293 | "Mackenzie", 294 | "si106", 295 | 0 296 | ], 297 | [ 298 | "Karley", 299 | "si106", 300 | 0 301 | ], 302 | [ 303 | "Dineo", 304 | "si106", 305 | 0 306 | ], 307 | [ 308 | "Elidh", 309 | "si106", 310 | 0 311 | ], 312 | [ 313 | "Thumbiko", 314 | "si106", 315 | 0 316 | ], 317 | [ 318 | "Keiryn", 319 | "si206", 320 | 1 321 | ], 322 | [ 323 | "Sam", 324 | "si206", 325 | 0 326 | ], 327 | [ 328 | "Deena", 329 | "si206", 330 | 0 331 | ], 332 | [ 333 | "Bader", 334 | "si206", 335 | 0 336 | ], 337 | [ 338 | "Isaiah", 339 | "si206", 340 | 0 341 | ], 342 | [ 343 | "Kurt", 344 | "si206", 345 | 0 346 | ], 347 | [ 348 | "Lacy", 349 | "si206", 350 | 0 351 | ], 352 | [ 353 | "Laci", 354 | "si206", 355 | 0 356 | ], 357 | [ 358 | "Kandice", 359 | "si206", 360 | 0 361 | ], 362 | [ 363 | "Kelice", 364 | "si206", 365 | 0 366 | ], 367 | [ 368 | "Keryn", 369 | "si206", 370 | 0 371 | ], 372 | [ 373 | "Ruta", 374 | "si206", 375 | 0 376 | ], 377 | [ 378 | "Abhia", 379 | "si206", 380 | 0 381 | ], 382 | [ 383 | "Janey", 384 | "si206", 385 | 0 386 | ], 387 | [ 388 | "Adonica", 389 | "si206", 390 | 0 391 | ], 392 | [ 393 | "Nathaniel", 394 | "si206", 395 | 0 396 | ], 397 | [ 398 | "Gareth", 399 | "si206", 400 | 0 401 | ], 402 | [ 403 | "Sevin", 404 | "si206", 405 | 0 406 | ], 407 | [ 408 | "Nassir", 409 | "si206", 410 | 0 411 | ], 412 | [ 413 | "Chara", 414 | "si206", 415 | 0 416 | ], 417 | [ 418 | "Nicole", 419 | "si206", 420 | 0 421 | ], 422 | [ 423 | "Aimie", 424 | "si206", 425 | 0 426 | ], 427 | [ 428 | "Sinem", 429 | "si206", 430 | 0 431 | ], 432 | [ 433 | "Nicky", 434 | "si206", 435 | 0 436 | ], 437 | [ 438 | "Rameen", 439 | "si206", 440 | 0 441 | ], 442 | [ 443 | "Saffron", 444 | "si206", 445 | 0 446 | ], 447 | [ 448 | "Benji", 449 | "si301", 450 | 1 451 | ], 452 | [ 453 | "Mirryn", 454 | "si301", 455 | 0 456 | ], 457 | [ 458 | "Tira", 459 | "si301", 460 | 0 461 | ], 462 | [ 463 | "Cailyn", 464 | "si301", 465 | 0 466 | ], 467 | [ 468 | "Eve", 469 | "si301", 470 | 0 471 | ], 472 | [ 473 | "Harjyot", 474 | "si301", 475 | 0 476 | ], 477 | [ 478 | "Muhammed", 479 | "si301", 480 | 0 481 | ], 482 | [ 483 | "Clarisse", 484 | "si301", 485 | 0 486 | ], 487 | [ 488 | "Siddhant", 489 | "si301", 490 | 0 491 | ], 492 | [ 493 | "Nur", 494 | "si301", 495 | 0 496 | ], 497 | [ 498 | "Jorge", 499 | "si301", 500 | 0 501 | ], 502 | [ 503 | "Rasmus", 504 | "si301", 505 | 0 506 | ], 507 | [ 508 | "Aleena", 509 | "si301", 510 | 0 511 | ], 512 | [ 513 | "Almirah", 514 | "si301", 515 | 0 516 | ], 517 | [ 518 | "Jeffrey", 519 | "si301", 520 | 0 521 | ], 522 | [ 523 | "Maias", 524 | "si301", 525 | 0 526 | ], 527 | [ 528 | "Nicki", 529 | "si301", 530 | 0 531 | ], 532 | [ 533 | "Muir", 534 | "si301", 535 | 0 536 | ], 537 | [ 538 | "Andrew", 539 | "si301", 540 | 0 541 | ], 542 | [ 543 | "Annsarai", 544 | "si301", 545 | 0 546 | ], 547 | [ 548 | "Elle", 549 | "si301", 550 | 0 551 | ], 552 | [ 553 | "Cairn", 554 | "si301", 555 | 0 556 | ], 557 | [ 558 | "Shreeram", 559 | "si301", 560 | 0 561 | ], 562 | [ 563 | "Kizhi", 564 | "si301", 565 | 0 566 | ], 567 | [ 568 | "Russel", 569 | "si301", 570 | 0 571 | ], 572 | [ 573 | "Shergo", 574 | "si301", 575 | 0 576 | ], 577 | [ 578 | "Deborah", 579 | "si301", 580 | 0 581 | ], 582 | [ 583 | "Liam", 584 | "si301", 585 | 0 586 | ], 587 | [ 588 | "Kori", 589 | "si301", 590 | 0 591 | ], 592 | [ 593 | "Katriona", 594 | "si301", 595 | 0 596 | ], 597 | [ 598 | "Keatin", 599 | "si301", 600 | 0 601 | ], 602 | [ 603 | "Riana", 604 | "si301", 605 | 0 606 | ], 607 | [ 608 | "Zennon", 609 | "si301", 610 | 0 611 | ], 612 | [ 613 | "Daksh", 614 | "si301", 615 | 0 616 | ], 617 | [ 618 | "Bonni", 619 | "si301", 620 | 0 621 | ], 622 | [ 623 | "Miyah", 624 | "si301", 625 | 0 626 | ], 627 | [ 628 | "Avah", 629 | "si301", 630 | 0 631 | ], 632 | [ 633 | "Terra", 634 | "si301", 635 | 0 636 | ], 637 | [ 638 | "Regan", 639 | "si301", 640 | 0 641 | ], 642 | [ 643 | "Elli", 644 | "si301", 645 | 0 646 | ], 647 | [ 648 | "Jacky", 649 | "si301", 650 | 0 651 | ], 652 | [ 653 | "Tiree", 654 | "si301", 655 | 0 656 | ], 657 | [ 658 | "Nikhil", 659 | "si310", 660 | 1 661 | ], 662 | [ 663 | "Greg", 664 | "si310", 665 | 0 666 | ], 667 | [ 668 | "Amaia", 669 | "si310", 670 | 0 671 | ], 672 | [ 673 | "Sofian", 674 | "si310", 675 | 0 676 | ], 677 | [ 678 | "Jane", 679 | "si310", 680 | 0 681 | ], 682 | [ 683 | "Roxanne", 684 | "si310", 685 | 0 686 | ], 687 | [ 688 | "Galilee", 689 | "si310", 690 | 0 691 | ], 692 | [ 693 | "Callum", 694 | "si310", 695 | 0 696 | ], 697 | [ 698 | "Erina", 699 | "si310", 700 | 0 701 | ], 702 | [ 703 | "Samar", 704 | "si310", 705 | 0 706 | ], 707 | [ 708 | "Carson", 709 | "si310", 710 | 0 711 | ], 712 | [ 713 | "Kaleb", 714 | "si310", 715 | 0 716 | ], 717 | [ 718 | "Fathema", 719 | "si310", 720 | 0 721 | ], 722 | [ 723 | "Naina", 724 | "si310", 725 | 0 726 | ], 727 | [ 728 | "Haidyn", 729 | "si310", 730 | 0 731 | ], 732 | [ 733 | "Teigan", 734 | "si310", 735 | 0 736 | ], 737 | [ 738 | "Teighan", 739 | "si310", 740 | 0 741 | ], 742 | [ 743 | "Tasha", 744 | "si310", 745 | 0 746 | ], 747 | [ 748 | "Anise", 749 | "si310", 750 | 0 751 | ], 752 | [ 753 | "Zohair", 754 | "si310", 755 | 0 756 | ], 757 | [ 758 | "Babur", 759 | "si310", 760 | 0 761 | ], 762 | [ 763 | "Haghdann", 764 | "si310", 765 | 0 766 | ], 767 | [ 768 | "Khizer", 769 | "si310", 770 | 0 771 | ], 772 | [ 773 | "Conli", 774 | "si310", 775 | 0 776 | ], 777 | [ 778 | "Taniesha", 779 | "si310", 780 | 0 781 | ], 782 | [ 783 | "Mackenzie", 784 | "si310", 785 | 0 786 | ], 787 | [ 788 | "Divinewill", 789 | "si310", 790 | 0 791 | ], 792 | [ 793 | "Jules", 794 | "si310", 795 | 0 796 | ], 797 | [ 798 | "Nerea", 799 | "si310", 800 | 0 801 | ], 802 | [ 803 | "Fikret", 804 | "si310", 805 | 0 806 | ], 807 | [ 808 | "Aimiee", 809 | "si310", 810 | 0 811 | ], 812 | [ 813 | "Caoilfinn", 814 | "si310", 815 | 0 816 | ], 817 | [ 818 | "Sharona", 819 | "si310", 820 | 0 821 | ], 822 | [ 823 | "Renars", 824 | "si310", 825 | 0 826 | ], 827 | [ 828 | "Lyra", 829 | "si310", 830 | 0 831 | ], 832 | [ 833 | "Megg", 834 | "si310", 835 | 0 836 | ], 837 | [ 838 | "Ben", 839 | "si310", 840 | 0 841 | ], 842 | [ 843 | "Patience", 844 | "si310", 845 | 0 846 | ], 847 | [ 848 | "Siouxsie", 849 | "si310", 850 | 0 851 | ], 852 | [ 853 | "Bret", 854 | "si334", 855 | 1 856 | ], 857 | [ 858 | "Amiee", 859 | "si334", 860 | 0 861 | ], 862 | [ 863 | "Suzannah", 864 | "si334", 865 | 0 866 | ], 867 | [ 868 | "Aleeyah", 869 | "si334", 870 | 0 871 | ], 872 | [ 873 | "Summer", 874 | "si334", 875 | 0 876 | ], 877 | [ 878 | "Choire", 879 | "si334", 880 | 0 881 | ], 882 | [ 883 | "Layah", 884 | "si334", 885 | 0 886 | ], 887 | [ 888 | "Chardonnay", 889 | "si334", 890 | 0 891 | ], 892 | [ 893 | "Sahara", 894 | "si334", 895 | 0 896 | ], 897 | [ 898 | "Abu", 899 | "si334", 900 | 0 901 | ], 902 | [ 903 | "Saffi", 904 | "si334", 905 | 0 906 | ], 907 | [ 908 | "Edison", 909 | "si334", 910 | 0 911 | ], 912 | [ 913 | "Scot", 914 | "si334", 915 | 0 916 | ], 917 | [ 918 | "Badr", 919 | "si334", 920 | 0 921 | ], 922 | [ 923 | "Rowen", 924 | "si334", 925 | 0 926 | ], 927 | [ 928 | "Dalong", 929 | "si334", 930 | 0 931 | ], 932 | [ 933 | "Samarjit", 934 | "si334", 935 | 0 936 | ], 937 | [ 938 | "Chi", 939 | "si334", 940 | 0 941 | ], 942 | [ 943 | "Deshawn", 944 | "si334", 945 | 0 946 | ], 947 | [ 948 | "Mollie", 949 | "si334", 950 | 0 951 | ], 952 | [ 953 | "Siouxsie", 954 | "si334", 955 | 0 956 | ], 957 | [ 958 | "Boys", 959 | "si334", 960 | 0 961 | ], 962 | [ 963 | "Sahar", 964 | "si334", 965 | 0 966 | ], 967 | [ 968 | "Narissa", 969 | "si334", 970 | 0 971 | ], 972 | [ 973 | "Keeton", 974 | "si334", 975 | 0 976 | ], 977 | [ 978 | "Mikella", 979 | "si334", 980 | 0 981 | ], 982 | [ 983 | "Laiyah", 984 | "si334", 985 | 0 986 | ], 987 | [ 988 | "Abigael", 989 | "si334", 990 | 0 991 | ], 992 | [ 993 | "Khelis", 994 | "si334", 995 | 0 996 | ], 997 | [ 998 | "Orrin", 999 | "si334", 1000 | 0 1001 | ], 1002 | [ 1003 | "Ayomide", 1004 | "si334", 1005 | 0 1006 | ], 1007 | [ 1008 | "Kodi", 1009 | "si334", 1010 | 0 1011 | ], 1012 | [ 1013 | "Selina", 1014 | "si334", 1015 | 0 1016 | ], 1017 | [ 1018 | "Lanna", 1019 | "si334", 1020 | 0 1021 | ], 1022 | [ 1023 | "Abdulkhader", 1024 | "si334", 1025 | 0 1026 | ], 1027 | [ 1028 | "Bradyn", 1029 | "si334", 1030 | 0 1031 | ], 1032 | [ 1033 | "Harlie", 1034 | "si334", 1035 | 0 1036 | ], 1037 | [ 1038 | "Verity", 1039 | "si334", 1040 | 0 1041 | ], 1042 | [ 1043 | "Nawal", 1044 | "si334", 1045 | 0 1046 | ], 1047 | [ 1048 | "Simra", 1049 | "si334", 1050 | 0 1051 | ], 1052 | [ 1053 | "Kyrran", 1054 | "si334", 1055 | 0 1056 | ], 1057 | [ 1058 | "Tyelor", 1059 | "si363", 1060 | 1 1061 | ], 1062 | [ 1063 | "Sorche", 1064 | "si363", 1065 | 0 1066 | ], 1067 | [ 1068 | "Girls", 1069 | "si363", 1070 | 0 1071 | ], 1072 | [ 1073 | "Aulay", 1074 | "si363", 1075 | 0 1076 | ], 1077 | [ 1078 | "Darwyn", 1079 | "si363", 1080 | 0 1081 | ], 1082 | [ 1083 | "Caitlinn", 1084 | "si363", 1085 | 0 1086 | ], 1087 | [ 1088 | "Roman", 1089 | "si363", 1090 | 0 1091 | ], 1092 | [ 1093 | "Milly", 1094 | "si363", 1095 | 0 1096 | ], 1097 | [ 1098 | "Lee", 1099 | "si363", 1100 | 0 1101 | ], 1102 | [ 1103 | "Roddy", 1104 | "si363", 1105 | 0 1106 | ], 1107 | [ 1108 | "Reace", 1109 | "si363", 1110 | 0 1111 | ], 1112 | [ 1113 | "Chrissie", 1114 | "si363", 1115 | 0 1116 | ], 1117 | [ 1118 | "Mutinta", 1119 | "si363", 1120 | 0 1121 | ], 1122 | [ 1123 | "Tristan", 1124 | "si363", 1125 | 0 1126 | ], 1127 | [ 1128 | "Niven", 1129 | "si363", 1130 | 0 1131 | ], 1132 | [ 1133 | "Tal", 1134 | "si363", 1135 | 0 1136 | ], 1137 | [ 1138 | "Unaiza", 1139 | "si363", 1140 | 0 1141 | ], 1142 | [ 1143 | "Olutobilola", 1144 | "si363", 1145 | 0 1146 | ], 1147 | [ 1148 | "Aonghus", 1149 | "si363", 1150 | 0 1151 | ], 1152 | [ 1153 | "Halle", 1154 | "si363", 1155 | 0 1156 | ], 1157 | [ 1158 | "Roxie", 1159 | "si363", 1160 | 0 1161 | ], 1162 | [ 1163 | "Sarahlouise", 1164 | "si363", 1165 | 0 1166 | ], 1167 | [ 1168 | "Lysander", 1169 | "si363", 1170 | 0 1171 | ], 1172 | [ 1173 | "Adenn", 1174 | "si363", 1175 | 0 1176 | ], 1177 | [ 1178 | "Hayla", 1179 | "si363", 1180 | 0 1181 | ], 1182 | [ 1183 | "Saskia", 1184 | "si363", 1185 | 0 1186 | ], 1187 | [ 1188 | "Jordan", 1189 | "si363", 1190 | 0 1191 | ], 1192 | [ 1193 | "Camerin", 1194 | "si363", 1195 | 0 1196 | ], 1197 | [ 1198 | "Ayrton", 1199 | "si363", 1200 | 0 1201 | ], 1202 | [ 1203 | "Emelye", 1204 | "si363", 1205 | 0 1206 | ], 1207 | [ 1208 | "Melodie", 1209 | "si363", 1210 | 0 1211 | ], 1212 | [ 1213 | "Mathuyan", 1214 | "si363", 1215 | 0 1216 | ], 1217 | [ 1218 | "Stevie", 1219 | "si363", 1220 | 0 1221 | ], 1222 | [ 1223 | "Fruin", 1224 | "si363", 1225 | 0 1226 | ], 1227 | [ 1228 | "Kalli", 1229 | "si363", 1230 | 0 1231 | ], 1232 | [ 1233 | "Imama", 1234 | "si363", 1235 | 0 1236 | ], 1237 | [ 1238 | "Nivyn", 1239 | "si363", 1240 | 0 1241 | ], 1242 | [ 1243 | "Yong", 1244 | "si363", 1245 | 0 1246 | ], 1247 | [ 1248 | "Ravin", 1249 | "si363", 1250 | 0 1251 | ], 1252 | [ 1253 | "Donnie", 1254 | "si364", 1255 | 1 1256 | ], 1257 | [ 1258 | "Anastasia", 1259 | "si364", 1260 | 0 1261 | ], 1262 | [ 1263 | "Jaeden", 1264 | "si364", 1265 | 0 1266 | ], 1267 | [ 1268 | "Ivan", 1269 | "si364", 1270 | 0 1271 | ], 1272 | [ 1273 | "Natividad", 1274 | "si364", 1275 | 0 1276 | ], 1277 | [ 1278 | "Beyza", 1279 | "si364", 1280 | 0 1281 | ], 1282 | [ 1283 | "Cecily", 1284 | "si364", 1285 | 0 1286 | ], 1287 | [ 1288 | "Rheanan", 1289 | "si364", 1290 | 0 1291 | ], 1292 | [ 1293 | "Ayaan", 1294 | "si364", 1295 | 0 1296 | ], 1297 | [ 1298 | "Sahana", 1299 | "si364", 1300 | 0 1301 | ], 1302 | [ 1303 | "Siannon", 1304 | "si364", 1305 | 0 1306 | ], 1307 | [ 1308 | "Tiarn", 1309 | "si364", 1310 | 0 1311 | ], 1312 | [ 1313 | "Cal", 1314 | "si364", 1315 | 0 1316 | ], 1317 | [ 1318 | "Lacci", 1319 | "si364", 1320 | 0 1321 | ], 1322 | [ 1323 | "Lucille", 1324 | "si364", 1325 | 0 1326 | ], 1327 | [ 1328 | "Deena", 1329 | "si364", 1330 | 0 1331 | ], 1332 | [ 1333 | "Surina", 1334 | "si364", 1335 | 0 1336 | ], 1337 | [ 1338 | "Ala", 1339 | "si364", 1340 | 0 1341 | ], 1342 | [ 1343 | "Peni", 1344 | "si364", 1345 | 0 1346 | ], 1347 | [ 1348 | "Kellan", 1349 | "si364", 1350 | 0 1351 | ], 1352 | [ 1353 | "Carina", 1354 | "si364", 1355 | 0 1356 | ], 1357 | [ 1358 | "Tiree", 1359 | "si422", 1360 | 1 1361 | ], 1362 | [ 1363 | "Ramsey", 1364 | "si422", 1365 | 0 1366 | ], 1367 | [ 1368 | "Cruz", 1369 | "si422", 1370 | 0 1371 | ], 1372 | [ 1373 | "Thorben", 1374 | "si422", 1375 | 0 1376 | ], 1377 | [ 1378 | "Franko", 1379 | "si422", 1380 | 0 1381 | ], 1382 | [ 1383 | "Alanas", 1384 | "si422", 1385 | 0 1386 | ], 1387 | [ 1388 | "Julieanne", 1389 | "si422", 1390 | 0 1391 | ], 1392 | [ 1393 | "Blaire", 1394 | "si422", 1395 | 0 1396 | ], 1397 | [ 1398 | "Chizaram", 1399 | "si422", 1400 | 0 1401 | ], 1402 | [ 1403 | "Yva", 1404 | "si422", 1405 | 0 1406 | ], 1407 | [ 1408 | "Jonathon", 1409 | "si422", 1410 | 0 1411 | ], 1412 | [ 1413 | "Isaa", 1414 | "si422", 1415 | 0 1416 | ], 1417 | [ 1418 | "Rhy", 1419 | "si422", 1420 | 0 1421 | ], 1422 | [ 1423 | "Pamela", 1424 | "si422", 1425 | 0 1426 | ], 1427 | [ 1428 | "Abdulbasir", 1429 | "si422", 1430 | 0 1431 | ], 1432 | [ 1433 | "Stella", 1434 | "si422", 1435 | 0 1436 | ], 1437 | [ 1438 | "Taylar", 1439 | "si422", 1440 | 0 1441 | ], 1442 | [ 1443 | "Owen", 1444 | "si422", 1445 | 0 1446 | ], 1447 | [ 1448 | "Unaiza", 1449 | "si422", 1450 | 0 1451 | ], 1452 | [ 1453 | "Barbara", 1454 | "si422", 1455 | 0 1456 | ], 1457 | [ 1458 | "Sukhmani", 1459 | "si422", 1460 | 0 1461 | ], 1462 | [ 1463 | "Jincheng", 1464 | "si422", 1465 | 0 1466 | ], 1467 | [ 1468 | "Page", 1469 | "si422", 1470 | 0 1471 | ], 1472 | [ 1473 | "Luic", 1474 | "si422", 1475 | 0 1476 | ], 1477 | [ 1478 | "Kaelyn", 1479 | "si430", 1480 | 1 1481 | ], 1482 | [ 1483 | "Ina", 1484 | "si430", 1485 | 0 1486 | ], 1487 | [ 1488 | "Hashem", 1489 | "si430", 1490 | 0 1491 | ], 1492 | [ 1493 | "Amera", 1494 | "si430", 1495 | 0 1496 | ], 1497 | [ 1498 | "Olurotimi", 1499 | "si430", 1500 | 0 1501 | ], 1502 | [ 1503 | "Julita", 1504 | "si430", 1505 | 0 1506 | ], 1507 | [ 1508 | "Evan", 1509 | "si430", 1510 | 0 1511 | ], 1512 | [ 1513 | "Azeem", 1514 | "si430", 1515 | 0 1516 | ], 1517 | [ 1518 | "Caleigh", 1519 | "si430", 1520 | 0 1521 | ], 1522 | [ 1523 | "Cacie", 1524 | "si430", 1525 | 0 1526 | ], 1527 | [ 1528 | "Kavita", 1529 | "si430", 1530 | 0 1531 | ], 1532 | [ 1533 | "Cari", 1534 | "si430", 1535 | 0 1536 | ], 1537 | [ 1538 | "Taonga", 1539 | "si430", 1540 | 0 1541 | ], 1542 | [ 1543 | "Shafaq", 1544 | "si430", 1545 | 0 1546 | ], 1547 | [ 1548 | "Thia", 1549 | "si430", 1550 | 0 1551 | ], 1552 | [ 1553 | "Samuela", 1554 | "si430", 1555 | 0 1556 | ], 1557 | [ 1558 | "Zack", 1559 | "si430", 1560 | 0 1561 | ], 1562 | [ 1563 | "Grace", 1564 | "si430", 1565 | 0 1566 | ], 1567 | [ 1568 | "Fenn", 1569 | "si430", 1570 | 0 1571 | ], 1572 | [ 1573 | "Sammie", 1574 | "si430", 1575 | 0 1576 | ], 1577 | [ 1578 | "Becca", 1579 | "si430", 1580 | 0 1581 | ], 1582 | [ 1583 | "Queenie", 1584 | "si430", 1585 | 0 1586 | ], 1587 | [ 1588 | "Aoibheann", 1589 | "si430", 1590 | 0 1591 | ], 1592 | [ 1593 | "Ayleigh", 1594 | "si430", 1595 | 0 1596 | ], 1597 | [ 1598 | "Wojciech", 1599 | "si430", 1600 | 0 1601 | ], 1602 | [ 1603 | "Keisha", 1604 | "si430", 1605 | 0 1606 | ], 1607 | [ 1608 | "Keeley", 1609 | "si430", 1610 | 0 1611 | ], 1612 | [ 1613 | "James", 1614 | "si430", 1615 | 0 1616 | ], 1617 | [ 1618 | "Bowen", 1619 | "si430", 1620 | 0 1621 | ], 1622 | [ 1623 | "Niven", 1624 | "si430", 1625 | 0 1626 | ] 1627 | ] -------------------------------------------------------------------------------- /Week 4 Many-to-Many Relationships/Assignment/rosterdb.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremy-wl/coursera-using-databases-with-python/cd3154f72cfaa8cb6dc12126d48cfa5fad63f9f6/Week 4 Many-to-Many Relationships/Assignment/rosterdb.sqlite -------------------------------------------------------------------------------- /Week 5 Databases and Visualization/Assignment/README.txt: -------------------------------------------------------------------------------- 1 | Using the Google Geocoding API with a Database and 2 | Visualizing data on Google Map 3 | 4 | In this project, we are using the Google geocoding API 5 | to clean up some user-entered geographic locations of 6 | university names and then placing the data on a Google 7 | Map. 8 | 9 | You should install the SQLite browser to view and modify 10 | the databases from: 11 | 12 | http://sqlitebrowser.org/ 13 | 14 | The first problem to solve is that the Google geocoding 15 | API is rate limited to 2500 requests per day. So if you have 16 | a lot of data you might need to stop and restart the lookup 17 | process several times. So we break the problem into two 18 | phases. 19 | 20 | In the first phase we take our input data in the file 21 | (where.data) and read it one line at a time, and retreive the 22 | geocoded response and store it in a database (geodata.sqlite). 23 | Before we use the geocoding API, we simply check to see if 24 | we already have the data for that particular line of input. 25 | 26 | You can re-start the process at any time by removing the file 27 | geodata.sqlite 28 | 29 | Run the geoload.py program. This program will read the input 30 | lines in where.data and for each line check to see if it is already 31 | in the database and if we don't have the data for the location, 32 | call the geocoding API to retrieve the data and store it in 33 | the database. 34 | 35 | Here is a sample run after there is already some data in the 36 | database: 37 | 38 | Mac: python geoload.py 39 | Win: geoload.py 40 | 41 | Found in database Northeastern University 42 | 43 | Found in database University of Hong Kong, Illinois Institute of Technology, Bradley University 44 | 45 | Found in database Technion 46 | 47 | Found in database Viswakarma Institute, Pune, India 48 | 49 | Found in database UMD 50 | 51 | Found in database Tufts University 52 | 53 | Resolving Monash University 54 | Retrieving http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=Monash+University 55 | Retrieved 2063 characters { "results" : [ 56 | {u'status': u'OK', u'results': ... } 57 | 58 | Resolving Kokshetau Institute of Economics and Management 59 | Retrieving http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=Kokshetau+Institute+of+Economics+and+Management 60 | Retrieved 1749 characters { "results" : [ 61 | {u'status': u'OK', u'results': ... } 62 | 63 | The first five locations are already in the database and so they 64 | are skipped. The program scans to the point where it finds un-retrieved 65 | locations and starts retrieving them. 66 | 67 | The geoload.py can be stopped at any time, and there is a counter 68 | that you can use to limit the number of calls to the geocoding 69 | API for each run. 70 | 71 | Once you have some data loaded into geodata.sqlite, you can 72 | visualize the data using the (geodump.py) program. This 73 | program reads the database and writes tile file (where.js) 74 | with the location, latitude, and longitude in the form of 75 | executable JavaScript code. 76 | 77 | A run of the geodump.py program is as follows: 78 | 79 | Mac: python geodump.py 80 | Win: geodump.py 81 | 82 | Northeastern University, 360 Huntington Avenue, Boston, MA 02115, USA 42.3396998 -71.08975 83 | Bradley University, 1501 West Bradley Avenue, Peoria, IL 61625, USA 40.6963857 -89.6160811 84 | ... 85 | Technion, Viazman 87, Kesalsaba, 32000, Israel 32.7775 35.0216667 86 | Monash University Clayton Campus, Wellington Road, Clayton VIC 3800, Australia -37.9152113 145.134682 87 | Kokshetau, Kazakhstan 53.2833333 69.3833333 88 | ... 89 | 12 records written to where.js 90 | Open where.html to view the data in a browser 91 | 92 | The file (where.html) consists of HTML and JavaScript to visualize 93 | a Google Map. It reads the most recent data in where.js to get 94 | the data to be visualized. Here is the format of the where.js file: 95 | 96 | myData = [ 97 | [42.3396998,-71.08975, 'Northeastern University, 360 Huntington Avenue, Boston, MA 02115, USA'], 98 | [40.6963857,-89.6160811, 'Bradley University, 1501 West Bradley Avenue, Peoria, IL 61625, USA'], 99 | [32.7775,35.0216667, 'Technion, Viazman 87, Kesalsaba, 32000, Israel'], 100 | ... 101 | ]; 102 | 103 | This is a JavaScript list of lists. The syntax for JavaScript 104 | list constants is very similar to Python so the syntax should 105 | be familiar to you. 106 | 107 | Simply open where.html in a browser to see the locations. You 108 | can hover over each map pin to find the location that the 109 | gecoding API returned for the user-entered input. If you 110 | cannot see any data when you open the where.html file, you might 111 | want to check the JavaScript or developer console for your browser. 112 | 113 | -------------------------------------------------------------------------------- /Week 5 Databases and Visualization/Assignment/geodump.py: -------------------------------------------------------------------------------- 1 | import sqlite3 2 | import json 3 | import codecs 4 | 5 | conn = sqlite3.connect('geodata.sqlite') 6 | cur = conn.cursor() 7 | 8 | cur.execute('SELECT * FROM Locations') 9 | fhand = codecs.open('where.js','w', "utf-8") 10 | fhand.write("myData = [\n") 11 | count = 0 12 | for row in cur : 13 | data = str(row[1]) 14 | try: js = json.loads(str(data)) 15 | except: continue 16 | 17 | if not('status' in js and js['status'] == 'OK') : continue 18 | 19 | lat = js["results"][0]["geometry"]["location"]["lat"] 20 | lng = js["results"][0]["geometry"]["location"]["lng"] 21 | if lat == 0 or lng == 0 : continue 22 | where = js['results'][0]['formatted_address'] 23 | where = where.replace("'","") 24 | try : 25 | print where, lat, lng 26 | 27 | count = count + 1 28 | if count > 1 : fhand.write(",\n") 29 | output = "["+str(lat)+","+str(lng)+", '"+where+"']" 30 | fhand.write(output) 31 | except: 32 | continue 33 | 34 | fhand.write("\n];\n") 35 | cur.close() 36 | fhand.close() 37 | print count, "records written to where.js" 38 | print "Open where.html to view the data in a browser" 39 | 40 | -------------------------------------------------------------------------------- /Week 5 Databases and Visualization/Assignment/geoload.py: -------------------------------------------------------------------------------- 1 | import urllib 2 | import sqlite3 3 | import json 4 | import time 5 | import ssl 6 | 7 | # If you are in China use this URL: 8 | # serviceurl = "http://maps.google.cn/maps/api/geocode/json?" 9 | serviceurl = "http://maps.googleapis.com/maps/api/geocode/json?" 10 | 11 | # Deal with SSL certificate anomalies Python > 2.7 12 | # scontext = ssl.SSLContext(ssl.PROTOCOL_TLSv1) 13 | scontext = None 14 | 15 | conn = sqlite3.connect('geodata.sqlite') 16 | cur = conn.cursor() 17 | 18 | cur.execute(''' 19 | CREATE TABLE IF NOT EXISTS Locations (address TEXT, geodata TEXT)''') 20 | 21 | fh = open("where.data") 22 | count = 0 23 | for line in fh: 24 | if count > 200: break 25 | address = line.strip() 26 | print("") 27 | cur.execute("SELECT geodata FROM Locations WHERE address= ?", (address, )) 28 | 29 | try: 30 | data = cur.fetchone()[0] 31 | print("Found in database ", address) 32 | continue 33 | except: 34 | pass 35 | 36 | print("Resolving',", address) 37 | url = serviceurl + urllib.urlencode({"sensor": "false", "address": address}) 38 | print("Retrieving',", url) 39 | uh = urllib.urlopen(url, scontext) 40 | data = uh.read() 41 | print("Retrieved',", len(data), 'characters', data[:20].replace('\n', ' ')) 42 | count += 1 43 | try: 44 | js = json.loads(str(data)) 45 | # print js # We print in case unicode causes an error 46 | except: 47 | continue 48 | 49 | if 'status' not in js or (js['status'] != 'OK' and js['status'] != 'ZERO_RESULTS'): 50 | print("==== Failure To Retrieve ===='") 51 | print(data) 52 | break 53 | 54 | cur.execute('''INSERT INTO Locations (address, geodata) 55 | VALUES ( ?, ? )''', (address, data)) 56 | conn.commit() 57 | time.sleep(1) 58 | 59 | print("Run geodump.py to read the data from the database so you can visualize it on a map.") 60 | -------------------------------------------------------------------------------- /Week 5 Databases and Visualization/Assignment/where.data: -------------------------------------------------------------------------------- 1 | Shanghai Normal University 2 | East China Normal University 3 | Jinmao Tower 4 | Northeastern University 5 | University of Hong Kong, Illinois Institute of Technology, Bradley University 6 | Technion 7 | Viswakarma Institute, Pune, India 8 | UMD 9 | Tufts University 10 | Monash University 11 | Kokshetau Institute of Economics and Management 12 | RSU named S.A. Esenin 13 | Tavrida National V.I. Vernadsky University 14 | UOC 15 | Irkutsk State University 16 | Institute of Technology Telkom 17 | Shanghai Jiao Tong University 18 | University of Ilorin, Kwara State. Nigeria 19 | Monash University Churchill Australia 20 | UNISA 21 | Fachhochschule FH Salzburg 22 | Tampere University of Technology (Tampere, Finland) 23 | Saint Petersburg State University 24 | University of São Paulo 25 | Smolensk State University (Russia) 26 | Institute of Business Administration, Karachi 27 | universidad complutense de madrid 28 | Masdar Institute 29 | University of London 30 | University of Oxford 31 | Tallinn University of Technology 32 | University of Tartu 33 | University of Padua 34 | University of Pune, India 35 | National Kyiv Shevchenko University 36 | UC Berkeley 37 | University of Wisconsin - Madison 38 | Lodz University of Technology 39 | NRU IFMO 40 | Dniepropetrovsk National University (Ukraine), Applied Math Faculty 41 | Dokuz Eylul University, Izmir, Turkey 42 | Beijing normal university 43 | University of Piraeus, Athens 44 | Universidad de Buenos Aires (UBA). Argentina. 45 | SASTRA University 46 | Nagpur University 47 | Duke University 48 | San Francisco State University 49 | FATEC-SP - Faculdade de Tecnologia do Estado de São Paulo 50 | University of Texas at Austin 51 | University of applied sciense of Mikkeli (Finland) 52 | Troy University 53 | Universidade do Minho 54 | National University of Sciences and Technology (NUST)-Pakistan 55 | Pontificia universidad catolica de chile 56 | Illinois State University Joliet Junior College 57 | American University in Cairo (AUC) 58 | Obninsk Technical University of Nuclear Power Engineering, Russia 59 | Vyatka State Humanitarian University 60 | Weizmann Institute of Science (Israel) 61 | University of Washington 62 | Kharkiv State Academy of Municipal Economy, Ukraine 63 | Faculty of Electrical Engineering in Sarajevo, University of Sarajevo 64 | Universidad de Los Andes Colombia 65 | University of Colorado at Boulder 66 | Magnitogorsk State Technical University 67 | USC 68 | Simon Fraser University 69 | Columbia University (New York) 70 | University of Southern California 71 | University of Warsaw 72 | Warsaw University of Technology 73 | (Some place in New Zealand you haven't heard of.) 74 | Massey university part-time Distance learning 75 | University of Oklahoma 76 | University of Pavia, Italy 77 | University of Missouri - Columbia 78 | Czech Technical University in Prague 79 | Illinois Institute of Technology 80 | Penn State University 81 | University of Utah 82 | Faculty of Science, University of Zagreb - Department of Mathematics 83 | Universitat Politecnica de Valencia 84 | University of Vienna 85 | University of Puerto Rico - Mayaguez Campus 86 | University "Hyperion" of Bucharest 87 | University of New Haven 88 | University of Washington -Bothell 89 | Drexel University 90 | University of Texas at Austin 91 | University of Helsinki 92 | University of Michigan 93 | Carnegie Mellon University 94 | Kazan Federal University 95 | Pondicherry University 96 | Far-Eastern State University 97 | Nanyang Technological University 98 | Slovak University of Technology 99 | NYU 100 | UFABC - Universidade Federal do ABC, Sanso André - SP - Brazil 101 | University of Debrecen 102 | California State University, San Bernardino 103 | National University "Kyiv-Mohyla Academy" (Kyiv, Ukraine) 104 | Laurentian University 105 | Humanities Institute of TV and Radio, Moscow, Russia 106 | University of Cambridge, UK 107 | Payame Noor University, Tehran, Iran 108 | Middle East Technical University 109 | EPFL 110 | Faculty of Technical Sciences, Novi Sad, Serbia 111 | University of Gothenburg, Sweden 112 | Polytechnic University of Timisoara 113 | University of Hawaii (Go, Rainbows!) 114 | Belarusian State University 115 | Haaga-Helia university of applied sciences 116 | JADAVPUR UNIVERSITY 117 | Gauhati University, India 118 | Universidad de Buenos Aires 119 | Università degli Studi di Genova, Genova, Italia 120 | King Mongkut's University of Technology Thonburi 121 | Universidad de la Sabana, Chia, Colombia 122 | State University of New York (SUNY) College at Oswego 123 | Kyrgyz Slavic Russian University 124 | De La Salle University http://www.dlsu.edu.ph 125 | Jawaharlal Nehru Technological University, INDIA 126 | UCL (Université Catholique de Louvain) in Belgium 127 | Boston University 128 | The University of Manchester 129 | Fachhochschule Düsseldorf 130 | Pine Manor College (AA), Harvard University (BA), Lesley University (MEd) 131 | Simón Bolívar University 132 | Indiana University at Bloomington 133 | RPI 134 | University of Ottawa, Canada 135 | Ural Federal University 136 | BITS Pilani 137 | Transilvania University 138 | IIT(BHU), Varanasi, India 139 | EM Lyon 140 | Universidad Central de Venezuela 141 | NTUU "KPI" 142 | Universidade Federal da Paraiba, Brazil 143 | Budapest University of Technology and Economics 144 | Moscow Institute of Physics & Technology (State University) 145 | Saint Petersburg State University of Aerospace Instrumentation, Russia 146 | North Central College, Naperville, IL 147 | Tech. Uni. Denmark (DTU) 148 | Stanford 149 | "Politehnica" Timisoara 150 | National University of Engineering 151 | Monash 152 | Federal University of Campina Grande (UFCG) 153 | Universidade Federal do Rio Grande do Sul (UFRGS) 154 | Universidad Nacional Autónoma de México 155 | University of New South Wales Harvard Business School 156 | University of Tehran 157 | Old Dominion University 158 | Kyiv Unisersity of Oriental Language 159 | Babcock University 160 | University of Essex 161 | Kharkiv National University of Radio Electronics (Ukraine) 162 | Kaunas Technology University 163 | University of Buenos Aires 164 | University of Jaffna. 165 | R V College of Engineering, Bangalore, India for BE in Instrumentation Technology 166 | Beloit College 167 | UCLA 168 | University of Chicago 169 | University of Sciences and Technology of Oran. Mohamed Boudiaf (USTO-MB). 170 | Zagazig University, Egypt 171 | University of Alberta 172 | Belorussian State University 173 | Jones International University (online) Illinois State Univeristy 174 | University of Florida 175 | Too many to mention. 176 | University of Kerala, India 177 | Politecnico di Milano 178 | Vilnius Gediminas Technical University 179 | Madras university/ Bharthidasan University in India . 180 | Universidade Tecnica de Lisboa - Instituto Superior Técnico 181 | Does not apply. 182 | Stellenbosch University 183 | imt ghazIABAD INDIA 184 | University of Pennsylvania 185 | National Institute of Technology, Jalandhar (India) 186 | Universidad ICESI 187 | Virginia Tech 188 | arizona state university 189 | Universidad del Valle de Guatemala 190 | Mykolas Romeris University, Vilnius, Lithuania 191 | BSU 192 | Distance Learning Center at the Technical University of Kaiserslautern in Germany 193 | Ain shams university, Cairo, Egypt 194 | Universidad Nacional de Colombia 195 | Saint-Petersburg Polytechnic Univesity 196 | NAIT (Northern Alberta Institute of Technology) 197 | Wayne State took courses at U of M 198 | Universidad Nacional, Costa Rica 199 | Marietta College (Ohio) Northwestern University 200 | Grandville 201 | Portland State University, Oregon Institute of Technology 202 | Malayer Azad University, Iran 203 | -------------------------------------------------------------------------------- /Week 5 Databases and Visualization/Assignment/where.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | A Map of Information 6 | 7 | 8 | 10 | 11 | 12 | 13 | 14 | 43 | 44 | 45 |
46 |

About this Map

47 |

48 | This is a cool map from 49 | www.pythonlearn.com. 50 |

51 | 52 | 53 | -------------------------------------------------------------------------------- /Week 5 Databases and Visualization/Assignment/where.js: -------------------------------------------------------------------------------- 1 | myData = [ 2 | [31.1615031,121.4193454, 'Shanghai Normal University, Xuhui, Shanghai, China, 200231'], 3 | [31.2272891,121.4094554, 'East China Normal University Gymnasium, Huashida, Putuo, Shanghai, China, 200062'], 4 | [31.2352394,121.5058635, 'Jinmao Tower, Lujiazui, Pudong, Shanghai, China'], 5 | [42.340075,-71.0895367, 'Northeastern, Boston, MA 02115, USA'], 6 | [38.2113643,-85.7470011, 'Bradley Ave, Louisville, KY, USA'], 7 | [32.778949,35.019648, 'Technion/ Sports Building, Haifa'], 8 | [18.4574518,73.8837999, 'Vishwakarma Institutes Play Ground, Yashodhan Society, Kapil Nagar, Kondhwa Budrukh, Vishwakarma, Maharashtra 411048, India'], 9 | [31.1615031,121.4193454, 'Shanghai Normal University, Xuhui, Shanghai, China, 200231'], 10 | [31.2272891,121.4094554, 'East China Normal University Gymnasium, Huashida, Putuo, Shanghai, China, 200062'], 11 | [31.2352394,121.5058635, 'Jinmao Tower, Lujiazui, Pudong, Shanghai, China'], 12 | [42.340075,-71.0895367, 'Northeastern, Boston, MA 02115, USA'], 13 | [38.2113643,-85.7470011, 'Bradley Ave, Louisville, KY, USA'], 14 | [32.778949,35.019648, 'Technion/ Sports Building, Haifa'], 15 | [18.4574518,73.8837999, 'Vishwakarma Institutes Play Ground, Yashodhan Society, Kapil Nagar, Kondhwa Budrukh, Vishwakarma, Maharashtra 411048, India'], 16 | [33.1561058,131.826132, 'Japan, 〒875-0002 Ōita-ken, Usuki-shi, Shitanoe, 1232−2 UMD'], 17 | [42.4036847,-71.120482, 'South Hall Tufts University, 30 Lower Campus Rd, Somerville, MA 02144, USA'], 18 | [-37.914517,145.1303881, 'Monash College, Wellington Rd, Clayton VIC 3168, Australia'], 19 | [53.2948229,69.4047872, 'Kokshetau 020000, Kazakhstan'], 20 | [40.7127837,-74.0059413, 'New York, NY, USA'], 21 | [52.2869741,104.3050183, 'Irkutsk, Irkutsk Oblast, Russia'], 22 | [31.1790053,121.4237432, 'Shanghai Sixth Peoples Hospital Affiliated to Shanghai Jiao Tong University, Xuhui, Shanghai, China, 200231'], 23 | [8.5080482,4.5849938, 'Kwara State University, Ilorin, Nigeria'], 24 | [-38.3105571,146.4292232, 'Monash University Gippsland Student Lounge, 7N Mary Grant Bruce Dr, Churchill VIC 3842, Australia'], 25 | [-34.9221963,138.5922272, 'Yungondi Building, North Terrace, Adelaide SA 5000, Australia'], 26 | [47.80949,13.05501, 'Salzburg, Austria'], 27 | [27.7518284,-82.6267345, 'St. Petersburg, FL, USA'], 28 | [28.6853472,-106.1015266, 'São Paulo, Chihuahua, Chih., Mexico'], 29 | [54.7903112,32.0503663, 'Smolensk, Smolensk Oblast, Russia'], 30 | [40.4469796,-3.7278167, 'Av. Complutense, Madrid, Madrid, Spain'], 31 | [24.4325423,54.6174842, 'Masdar Institute Bus Station - Abu Dhabi - United Arab Emirates'], 32 | [51.5266171,-0.1260773, 'University Of London, 1-11 Cartwright Gardens, Kings Cross, London WC1H 9EB, UK'], 33 | [39.5069974,-84.745231, 'Oxford, OH 45056, USA'], 34 | [59.393847,24.6650872, 'Tallinn University of Technology Stadium, 12616 Tallinn, Estonia'], 35 | [58.3733281,26.7265098, 'University of Tartu Physics Building, 50103 Tartu, Estonia'], 36 | [33.6778327,-117.8151285, 'Padua, Irvine, CA 92614, USA'], 37 | [18.5544976,73.8257325, 'Pune University, Ganeshkhind, Pune, Maharashtra, India'], 38 | [37.8764984,-122.2804342, 'California St, Berkeley, CA, USA'], 39 | [43.0412831,-89.4301473, 'University of Wisconsin-Madison Arboretum, 1207 Seminole Hwy, Madison, WI 53711, USA'], 40 | [51.745806,19.4489068, 'Institute of Applied Computer Science, Lodz University of Technology, 90-924 Łódź, Poland'], 41 | [38.3946981,27.0322689, 'İnciraltı, Dokuz Eylül Ünv. Hst., 35330 Balçova/İzmir, Turkey'], 42 | [39.9314428,116.3049709, 'Beijing Normal University, Haidian, Beijing, China, 100000'], 43 | [37.983917,23.7293599, 'Athens, Greece'], 44 | [10.7295115,79.0196067, 'Sastra University Road, Tirumalaisamudram, Tamil Nadu 613401, India'], 45 | [21.1470404,79.0397862, 'Nagpur University Campus, Nagpur, Maharashtra 440033, India'], 46 | [41.9197689,-91.649501, 'Duke St SW, Cedar Rapids, IA 52404, USA'], 47 | [37.7634766,-122.4390923, 'States St, San Francisco, CA 94114, USA'], 48 | [-23.5505199,-46.6333094, 'São Paulo, São Paulo - State of São Paulo, Brazil'], 49 | [30.2850284,-97.7335226, 'University of Texas at Austin, Austin, TX, USA'], 50 | [61.6858074,27.2734876, '50100 Mikkeli, Finland'], 51 | [32.4204729,-85.0323718, 'H. Curtis Pitts Hall, 3413 S Seale Rd, Phenix City, AL 36869, USA'], 52 | [41.557411,-8.397774, 'Universidade do Minho, 4710 Braga, Portugal'], 53 | [-33.0444219,-71.6066334, 'Pontificia Universidad Catolica De Valparaiso - Gimpert, Valparaíso, Valparaíso, Región de Valparaíso, Chile'], 54 | [40.6331249,-89.3985283, 'Illinois, USA'], 55 | [30.0199119,31.5001527, 'AUC Library, Cairo Governorate 11835, Egypt'], 56 | [55.1170375,36.5970818, 'Obninsk, Kaluga Oblast, Russia'], 57 | [31.9026385,34.8085102, 'Weizmann Institute of Science, Herzl St 234, Rehovot, 76100, Israel'], 58 | [31.767879,-106.440736, 'Washington, El Paso, TX 79905, USA'], 59 | [49.9935,36.230383, 'Kharkiv, Kharkiv Oblast, Ukraine'], 60 | [43.8562586,18.4130763, 'Sarajevo, Bosnia and Herzegovina'], 61 | [4.602551,-74.066627, 'Consultorio Jurídico Universidad de Los Andes, Cl. 19, Bogotá, Bogotá, Colombia'], 62 | [40.0082221,-105.2591119, 'Colorado Ave & University Heights, Boulder, CO 80302, USA'], 63 | [53.4129429,59.0016233, 'Magnitogorsk, Chelyabinsk Oblast, Russia'], 64 | [46.4062583,8.9040484, 'Usc, 6749, Switzerland'] 65 | ]; 66 | --------------------------------------------------------------------------------