def demo(): """ Simple Demo of this Module Equivalent from command line: $ python ... >>> from copies.fmqlCacher import FMQLCacher """ logging.basicConfig(level=logging.INFO, format="%(message)s") from copies.fmqlCacher import FMQLCacher cacher = FMQLCacher("Caches") cacher.setVista("CGVISTA", fmqlEP="http://vista.caregraf.org/fmqlEP") cgbs = VistaBuilds("CGVISTA", cacher) buildNames = cgbs.listBuilds() packageNames = cgbs.listPackages() print packageNames print len(packageNames) print len(buildNames) print len(cgbs.listBuilds(False)) print "First build is: %s" % buildNames[0] for i, buildName in enumerate(cgbs.listBuilds(True), 1): ba = cgbs.describeBuild(buildName) print "%d: %s - %s" % (i, buildName, ba["vse:package_name"] if "vse:package_name" in ba else "") flsEffected = cgbs.getFiles() for i, (fid, fi) in enumerate(flsEffected.items(), 1): print "%d: %s - %s" % (i, fid, str(fi)) print len(list(flsEffected)) print "Number of specific values available: %d" % cgbs.getNoSpecificValues()
def demo(): """ Simple Demo of this Module Equivalent from command line: $ python ... >>> from copies.fmqlCacher import FMQLCacher >>> cacher = FMQLCacher("Caches") >>> cacher.setVista("CGVISTA") >>> from vistaSchema import * >>> var = VistaSchema("CGVISTA", cacher) >>> str(vair) 'Schema of CGVISTA' >>> vair.getSchema("2") {... """ logging.basicConfig(level=logging.INFO, format="%(message)s") from copies.fmqlCacher import FMQLCacher cacher = FMQLCacher("Caches") # cacher.setVista("CGVISTA", "http://vista.caregraf.org/fmqlEP") cacher.setVista("GOLD") # vair = VistaSchema("CGVISTA", cacher) vair = VistaSchema("GOLD", cacher) print "Number of files %d, top only %d" % (len(vair.files()), len(vair.files(True))) print "Corrupt Files %d, with corrupt fields %d, deprecated %d, class 3 %d, with .001 field %d, with version set %d" % (len(vair.filesWithAttr(attribute="corruption")), len(vair.filesWithAttr("corruptFields")), len(vair.filesWithAttr("deprecated")), len(vair.filesWithAttr("class3")), len(vair.allFieldsWithAttr("computation001")), len(vair.filesWithAttr("deprecated"))) topFiles = vair.files(True) print "Corrupt Top Files %d, with corrupt fields %d, deprecated %d, class 3 %d, with .001 field %d" % (len(vair.filesWithAttr("corruption", topFiles)), len(vair.filesWithAttr("corruptFields", topFiles)), len(vair.filesWithAttr("deprecated", topFiles)), len(vair.filesWithAssertion(lambda x: "class3" in x, topFiles)), len(vair.allFieldsWithAttr("computation001", topFiles))) print "Total fields %d, corrupt %d, computed fields %d, with transforms %d, with simple indexes %d, class 3 fields %d, class 3 fields in non class 3 files %d" % (len(vair.allFieldsWithAttr()), len(vair.allFieldsWithAttr("corruption")), len(vair.allFieldsWithAttr("computation")), len(vair.allFieldsWithAttr("inputTransform")), len(vair.allFieldsWithAttr("index")), len(vair.allFieldsWithAttr("class3")), len(vair.allFieldsWithAttr("class3", vair.filesWithoutAttr("class3")))) print "Number of data points: %d" % vair.datapoints() print "First 10 computed fields - %s" % str(vair.allFieldsWithAttr("computation")[0:10]) print "Package of 2 is: %s" % vair.package("2")
def demo(): """ Simple Demo of this Module Equivalent from command line: $ python ... >>> from copies.fmqlCacher import FMQLCacher """ logging.basicConfig(level=logging.INFO, format="%(message)s") from copies.fmqlCacher import FMQLCacher cacher = FMQLCacher("Caches") cacher.setVista("CGVISTA", fmqlEP="http://vista.caregraf.org/fmqlEP") cgbs = VistaBuilds("CGVISTA", cacher) buildNames = cgbs.listBuilds() packageNames = cgbs.listPackages() print len(packageNames) print len(buildNames) print len(cgbs.listBuilds(False)) print "First build is: %s" % buildNames[0] for i, buildName in enumerate(cgbs.listBuilds(True), 1): ba = cgbs.describeBuild(buildName) print "%d: %s - %s" % (i, buildName, ba["vse:package_name"] if "vse:package_name" in ba else "") flsEffected = cgbs.getFiles() for i, (fid, fi) in enumerate(flsEffected.items(), 1): print "%d: %s - %s" % (i, fid, str(fi)) print len(list(flsEffected)) print "Number of specific values available: %d" % cgbs.getNoSpecificValues( )
def demo(): logging.basicConfig(level=logging.INFO, format="%(message)s") from copies.fmqlCacher import FMQLCacher cacher = FMQLCacher("Caches") cacher.setVista("GOLD", fmqlEP="http://vista.caregraf.org/fmqlEP") cgps = VistaPackages("GOLD", cacher) for i, packageName in enumerate(cgps.listPackages(), 1): packageAbout = cgps.describePackage(packageName) print "%d. %s - %s - %s - %s" % (i, packageName, packageAbout["class"] if "class" in packageAbout else "NONE", packageAbout["current_version"] if "current_version" in packageAbout else "NONE", "" if "vse:last_installed" not in packageAbout else packageAbout["vse:last_installed"])
def demo(): """ Simple Demo of this Module Equivalent from command line: $ python ... >>> from copies.fmqlCacher import FMQLCacher >>> cacher = FMQLCacher("Caches") >>> cacher.setVista("CGVISTA") >>> from vistaSchema import * >>> var = VistaSchema("CGVISTA", cacher) >>> str(vair) 'Schema of CGVISTA' >>> vair.getSchema("2") {... """ logging.basicConfig(level=logging.INFO, format="%(message)s") from copies.fmqlCacher import FMQLCacher cacher = FMQLCacher("Caches") # cacher.setVista("CGVISTA", "http://vista.caregraf.org/fmqlEP") cacher.setVista("GOLD") # vair = VistaSchema("CGVISTA", cacher) vair = VistaSchema("GOLD", cacher) print "Number of files %d, top only %d" % (len( vair.files()), len(vair.files(True))) print "Corrupt Files %d, with corrupt fields %d, deprecated %d, class 3 %d, with .001 field %d, with version set %d" % ( len(vair.filesWithAttr(attribute="corruption")), len(vair.filesWithAttr("corruptFields")), len(vair.filesWithAttr("deprecated")), len( vair.filesWithAttr("class3")), len(vair.allFieldsWithAttr("computation001")), len(vair.filesWithAttr("deprecated"))) topFiles = vair.files(True) print "Corrupt Top Files %d, with corrupt fields %d, deprecated %d, class 3 %d, with .001 field %d" % ( len(vair.filesWithAttr("corruption", topFiles)), len(vair.filesWithAttr("corruptFields", topFiles)), len(vair.filesWithAttr("deprecated", topFiles)), len(vair.filesWithAssertion(lambda x: "class3" in x, topFiles)), len(vair.allFieldsWithAttr("computation001", topFiles))) print "Total fields %d, corrupt %d, computed fields %d, with transforms %d, with simple indexes %d, class 3 fields %d, class 3 fields in non class 3 files %d" % ( len(vair.allFieldsWithAttr()), len( vair.allFieldsWithAttr("corruption")), len(vair.allFieldsWithAttr("computation")), len(vair.allFieldsWithAttr("inputTransform")), len(vair.allFieldsWithAttr("index")), len(vair.allFieldsWithAttr("class3")), len(vair.allFieldsWithAttr("class3", vair.filesWithoutAttr("class3")))) print "Number of data points: %d" % vair.datapoints() print "First 10 computed fields - %s" % str( vair.allFieldsWithAttr("computation")[0:10]) print "Package of 2 is: %s" % vair.package("2")
def demo(): logging.basicConfig(level=logging.INFO, format="%(message)s") from copies.fmqlCacher import FMQLCacher cacher = FMQLCacher("Caches") cacher.setVista("GOLD", fmqlEP="http://vista.caregraf.org/fmqlEP") cgps = VistaPackages("GOLD", cacher) for i, packageName in enumerate(cgps.listPackages(), 1): packageAbout = cgps.describePackage(packageName) print "%d. %s - %s - %s - %s" % ( i, packageName, packageAbout["class"] if "class" in packageAbout else "NONE", packageAbout["current_version"] if "current_version" in packageAbout else "NONE", "" if "vse:last_installed" not in packageAbout else packageAbout["vse:last_installed"])
def demo(): """ Audit GOLD """ import logging logging.basicConfig(level=logging.INFO, format="%(message)s") from copies.fmqlCacher import FMQLCacher oCacher = FMQLCacher("Caches") oCacher.setVista("GOLD") vbr = VistaMetaAuditer(VistaSchema("GOLD", oCacher), VistaBuilds("GOLD", oCacher)) reportLocation = vbr.report(format="TEXT") print "Report written to %s" % reportLocation
def demo(): import logging logging.basicConfig(level=logging.INFO, format="%(message)s") from copies.fmqlCacher import FMQLCacher gCacher = FMQLCacher("Caches") gCacher.setVista("GOLD") oCacher = FMQLCacher("Caches") oCacher.setVista("CGVISTA", "http://vista.caregraf.org/fmqlEP") vod = VistaOtherDiffer(VistaBuilds("GOLD", gCacher), VistaBuilds("CGVISTA", oCacher), VistaSchema("GOLD", gCacher), VistaSchema("CGVISTA", oCacher)) reportLocation = vod.report(format="HTML") print "Report written to %s" % reportLocation
def demo(): opts, args = getopt.getopt(sys.argv[1:], "") # ex/ python vdm.vistaIdentity CGVISTA HOST PORT 'ACCESS' 'VERIFY' if len(args) < 5: print "invoke with: python vdm.vistaIdentify vistaname 'host' port 'access 'verify'" return logging.basicConfig(level=logging.INFO, format="%(message)s") from copies.fmqlCacher import FMQLCacher cacher = FMQLCacher("Caches") cacher.setVista(vistaLabel=args[0], host=args[1], port=int(args[2]), access=args[3], verify=args[4]) vi = VistaIdentity(args[0], cacher) # ex/ {u'state': u'STATE/OKLAHOMA', 'domain': u'DOMAIN/VISTA.GOLD.MEDSPHERE.COM', u'facility_type': u'FACILITY TYPE/VAO', u'station_number': u'050', u'name': u'SOFTWARE SERVICE'} print vi.identifiers()
def demo(): import logging logging.basicConfig(level=logging.INFO, format="%(message)s") from copies.fmqlCacher import FMQLCacher gCacher = FMQLCacher("Caches") gCacher.setVista("GOLD") oCacher = FMQLCacher("Caches") oCacher.setVista("CGVISTA", "http://vista.caregraf.org/fmqlEP") vod = VistaOtherDiffer( VistaBuilds("GOLD", gCacher), VistaBuilds("CGVISTA", oCacher), VistaSchema("GOLD", gCacher), VistaSchema("CGVISTA", oCacher), ) reportLocation = vod.report(format="HTML") print "Report written to %s" % reportLocation
def demo(): """ Demo expects GOLD to be in its Cache and runs against Caregraf's web-hosted version of OpenVistA 'CGVISTA' Running this and the result: $ python vistaSchemaComparer.py GOLD: Schema Building (with caching) took 0:00:03.548585 CGVISTA: Schema Building (with caching) took 0:00:02.408705 Report written to Reports/schemaGOLD_vs_CGVISTA.html """ import logging logging.basicConfig(level=logging.INFO, format="%(message)s") from copies.fmqlCacher import FMQLCacher gCacher = FMQLCacher("Caches") gCacher.setVista("GOLD") oCacher = FMQLCacher("Caches") oCacher.setVista("CGVISTA", "http://vista.caregraf.org/fmqlEP") vsr = VistaSchemaComparer(VistaSchema("GOLD", gCacher), VistaSchema("CGVISTA", oCacher)) reportLocation = vsr.compare(format="HTML") print "Report written to %s" % reportLocation
def demo(): """ Demo expects GOLD to be in its Cache and runs against Caregraf's web-hosted version of OpenVistA 'CGVISTA' Running this and the result: $ python vistaPackagesComparer.py GOLD: Packages Packageing (with caching) took 0:00:03.548585 CGVISTA: Packages Packageing (with caching) took 0:00:02.408705 Report written to Reports/schemaGOLD_vs_CGVISTA.html """ import logging logging.basicConfig(level=logging.INFO, format="%(message)s") from copies.fmqlCacher import FMQLCacher gCacher = FMQLCacher("Caches") gCacher.setVista("GOLD") oCacher = FMQLCacher("Caches") oCacher.setVista("CGVISTA", "http://vista.caregraf.org/fmqlEP") vbr = VistaPackagesComparer(VistaPackages("GOLD", gCacher), VistaPackages("CGVISTA", oCacher)) reportLocation = vbr.compare(format="HTML") print "Report written to %s" % reportLocation
def demo(): """ Simple Demo of this Module Equivalent from command line: $ python ... >>> from copies.fmqlCacher import FMQLCacher >>> cacher = FMQLCacher("Caches") >>> cacher.setVista("CGVISTA") >>> from vistaSchema import * >>> var = VistaSchema("CGVISTA", cacher) >>> str(vair) 'Schema of CGVISTA' >>> vair.getSchema("2") {... """ logging.basicConfig(level=logging.INFO, format="%(message)s") from copies.fmqlCacher import FMQLCacher cacher = FMQLCacher("Caches") cacher.setVista("CGVISTA", "http://vista.caregraf.org/fmqlEP") vair = VistaSchema("CGVISTA", cacher) print "Name of file 2: %s" % vair.getSchema("2")["name"] print vair.listFiles()