Configuration Guide
Config files (*.ini files) configure the initial settings for the ISIS-NBP's pymx program, like input and output encoding, server ports, byte order, etc.
Pymx will ignore any option key whose name begins with a hash (#) character. This allows you to effectively comment out an option without deleting the entire key from the file.
There are some specific settings that allows the correct handling of the database.
It is necessary to create one configuration file per database with specific settings for this. The configuration directives are grouped into four basic sections:
- Engine: Defines environment parameters;
- Collections: Section to add new collections;
- Gateway: Defines specific parameters to the servers (SSH and Web);
- IsisDB: Parameters for database handling;
Engine
- INPUT_ENCODING: Defines database encoding (read). An incorrect encoding can stop reading from a database. (Default: utf-8)
- OUTPUT_ENCODING: Defines the output encoding; (Default Linux: utf-8, Windows: cp850)
- LANGUAGE: Language support (Default: en);
- FDT_LINE: Regular expression to read FDT file;
- LOG_PATH: The location of the log file; (Default: /tmp/pymx.log)
- LOG_LEVEL: Values 10=DEBUG, 20=INFO, 30=WARNING, 40=ERROR (Default: DEBUG);
- SEARCH_PATH: Set a search path for database files. It contains a list of folders. (Trivial syntax REF and Lookup functions);
- YACC_DEBUG: Enable Yacc debug; (Default: False)
- PARSER_AUXFILES_DIR: The location of Yacc debug file path; (Default: /tmp/)
Language support notes: http://reddes.bvsaude.org/projects/isisnbp/browser/isisnbp-poc/trunk/pyisis/pyisis/i18n/I18N.txt
Example:
# Comment [Engine] INPUT_ENCODING = cp850 OUTPUT_ENCODING = utf8 LANGUAGE = pt_BR LOG_LEVEL = 20 LOG_PATH = /tmp/pymx.log SEARCH_PATH = /home/test;/home/brm/lil FDT_LINE = (?P<name>\w[\w\s]*?\w)\s+(?P<subfields>\w*)\s+(?P<tag>\d*)\s+(?P<size>\d*)\s+(?P<etype>\d+)\s+(?P<repeat>\d+)
FDT_LINE defines a regular expression to match specifics fdt's file format.
Example: To use the cds.fdt sample file with database cds
W:CDS F:CDS CDS1 S:CDS CDS0 *** Conference main entry npdz 12 300 0 0 Title z 24 500 0 0 Edition 25 100 0 0 Imprint abc 26 300 0 0 Collation abc 30 100 0 0 Series vz 44 300 0 1 Notes 50 500 0 0 Keywords 69 1000 0 0 Personal Authors 70 100 0 1 Corporate Bodies 71 300 0 1 Meetings npdz 72 300 0 1 Added Title z 74 500 0 1 Other language titles z 76 500 0 1
The ISIS-NBP loads cds.fdt file when opens database cds and put the fields in Mastefile.fdt dictionary. Now we can use fdt dictionary to show properties like repeat, name, tag, subfileds, size defined in cds.fdt.
In [1]: db = sample.cds In [2]: print db.fdt[70] ------> print(db.fdt[70]) {'repeat': '1', 'name': 'Personal', 'tag': '70', 'etype': '0', 'subfields': 'Authors', 'size': '100'} In [3]:
Collections
To add new collections to ISIS-NBP, create a new .ini file and put a section 'Collections' with the NAME, TYPE and PATH.
Syntax:
NAME = TYPE, PATH
Example:
Create test.ini:
[Collections] lil = IsisCollection,/home/brm/lil/ temp = IsisCollection,/tmp
Load ISIS-NBP with test.ini:
$ pymx -i -f test.ini Welcome to ISIS-NBP Cell 0.9.2 Interactive Console Python 2.6.3 (r263:75183, Oct 4 2009, 11:40:05) [GCC 4.4.1] Use the console to test and inspect the collections. Type 'collection' to see a dictionary with all available collections. Type '<Ctrl-D>' or 'exit()' followed by '<enter>' to quit. The available collections are: sample, lil, current, temp In [1]: print lil Databases: ntitle, ntitleIbm850, mail In [2]: db = lil.ntitle In [3]: print db[1] MFN: 1 3:LOCAL 5:S 6:s . . .
Gateway
- HTTP_PORT: TCP port to listen HTTP requests; (Default: 8080)
- SSH_PORT: TCP port to listen SSH requests; (Default: 2222)
- USERNAME: SSH server username; (Default: admin)
- PASSWORD: SSH server password. (Default: admin)
Example:
[Gateway] HTTP_PORT = 9000 SSH_PORT = 2022 USERNAME = administrator PASSWORD = adminpassword
IsisDB
- SUBFIELD_DELIMITER: Subfield delimeter character in the record; (Default: )
- BYTE_ORDER: Big or Little-endian byte order (Default: little)
- LEADER_XL: Used to switch to large or small leader file format: True=Large, False=Small. (Default: True)
Example:
[IsisDB] SUBFIELD_DELIMITER = ^ BYTE_ORDER = little LEADER_XL = True