Exemplo n.º 1
0
    def exportAsCCDAById(self):
        patId = self.patientDataId.text
        if (patId.isdigit()):
            ccda_doc = pyccda.CcdaDocument(open('example.xml'))
            ccda_doc._tree.set_ethnicity("", "")
            if (self.genderMale.active == True):
                ccda_doc._tree.set_gender("M", "Male")
            else:
                ccda_doc._tree.set_gender("F", "Female")
            if (self.martSingle.active == True):
                ccda_doc._tree.set_marital_status("S", "Single")
            else:
                if (self.martMarried.active == True):
                    ccda_doc._tree.set_marital_status("M", "Married")
            ccda_doc._tree.set_race("", "")
            ccda_doc._tree.set_ethnicity("", "")
            ccda_doc._tree.set_religion("", "")
            ccda_doc._tree.set_birthplace("", "", "",
                                          self.birthPlaceField.text)
            ccda_doc._tree.set_dob(self.birthDateField.text)
            ccda_doc.set_name(self.nameField.text, self.surnameField.text)

            # interventions = self.dbCom.getPatientInterventions(patId)[0]
            # for intervention in interventions:
            #     ccda_doc.add_procedure(intervention[1],intervention[4],intervention[2])

            ccda_doc._tree.save(self.exportAsCCDAPath.text)
Exemplo n.º 2
0
import pyccda
from datetime import datetime

ccda_doc = pyccda.CcdaDocument(open('example.xml'))
ccda_doc._tree.set_ethnicity("123", "White")
ccda_doc._tree.set_gender("M", "Male")
ccda_doc._tree.set_marital_status("F", "Free")
ccda_doc._tree.set_race("2106-3", "White")
ccda_doc._tree.set_ethnicity("2186-5", "Russian")
ccda_doc._tree.set_religion("1013", "Christian")
ccda_doc._tree.set_birthplace("Perm", "", "27201", "Russia")
ccda_doc._tree.set_dob('20111211')

ccda_doc.add_procedure("Chest X-Ray", '42011-7', '20121122')
ccda_doc.add_vital("Height", '8302-2', '20081123', '181', 'cm')
ccda_doc.set_name("Alex", "Jones")
ccda_doc._tree.save("output.xml")
Exemplo n.º 3
0
import pyccda, xmltodict, json

import sys, string, os

length = len(sys.argv)

print "Parameters: %s" % length

if length != 2:
    raise Exception("Usage: Python Filename XmlFileName")

XmlFileName = sys.argv[1]

print "XmlFileName: %s" % XmlFileName

#section = sys.argv[2]

ccda = pyccda.CcdaDocument(
    open(XmlFileName))  #CCDA_CCD_b1_Ambulatory_v2.xml'))

ccda_message = ccda.to_message()

print ccda.to_json()
Exemplo n.º 4
0
import pyccda,xmltodict,json

#ccda = pyccda.CcdaDocument('<?xml version="1.0" encoding="UTF-8"?><note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Dont forget me this weekend!</body></note>')
#ccda = pyccda.CcdaDocument(open('testdata/CCDA_CCD_b1_Ambulatory_v2.xml') )    #CCDA_CCD_b1_Ambulatory_v2.xml'))
#ccda = pyccda.CcdaDocument(open('testdata/example.xml') )
#ccda = pyccda.CcdaDocument(open('testdata/ca62bccf-2038-4b11-ab7a-9f6d6902397b.xml') )
#ccda = pyccda.CcdaDocument(open('testdata/Vitera_CCDA_SMART_Sample.xml') )
#ccda = pyccda.CcdaDocument(open('testdata/Patient-140.xml') )
#ccda = pyccda.CcdaDocument(open('testdata/InPt_Discharge_Summary_CED_Type.xml') )
#ccda = pyccda.CcdaDocument(open('testdata/AdamEveryman-ReferralSummary.xml') ) 
#ccda = pyccda.CcdaDocument(open('testdata/DOC0002.XML') )  
ccda = pyccda.CcdaDocument(open('testdata/Aggregated-CCD.XML') ) 
#ccda = pyccda.CcdaDocument(open('testdata/2-problems.xml') ) 
    # Returns CCDA represented as a simple CSV, which can be
    # useful to load data into an external data analysis tool.
#print ccda.to_csv()

    # Returns CCDA represented as a protocol buffer message, for easy
    # data access and transfer between systems.
ccda_message = ccda.to_message()

# Easily access health information using the protocol buffer message.
#print json.dumps(ccda_message.allergies) #xmltodict.parse(ccda_message.allergies)
#print json.dumps(ccda_message.demographics)
#print ccda_message.immunizations
#print ccda_message.labs
#print ccda_message.medications
#print ccda_message.problems
#print ccda_message.procedures
#print MessageJSONEncoder(ccda_message.vitals)
print ccda.to_json()
Exemplo n.º 5
0
import pyccda, xmltodict, json
import sys, string, os

length = len(sys.argv)
print "Parameters: %s" % length
if length != 2:
    raise Exception("Usage: Python Filename XmlFileName")
XmlFileName = str(sys.argv[1])
print "XmlFileName: %s" % XmlFileName
#section = sys.argv[2]

ccda = pyccda.CcdaDocument(
    open(XmlFileName)
)  #CCDA_CCD_b1_Ambulatory_v2.xml')) # Creation of ccda object for C-CDA XML file

# My modification starts here...

#print ccda  # ccda Object will parse entire C-CDA XML file to produce ProtoRPC message or CSV document
ccda_message = ccda.to_message(
)  # Using ccda object, we create ProtoRPC message for entire C-CDA XML
#print ccda_message
ccda_csv = ccda.to_csv()  # Using ccda object, we create CSV document object
#print ccda_csv

#print ccda_message.medications   # ProtoRPC message for tag 'Medication" in given C-CDA XML file from folder testdata
print "Allergies in ProtoRPC message:"
print ccda_message.allergies  # ProtoRPC message for tag 'Allergy" in given C-CDA XML file from folder testdata

#print "Complete JSON for given C-CDA XML"
complete_JSON = ccda.to_json(
)  # Apply to_json() from ccda.py to produce string from C-CDA XML