Package: cccbr-methods
CCCBR Methods LibraryThis is aSQLAlchemy+ SQLite3 interface to theCCCBR Methods Library.>>> cccbr_methods.get('Double Norwich', stage=8).full_notation # Full place notation
'-.14.-.36.-.58.-.18.-.58.-.36.-.14.-.18'InstallationInstall withpip install cccbr_methods, or download and runpython setup.py.Searching for methodsThe module provides two methods for searching the database:getandsearch; they differ only in thatgetreturns the first result, whilesearchreturns a list of all results.Both methods take asearch_stringargument; a method matches a search string if the string appears anywhere inMethod.title(e.g.cccbr_methods.search("Surprise")will return all Surprise methods.)getwill preferentially return exact matches ofsearch_string.>>> cccbr_methods.get('Double Norwich Court Bob Major') # Returns the first result
<Method Double Norwich Court Bob Major>

>>> cccbr_methods.search('Norwich Court') # Returns all results
[<Method Single Norwich Court Bob Major>, <Method Double Norwich Court Bob Major>, <Method Single Norwich Court Bob Caters>, <Method Double Norwich Court Bob Caters>, <Method Double Norwich Court Bob Royal>, <Method Double Norwich Court Bob Cinques>, <Method Double Norwich Court Bob Maximus>]Other attributes can be passed as keyword arguments to further filter results:>>> cccbr_methods.search('Double Norwich', stage=8) # Filter results further
[<Method Double Norwich Court Bob Major>]As a convenience for more complicated searches,cccbr_methods.queryreturns a SQLAlchemyQueryobject suitable for further filtering.All of these are also available directly from theMethodobject, e.g.Method.getis equivalent tocccbr_methods.get.Database columnsThe database has two columns — one for methods, and one for significant performances. The database is deliberately sparse — many columns will be null if that information was not included in the original Library.methodsThemethodstable has the following columns:id (Integer)— The method ID assigned by the CCCBR library (with the 'm' prefixed stripped)name (String)— The method name,excludingclass & stage namestitle (String)— The method name,includingclass & stage namesstage (Integer)leadhead (String)leadheadcode (String)symmetry (String)notation (String)— The method place notationfalseness (String)— The False Course Headsextensionconstruction (String)classification (String)— classification (e.g. 'Bob', 'Treble Bob', etc.)trebledodging (Boolean)little (Boolean)differential (Boolean)lengthoflead (Integer)numberofhunts (Integer)huntbellpath (String)methodset_notes (String)— the notes field included in the MethodSetnotes (String)— the method notes from the librarypmmref, bnref, cbref, rwref, tdmmref (String)— various reference types included in the LibraryperformancesTheperformacestable has the following columns:id (Integer)— an autoincremented ID number (does not correspond to anything in the Library)kind (String)— one offirstowerbellpeal, firsthandbellpeal, firstinclusionintowerbellpeal, firstinclusioninhandbellpeal, firstextentdate (Date)society (String)town (String)county (String)building (String)address (String)country (String)room (String)region (String)method_id_fk (Integer; Foreign Key)Object interfaceThis module provides two classes — one for methods, and one for the performances included in the CCCBR Library.MethodTheMethodclass provides access to objects from themethodstable in the database. All columns in the table are accessible as properties with the same name and type. The class additionally implements the following helper properties:full_notation— returns the full place notation (expanding any symmetry) as a stringfull_notation_list- returns the full place notation as a list of stringsperformances— returns a list ofPerformanceobjects corresponding to the performances linked to this method in the databaseMethodalso provides an__iter__object over the columns in the table; in particular,dict(<Method>)will give you a dictionary of{column_name: column_value}.PerformanceThePerformanceclass provides access to objects from theperformancestable in the database. All columns in the table are accessible as properties with the same name and type. Additionally, a helper propertymethodreturns aMethodobject corresponding to the method linked to the performance in the database.Performancealso provides an__iter__object over the columns in the database; in particular,dict(<Performance>)will give you a dictionary of{column_name: column_value}.Updating the DatabaseWhile I make an effort to keep the database distributed with this package up to date, it may sometimes lag the CCCBR library. The module therefore provides the means update the database on demand.cccbr_methods.update_database()will download and parse the library, adding any new methods to the database. A CLI entry point is also provided:update-cccbr-methods.License informationThis code is released under an MIT license. The CCCBR Methods database is copyright 2020 Central Council of Church Bell Ringers.