-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7147f92
Showing
28 changed files
with
1,816 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
01. install python | ||
02. install mysql | ||
03. python setup.py build # should install python dependencies | ||
04. echo "CREATE DATABASE id CHARACTER SET utf8; GRANT ALL ON id.* to '{username}'@'localhost' identified by '{password}';" | mysql -u root -p | ||
|
||
05. update DATABASE_USER and DATABASE_PASSWORD in settings.py | ||
06. update MEDIA_ROOT in settings.py to be the full path to the static directory | ||
07. change AUTHORITIES_URL as appropriate in settings.py | ||
08. python manage.py syncdb | ||
09. echo "ALTER table authorities_concept ADD FULLTEXT INDEX concept_fulltext_index (pref_label);" | mysql -u {username} -p id | ||
10. python manage.py load_marcxml marc.xml | ||
11. python manage.py runserver | ||
12. go to http://localhost:8000/authorities |
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import logging | ||
import fileinput | ||
|
||
from django.core.management.base import BaseCommand | ||
import pymarc | ||
|
||
from id.authorities.marc import create_concept, link_concept | ||
|
||
class Command(BaseCommand): | ||
help = 'load a marcxml file' | ||
args = '<marcxml filename>+' | ||
|
||
def handle(self, *files, **options): | ||
logging.basicConfig() | ||
logger = logging.getLogger() | ||
logger.setLevel(logging.DEBUG) | ||
file_handler = logging.FileHandler('load_marcxml.log') | ||
formatter = logging.Formatter('[%(asctime)s %(levelname)s %(name)s] %(message)s') | ||
file_handler.setFormatter(formatter) | ||
logger.addHandler(file_handler) | ||
|
||
for f in files: | ||
logger.info('creating concepts in %s' % f) | ||
for r in pymarc.MARCReader(file(f)): | ||
create_concept(r) | ||
|
||
for f in files: | ||
logger.info('linking concepts in: ' + ', '.join(files)) | ||
for r in pymarc.MARCReader(file(f)): | ||
link_concept(r) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import logging | ||
|
||
from django.core.management.base import BaseCommand | ||
from pymarc.marcxml import map_xml | ||
|
||
from id.authorities.marc import create_concept, link_concept | ||
|
||
class Command(BaseCommand): | ||
help = 'load a marcxml file' | ||
args = '<marcxml filename>+' | ||
|
||
def handle(self, *files, **options): | ||
logging.basicConfig() | ||
logger = logging.getLogger() | ||
logger.setLevel(logging.DEBUG) | ||
file_handler = logging.FileHandler('load_marcxml.log') | ||
formatter = logging.Formatter('[%(asctime)s %(levelname)s %(name)s] %(message)s') | ||
file_handler.setFormatter(formatter) | ||
logger.addHandler(file_handler) | ||
|
||
logger.info('creating concepts in: ' + ', '.join(files)) | ||
map_xml(create_concept, *files) | ||
|
||
logger.info('linking concepts in: ' + ', '.join(files)) | ||
map_xml(link_concept, *files) |
Oops, something went wrong.