indivo.rdf package

Submodules

indivo.rdf.parser module

indivo.rdf.parser.parse(doc_etree)

parse RDF/XML into Facts

indivo.rdf.rdf module

Utilities for generating RDF graphs.

Adapted from the Smart Sample Data generator.

class indivo.rdf.rdf.PatientGraph(record)

Bases: object

Represents a patient’s RDF graph

_getCodeFromField(model, field_prefix, classes=None)

Build up a dictionary representing a sp:code

_getCodedValueFromField(model, field_prefix, classes=None)

Build up a dictionary representing a sp:CodedValue

_getProvenanceFromField(model, field_prefix)

Build up a dictionary representing a sp:provenance

_obj_fields_by_name(obj, prefix, suffixes)

Given an object, returns a dictionary of its attributes based on prefix and suffixes.

Specifically, the dictionary is of the form:

{
  'suffix': getattr(obj, prefix + '_' + suffix)
}

for each suffix in suffixes.

addAllergyExclusions(exclusions)

Add allergy exclusions to the patient graph.

addAllergyList(allergies)

Add a list of allergies to the patient graph.

addClinicalNoteList(notes, order_results=False)

Add clinical notes to a patient’s graph

addCombinedAllergyList(combinedAllergies, order_results=False)

Add a list of AllergyExclusions and Allergies to the patient graph

addCombinedResponseSummary(query, result_order=None)

Add SMART ResponseSummary to the graph based off queries with merged results

addDemographics(record)

Adds patient Demographics info to the graph.

addEncounterList(encounters, order_results=False)

Add encounters to a patient’s graph

addFill(fill, medNode=None, med_uri_only=True)

Build a Fill and add it to the patient graph, optionally linking it with a medication node.

addFillList(fills, order_results=False)

Adds a FillList to a patient’s graph.

addImmunizationList(immunizations, order_results=False)

Add immunizations to a patient’s graph

addLabPanelList(lab_panels, order_results=False)

Adds Lab Panels to the patient’s graph

addLabResultList(labs, order_results=False)

Adds Lab Results to the patient’s graph

addMedList(meds, order_results=False)

Adds a MedList to a patient’s graph

addProblemList(problems, order_results=None)

Add problems to a patient’s graph

addProcedureList(procedures, order_results=False)

Add procedures to a patient’s graph

addResponseSummary(query, result_order=None)

Add SMART ResponseSummary to the graph

addSocialHistoryList(histories, order_results=False)

Add social histories to a patient’s graph

addStatement(s)
addVitalsList(vitals, order_results=False)

Add vitals to a patient’s graph

address(obj, prefix)
allergy(allergy)

Build an Allergy

allergy_exclusion(exclusion)

Build an AllergyExclusion

bloodPressure(obj, prefix)
code(title, system, identifier, blank=False, classes=[])

Adds a Code to the graph and returns node

codeProvenance(provenance)

Adds a CodeProvenance to the graph and returns node

codedValue(codeclass, uri, title, system, identifier)

Adds a CodedValue to the graph and returns node

encounter(encounter)

Build an Encounter, but don’t link it to a patient graph

lab_result(lab)

Build a Medication, but don’t add fills and don’t link it to the patient. Returns the med node.

medication(m)

Build a Medication, but don’t add fills and don’t link it to the patient. Returns the med node.

name(obj, prefix)
newCodedValue(coded_value)

Adds a CodedValue to the graph and returns a node

new_code(code, blank=False)

Adds a Code to the graph and returns node

organization(obj, prefix)
pharmacy(obj, prefix)
provider(obj, prefix)
quantitativeResult(obj, prefix)

Adds a QuantitativeResult node to a graph; returns the node

telephone(obj, prefix)
toRDF(format='xml')
valueAndUnit(value, units)

Adds a ValueAndUnit node to a graph; returns the node

valueAndUnitFromObj(obj, prefix)
valueRange(obj, prefix)

Adds a ValueRange node to a graph; returns the node

vital(obj, prefix)

Module contents