Well, VistA has a ton of data already loaded for you, so let's check it out.
Most things(objects) in VistA have an internal and external representation. Basically this means each object has an internal id and a value. The internal id is generally a positive integer(often referred to as an IEN or IFN or DFN). The value is generally a human readable string.
Lists are returned as an array of string.
Here are the first bunch with Ruby code:
Providers
array = broker.call_a("ORQPT PROVIDERS")
puts array[0] # outputs providerIEN^providername e.g. 42^ USER,PHYSICIAN
puts array[0] # outputs providerIEN^providername e.g. 42^ USER,PHYSICIAN
Locations
Clinics - Outpatient
array = broker.call_a("ORWU CLINCLOC", ["", "1"])
puts array[0] # outputs locationIEN^locationname e.g. 15^CARDIOLOGY
puts array[0] # outputs locationIEN^locationname e.g. 15^CARDIOLOGY
Wards - Inpatient
array = broker.call_a("ORQPT WARDS")
puts array[0] # outputs locationIEN^locationname e.g. 2^MED/SURG
puts array[0] # outputs locationIEN^locationname e.g. 2^MED/SURG
Patients - There are many ways to get lists of patients. Some examples:
By Ward
array = broker.call_a("ORQPT WARD PATIENTS", [wardIEN])
puts array[0] # outputs patientIEN^patientname e.g. 17^SMITH,BETTY
puts array[0] # outputs patientIEN^patientname e.g. 17^SMITH,BETTY
All Patients
array = broker.call_a("ORWPT LIST ALL", ["", "1"])
This call returns a preset number of patients out of the list. You need to use this call in a loop where you call the RPC additional times using the last array entry from the previous call as the first argument until it returns an array of size 0.
You can also get lists of patient by provider, appointment dates, teams, and others. Let me know if you need help finding the RPCs
Problems
Problems use a search approach.
array = broker.call_a("ORQQPL PROBLEM LEX SEARCH", ["hypertension", "100", "", "0"])
Argument 1 is the term you are looking for
Argument 2 is the maximum number of matches
Argument 3 is something to do with view...leaving it blank
Argument 4 is the date to use for determining when problems were valid in the VistA system.
puts array[0] # problemIEN^problemname^codename^codeIEN^code source
# for example: 60339^Hypertension *^401.9^2477^ICD-9-CM
# for example: 60339^Hypertension *^401.9^2477^ICD-9-CM
Up next...medication lists, procedure lists, and other order lists.
No comments:
Post a Comment