org.openmrs.api
Interface ObsService

All Superinterfaces:
OpenmrsService
All Known Implementing Classes:
ObsServiceImpl

@Transactional
public interface ObsService
extends OpenmrsService

The ObsService deals with saving and getting Obs to/from the database Usage:

  ObsService obsService = Context.getObsService();
 
  // get the obs for patient with internal identifier of 1235
  List<Obs> someObsList = obsService.getObservationsByPerson(new Patient(1235));
 
There are also a number of convenience methods for extracting obs pertaining to certain Concepts, people, or encounters

See Also:
Obs, org.openmrs.ComplexObs, MimeType, Context

Field Summary
static java.lang.Integer PATIENT
          Deprecated. Use OpenmrsConstants#PERSON_TYPE.PATIENT
static java.lang.Integer PERSON
          Deprecated. Use org.openmrs.util.OpenmrsConstants#PERSON_TYPE.PATIENT
static java.lang.Integer USER
          Deprecated. Use OpenmrsConstants.PERSON_TYPE.USER
 
Method Summary
 void createObs(Obs obs)
          Deprecated. use saveObs(Obs, String)
 void createObsGroup(Obs[] obs)
          Deprecated. This method should no longer need to be called on the api. This was meant as temporary until we created a true ObsGroup pojo. Replaced by saveObs(Obs, String)
 void deleteObs(Obs obs)
          Deprecated. use #purgeObs(Obs)
 java.util.List<Obs> findObsByGroupId(java.lang.Integer obsGroupId)
          Deprecated. should use Obs.getGroupMembers() or getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)
 java.util.List<Obs> findObservations(java.lang.String search, boolean includeVoided, java.lang.Integer personType)
          Deprecated. use getObservations(String)
 java.util.List<MimeType> getAllMimeTypes()
          Deprecated. MimeTypes are no longer used. See ConceptComplex and its use of handlers
 java.util.List<MimeType> getAllMimeTypes(boolean includeRetired)
          Deprecated. MimeTypes are no longer used. See ConceptComplex and its use of handlers
 Obs getComplexObs(java.lang.Integer obsId, java.lang.String view)
          Get a complex observation.
 ComplexObsHandler getHandler(java.lang.String key)
          Get the ComplexObsHandler that has been registered with the given key
 java.util.Map<java.lang.String,ComplexObsHandler> getHandlers()
          Gets the handlers map registered
 java.util.List<Obs> getLastNObservations(java.lang.Integer n, Person who, Concept question, boolean includeVoided)
          Deprecated. use getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)
 MimeType getMimeType(java.lang.Integer mimeTypeId)
          Deprecated. MimeTypes are no longer used. See ConceptComplex and its use of handlers
 java.util.List<MimeType> getMimeTypes()
          Deprecated. use getAllMimeTypes()
 java.util.List<java.lang.Object[]> getNumericAnswersForConcept(Concept answer, java.lang.Boolean sortByValue, java.lang.Integer personType, boolean includeVoided)
          Deprecated. use getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)
 Obs getObs(java.lang.Integer obsId)
          Get an observation
 Obs getObsByUuid(java.lang.String uuid)
          Get Obs by its UUID
 java.lang.Integer getObservationCount(java.util.List<ConceptName> conceptNames, boolean includeVoided)
          Gets the number of observations(including voided ones) that are using the specified conceptNames as valueCodedName answers
 java.lang.Integer getObservationCount(java.util.List<Person> whom, java.util.List<Encounter> encounters, java.util.List<Concept> questions, java.util.List<Concept> answers, java.util.List<OpenmrsConstants.PERSON_TYPE> personTypes, java.util.List<Location> locations, java.lang.Integer obsGroupId, java.util.Date fromDate, java.util.Date toDate, boolean includeVoidedObs)
          This method fetches the count of observations according to the criteria in the given arguments.
 java.util.List<Obs> getObservations(Cohort patients, java.util.List<Concept> concepts, java.util.Date fromDate, java.util.Date toDate)
          Deprecated. use getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)
 java.util.List<Obs> getObservations(Concept c, Location loc, java.lang.String sort, java.lang.Integer personType, boolean includeVoided)
          Deprecated. use getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)
 java.util.List<Obs> getObservations(Concept question, java.lang.String sort, java.lang.Integer personType, boolean includeVoided)
          Deprecated. use getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)
 java.util.Set<Obs> getObservations(Encounter whichEncounter)
          Deprecated. use org.openmrs
 java.util.List<Obs> getObservations(java.util.List<Concept> concepts, java.util.Date fromDate, java.util.Date toDate)
          Deprecated. use getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)
 java.util.List<Obs> getObservations(java.util.List<Concept> concepts, java.util.Date fromDate, java.util.Date toDate, boolean includeVoided)
          Deprecated. use getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)
 java.util.List<Obs> getObservations(java.util.List<Person> whom, java.util.List<Encounter> encounters, java.util.List<Concept> questions, java.util.List<Concept> answers, java.util.List<OpenmrsConstants.PERSON_TYPE> personTypes, java.util.List<Location> locations, java.util.List<java.lang.String> sort, java.lang.Integer mostRecentN, java.lang.Integer obsGroupId, java.util.Date fromDate, java.util.Date toDate, boolean includeVoidedObs)
          This method fetches observations according to the criteria in the given arguments.
 java.util.Set<Obs> getObservations(Person who, boolean includeVoided)
          Deprecated. use getObservationsByPerson(Person)
 java.util.Set<Obs> getObservations(Person who, Concept question, boolean includeVoided)
          Deprecated. use getObservationsByPersonAndConcept(Person, Concept)
 java.util.List<Obs> getObservations(java.lang.String searchString)
          This method searches the obs table based on the given searchString.
 java.util.List<Obs> getObservationsAnsweredByConcept(Concept answer, java.lang.Integer personType, boolean includeVoided)
          Deprecated. use getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)
 java.util.List<Obs> getObservationsByPerson(Person who)
          Get all Observations for the given person.
 java.util.List<Obs> getObservationsByPersonAndConcept(Person who, Concept question)
          Get all nonvoided observations for the given patient with the given concept as the question concept (conceptId)
 java.util.List<Obs> getVoidedObservations()
          Deprecated. use getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)
 void purgeMimeType(MimeType mimeType)
          Deprecated. MimeTypes are no longer used. See ConceptComplex and its use of handlers
 void purgeObs(Obs obs)
          Completely remove an observation from the database.
 void purgeObs(Obs obs, boolean cascade)
          Completely remove an observation from the database.
 void registerHandler(java.lang.String key, ComplexObsHandler handler)
          Registers the given handler with the given key If the given String key exists, that handler is overwritten with the given handler
 void registerHandler(java.lang.String key, java.lang.String handlerClass)
          Convenience method for registerHandler(String, ComplexObsHandler)
 void removeHandler(java.lang.String key)
          Remove the handler associated with the key from list of available handlers
 MimeType saveMimeType(MimeType mimeType)
          Deprecated. MimeTypes are no longer used. See ConceptComplex and its use of handlers
 Obs saveObs(Obs obs, java.lang.String changeMessage)
          Save the given obs to the database.
 void setHandlers(java.util.Map<java.lang.String,ComplexObsHandler> handlers)
          Add the given map to this service's handlers.
 void setObsDAO(ObsDAO dao)
          Set the given dao on this obs service.
 Obs unvoidObs(Obs obs)
          Revive an observation (pull a Lazarus)
 void updateObs(Obs obs)
          Deprecated. use saveObs(Obs, String)
 MimeType voidMimeType(MimeType mimeType, java.lang.String reason)
          Deprecated. MimeTypes are no longer used. See ConceptComplex and its use of handlers
 Obs voidObs(Obs obs, java.lang.String reason)
          Equivalent to deleting an observation
 
Methods inherited from interface org.openmrs.api.OpenmrsService
onShutdown, onStartup
 

Field Detail

PERSON

@Deprecated
static final java.lang.Integer PERSON
Deprecated. Use org.openmrs.util.OpenmrsConstants#PERSON_TYPE.PATIENT
See Also:
OpenmrsConstants

PATIENT

@Deprecated
static final java.lang.Integer PATIENT
Deprecated. Use OpenmrsConstants#PERSON_TYPE.PATIENT
See Also:
OpenmrsConstants

USER

@Deprecated
static final java.lang.Integer USER
Deprecated. Use OpenmrsConstants.PERSON_TYPE.USER
See Also:
OpenmrsConstants
Method Detail

setObsDAO

void setObsDAO(ObsDAO dao)
Set the given dao on this obs service. The dao will act as the conduit through with all obs calls get to the database

Parameters:
dao - specific ObsDAO to use for this service

createObs

@Deprecated
@Authorized(value="Add Observations")
void createObs(Obs obs)
               throws APIException
Deprecated. use saveObs(Obs, String)

Create an observation

Parameters:
obs -
Throws:
APIException

createObsGroup

@Deprecated
@Authorized(value="Add Observations")
void createObsGroup(Obs[] obs)
                    throws APIException
Deprecated. This method should no longer need to be called on the api. This was meant as temporary until we created a true ObsGroup pojo. Replaced by saveObs(Obs, String)

Create a grouping of observations (observations linked by Obs.getObsGroupId() The proper use is:
 Obs obsGroup = new Obs();
 for (Obs member : obs) {
   obsGroup.addGroupMember(obs);
 }
 pass obsGroup to createObs(Obs)
 

Parameters:
obs - - array of observations to be grouped
Throws:
APIException

getObs

@Transactional(readOnly=true)
@Authorized(value="View Observations")
Obs getObs(java.lang.Integer obsId)
           throws APIException
Get an observation

Parameters:
obsId - integer obsId of observation desired
Returns:
matching Obs
Throws:
APIException
Expected behavior:
get obs matching given obsId

getObsByUuid

@Transactional(readOnly=true)
@Authorized(value="View Observations")
Obs getObsByUuid(java.lang.String uuid)
                 throws APIException
Get Obs by its UUID

Parameters:
uuid -
Returns:
Throws:
APIException
Expected behavior:
find object given valid uuid, return null if no object found with given uuid

updateObs

@Deprecated
@Authorized(value="Edit Observations")
void updateObs(Obs obs)
               throws APIException
Deprecated. use saveObs(Obs, String)

Save changes to observation

Parameters:
obs -
Throws:
APIException

saveObs

@Authorized(value={"Add Observations","Edit Observations"})
Obs saveObs(Obs obs,
                            java.lang.String changeMessage)
            throws APIException
Save the given obs to the database. This will move the contents of the given obs to the database. This acts as both the initial save and an update kind of save. The returned obs will be the same as the obs passed in. It is included for chaining. If this is an initial save, the obsId on the given obs object will be updated to reflect the auto numbering from the database. The obsId on the returned obs will also have this number. If there is already an obsId on the given obs object, the given obs will be voided and a new row in the database will be created that has a new obs id.

Parameters:
obs - the Obs to save to the database
changeMessage - String explaining why obs is being changed. If obs is a new obs, changeMessage is nullable, or if it is being updated, it would be required
Returns:
Obs that was saved to the database
Throws:
APIException
Expected behavior:
create new file from complex data for new obs, not overwrite file when updating a complex obs, void the given obs in the database, create very basic obs and add new obsId, allow changing of every property on obs, return a different object when updating an obs, set creator and dateCreated on new obs, cascade save to child obs groups, cascade update to new child obs groups

voidObs

@Authorized(value="Edit Observations")
Obs voidObs(Obs obs,
                            java.lang.String reason)
            throws APIException
Equivalent to deleting an observation

Parameters:
obs - Obs to void
reason - String reason it's being voided
Throws:
APIException
Expected behavior:
set voided bit on given obs, fail if reason parameter is empty

unvoidObs

@Authorized(value="Edit Observations")
Obs unvoidObs(Obs obs)
              throws APIException
Revive an observation (pull a Lazarus)

Parameters:
obs - Obs to unvoid
Throws:
APIException
Expected behavior:
unset voided bit on given obs, cascade unvoid to child grouped obs

deleteObs

@Deprecated
@Authorized(value="Delete Observations")
void deleteObs(Obs obs)
               throws APIException
Deprecated. use #purgeObs(Obs)

This method shouldn't be used. Use either purgeObs(Obs) or voidObs(Obs,String)

Parameters:
obs -
Throws:
APIException

purgeObs

@Authorized(value="Delete Observations")
void purgeObs(Obs obs)
              throws APIException
Completely remove an observation from the database. This should typically not be called because we don't want to ever lose data. The data really should be voided and then it is not seen in interface any longer (see #voidObs(Obs) for that one) If other things link to this obs, an error will be thrown.

Parameters:
obs -
Throws:
APIException
See Also:
purgeObs(Obs, boolean)
Expected behavior:
delete the given obs from the database

purgeObs

@Authorized(value="Delete Observations")
void purgeObs(Obs obs,
                              boolean cascade)
              throws APIException
Completely remove an observation from the database. This should typically not be called because we don't want to ever lose data. The data really should be voided and then it is not seen in interface any longer (see #voidObs(Obs) for that one)

Parameters:
obs - the observation to remove from the database
cascade - true/false whether or not to cascade down to other things that link to this observation (like Orders and ObsGroups)
Throws:
APIException
See Also:
purgeObs(Obs, boolean)
Expected behavior:
throw APIException if given true cascade

getMimeTypes

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Mime Types")
java.util.List<MimeType> getMimeTypes()
                                      throws APIException
Deprecated. use getAllMimeTypes()

Throws:
APIException

getAllMimeTypes

@Deprecated
@Authorized(value="View Mime Types")
java.util.List<MimeType> getAllMimeTypes()
                                         throws APIException
Deprecated. MimeTypes are no longer used. See ConceptComplex and its use of handlers

Gets all mime types (including retired ones)

Returns:
list of MimeTypes in the system
Throws:
APIException
See Also:
getAllMimeTypes(boolean)

getAllMimeTypes

@Deprecated
@Authorized(value="View Mime Types")
java.util.List<MimeType> getAllMimeTypes(boolean includeRetired)
                                         throws APIException
Deprecated. MimeTypes are no longer used. See ConceptComplex and its use of handlers

Gets all mime types and disregards the retired ones if includeRetired is true

Parameters:
includeRetired - true/false of whether to also return the retired ones
Returns:
list of MimeTypes lll
Throws:
APIException

getMimeType

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Mime Types")
MimeType getMimeType(java.lang.Integer mimeTypeId)
                     throws APIException
Deprecated. MimeTypes are no longer used. See ConceptComplex and its use of handlers

Get mimeType by internal identifier

Parameters:
mimeTypeId -
Returns:
mimeType with given internal identifier
Throws:
APIException

saveMimeType

@Deprecated
@Authorized(value="Manage Mime Types")
MimeType saveMimeType(MimeType mimeType)
                      throws APIException
Deprecated. MimeTypes are no longer used. See ConceptComplex and its use of handlers

Save the given mimeType to the database. If mimeType is not null, the mimeType is updated in the database. If mimeType is null, a new mimeType is added to the database

Parameters:
mimeType - mimeType
Returns:
mimeType that was saved/updated in the database
Throws:
APIException

voidMimeType

@Deprecated
@Authorized(value="Manage Mime Types")
MimeType voidMimeType(MimeType mimeType,
                                                 java.lang.String reason)
                      throws APIException
Deprecated. MimeTypes are no longer used. See ConceptComplex and its use of handlers

This effectively removes the given mimeType from the system. Voided mimeTypes are still linked to from complexObs, they just aren't shown in the list of available mimeTypes

Parameters:
mimeType - the MimeType to remove
reason - the reason this mimeType is being voided
Returns:
the voided MimeType
Throws:
APIException
See Also:
createObs(Obs)

purgeMimeType

@Deprecated
@Authorized(value="Purge Mime Types")
void purgeMimeType(MimeType mimeType)
                   throws APIException
Deprecated. MimeTypes are no longer used. See ConceptComplex and its use of handlers

This completely removes the given MimeType from the database. If data has been stored already that points at this mimeType an exception is thrown

Parameters:
mimeType - the MimeType to remove
Throws:
APIException
See Also:
purgeMimeType(MimeType)

getObservations

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.Set<Obs> getObservations(Person who,
                                                                            boolean includeVoided)
Deprecated. use getObservationsByPerson(Person)


getObservationsByPerson

@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.List<Obs> getObservationsByPerson(Person who)
Get all Observations for the given person. Does not return voided observations

Parameters:
who - the user to match on
Returns:
a List object containing all non-voided observations for the specified person
See Also:
getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)
Expected behavior:
get all observations assigned to given person

getObservations

@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.List<Obs> getObservations(java.util.List<Person> whom,
                                                                  java.util.List<Encounter> encounters,
                                                                  java.util.List<Concept> questions,
                                                                  java.util.List<Concept> answers,
                                                                  java.util.List<OpenmrsConstants.PERSON_TYPE> personTypes,
                                                                  java.util.List<Location> locations,
                                                                  java.util.List<java.lang.String> sort,
                                                                  java.lang.Integer mostRecentN,
                                                                  java.lang.Integer obsGroupId,
                                                                  java.util.Date fromDate,
                                                                  java.util.Date toDate,
                                                                  boolean includeVoidedObs)
                                    throws APIException
This method fetches observations according to the criteria in the given arguments. All arguments are optional and nullable. If more than one argument is non-null, the result is equivalent to an "and"ing of the arguments. (e.g. if both a location and a fromDate are given, only Obs that are both at that Location and after the fromDate are returned).

Note: If whom has elements, personType is ignored

Note: to get all observations on a certain date, use:
Date fromDate = "2009-08-15";
Date toDate = OpenmrsUtil.lastSecondOfDate(fromDate); List obs = getObservations(...., fromDate, toDate, ...);

Parameters:
whom - List to restrict obs to (optional)
encounters - List to restrict obs to (optional)
questions - List to restrict the obs to (optional)
answers - List to restrict the valueCoded to (optional)
personTypes - List objects to restrict this to. Only used if whom is an empty list (optional)
locations - The org.openmrs.Location objects to restrict to (optional)
sort - list of column names to sort on (obsId, obsDatetime, etc) if null, defaults to obsDatetime (optional)
mostRecentN - restrict the number of obs returned to this size (optional)
obsGroupId - the Obs.getObsGroupId() to this integer (optional)
fromDate - the earliest Obs date to get (optional)
toDate - the latest Obs date to get (optional)
includeVoidedObs - true/false whether to also include the voided obs (required)
Returns:
list of Observations that match all of the criteria given in the arguments
Throws:
APIException
Expected behavior:
compare dates using lte and gte, get all obs assigned to given encounters, get all obs with question concept in given questions parameter, get all obs with answer concept in given answers parameter, return all obs whose person is a person only, return obs whose person is a patient only, return obs whose person is a user only, return obs with location in given locations parameter, sort returned obs by obsDatetime if sort is empty, sort returned obs by conceptId if sort is concept, limit number of obs returned to mostReturnN parameter, return obs whose groupId is given obsGroupId, not include voided obs, include voided obs if includeVoidedObs is true

getObservationCount

@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.lang.Integer getObservationCount(java.util.List<Person> whom,
                                                                    java.util.List<Encounter> encounters,
                                                                    java.util.List<Concept> questions,
                                                                    java.util.List<Concept> answers,
                                                                    java.util.List<OpenmrsConstants.PERSON_TYPE> personTypes,
                                                                    java.util.List<Location> locations,
                                                                    java.lang.Integer obsGroupId,
                                                                    java.util.Date fromDate,
                                                                    java.util.Date toDate,
                                                                    boolean includeVoidedObs)
                                      throws APIException
This method fetches the count of observations according to the criteria in the given arguments. All arguments are optional and nullable. If more than one argument is non-null, the result is equivalent to an "and"ing of the arguments. (e.g. if both a location and a fromDate are given, only Obs that are both at that Location and after the fromDate are returned).

Note: If whom has elements, personType is ignored

Note: to get all observations count on a certain date, use:
Date fromDate = "2009-08-15";
Date toDate = OpenmrsUtil.lastSecondOfDate(fromDate); List obs = getObservations(...., fromDate, toDate, ...);

Parameters:
whom - List to restrict obs to (optional)
encounters - List to restrict obs to (optional)
questions - List to restrict the obs to (optional)
answers - List to restrict the valueCoded to (optional)
personTypes - List objects to restrict this to. Only used if whom is an empty list (optional)
locations - The org.openmrs.Location objects to restrict to (optional) obsDatetime (optional)
obsGroupId - the Obs.getObsGroupId() to this integer (optional)
fromDate - the earliest Obs date to get (optional)
toDate - the latest Obs date to get (optional)
includeVoidedObs - true/false whether to also include the voided obs (required)
Returns:
list of Observations that match all of the criteria given in the arguments
Throws:
APIException
Expected behavior:
compare dates using lte and gte, get the count of all obs assigned to given encounters, get the count of all obs with question concept in given questions parameter, get the count of all obs with answer concept in given answers parameter, return the count of all obs whose person is a person only, return the count of all obs whose person is a patient only, return the count of obs whose person is a user only, return the count of obs with location in given locations parameter, return the count of obs whose groupId is given obsGroupId, not include count of voided obs, include count of voided obs if includeVoidedObs is true

getObservations

@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.List<Obs> getObservations(java.lang.String searchString)
                                    throws APIException
This method searches the obs table based on the given searchString.

Parameters:
searchString - The string to search on
Returns:
observations matching the given string
Throws:
APIException
Expected behavior:
get obs matching patient identifier in searchString, get obs matching encounterId in searchString, get obs matching obsId in searchString

getObservations

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.List<Obs> getObservations(Concept c,
                                                                             Location loc,
                                                                             java.lang.String sort,
                                                                             java.lang.Integer personType,
                                                                             boolean includeVoided)
Deprecated. use getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)


getObservations

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.Set<Obs> getObservations(Person who,
                                                                            Concept question,
                                                                            boolean includeVoided)
Deprecated. use getObservationsByPersonAndConcept(Person, Concept)


getObservationsByPersonAndConcept

@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.List<Obs> getObservationsByPersonAndConcept(Person who,
                                                                                    Concept question)
                                                      throws APIException
Get all nonvoided observations for the given patient with the given concept as the question concept (conceptId)

Parameters:
who - person to match on
question - conceptId to match on
Returns:
list of all nonvoided observations matching these criteria
Throws:
APIException
See Also:
getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)
Expected behavior:
get observations matching person and question, not fail with null person parameter

getLastNObservations

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.List<Obs> getLastNObservations(java.lang.Integer n,
                                                                                  Person who,
                                                                                  Concept question,
                                                                                  boolean includeVoided)
Deprecated. use getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)


getObservations

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.List<Obs> getObservations(Concept question,
                                                                             java.lang.String sort,
                                                                             java.lang.Integer personType,
                                                                             boolean includeVoided)
Deprecated. use getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)


getObservationsAnsweredByConcept

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.List<Obs> getObservationsAnsweredByConcept(Concept answer,
                                                                                              java.lang.Integer personType,
                                                                                              boolean includeVoided)
Deprecated. use getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)


getNumericAnswersForConcept

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.List<java.lang.Object[]> getNumericAnswersForConcept(Concept answer,
                                                                                                        java.lang.Boolean sortByValue,
                                                                                                        java.lang.Integer personType,
                                                                                                        boolean includeVoided)
Deprecated. use getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)

Return all numeric answer values for the given concept ordered by value numeric low to high personType should be one of PATIENT, PERSON, or USER;

Parameters:
answer -
sortByValue - true/false if sorting by valueNumeric. If false, will sort by obsDatetime
personType -
Returns:
List [0]=obsId, [1]=obsDatetime, [2]= valueNumerics

getObservations

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.Set<Obs> getObservations(Encounter whichEncounter)
Deprecated. use org.openmrs


getVoidedObservations

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.List<Obs> getVoidedObservations()
Deprecated. use getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)


findObservations

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.List<Obs> findObservations(java.lang.String search,
                                                                              boolean includeVoided,
                                                                              java.lang.Integer personType)
Deprecated. use getObservations(String)


findObsByGroupId

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.List<Obs> findObsByGroupId(java.lang.Integer obsGroupId)
Deprecated. should use Obs.getGroupMembers() or getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)


getObservations

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.List<Obs> getObservations(java.util.List<Concept> concepts,
                                                                             java.util.Date fromDate,
                                                                             java.util.Date toDate,
                                                                             boolean includeVoided)
Deprecated. use getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)


getObservations

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.List<Obs> getObservations(java.util.List<Concept> concepts,
                                                                             java.util.Date fromDate,
                                                                             java.util.Date toDate)
Deprecated. use getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)


getObservations

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.List<Obs> getObservations(Cohort patients,
                                                                             java.util.List<Concept> concepts,
                                                                             java.util.Date fromDate,
                                                                             java.util.Date toDate)
Deprecated. use getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)


getComplexObs

@Transactional(readOnly=true)
@Authorized(value="View Observations")
Obs getComplexObs(java.lang.Integer obsId,
                                                java.lang.String view)
                  throws APIException
Get a complex observation. If obs.isComplex() is true, then returns an Obs with its ComplexData. Otherwise returns a simple Obs. TODO: Possibly remove this method. It is confusing because you may have a complexObs, but not want the complexData attached at the time. Nevertheless, you may think that this method is necessary to use, when you could just call getObs(). This will attach the complexData onto the obs.

Parameters:
obsId -
Returns:
Obs with a ComplexData
Throws:
APIException
Since:
1.5
Expected behavior:
fill in complex data object for complex obs, return normal obs for non complex obs, not fail with null view

getHandler

@Transactional(readOnly=true)
ComplexObsHandler getHandler(java.lang.String key)
                             throws APIException
Get the ComplexObsHandler that has been registered with the given key

Parameters:
key - that has been registered with a handler class
Returns:
Object representing the handler for the given key
Throws:
APIException
Since:
1.5
Expected behavior:
get handler with matching key, have default image and text handlers registered by spring

setHandlers

void setHandlers(java.util.Map<java.lang.String,ComplexObsHandler> handlers)
                 throws APIException
Add the given map to this service's handlers. This method registers each ComplexObsHandler to this service. If the given String key exists, that handler is overwritten with the given handler For most situations, this map is set via spring, see the applicationContext-service.xml file to add more handlers.

Parameters:
handlers - Map of class to handler object
Throws:
APIException
Since:
1.5
Expected behavior:
override handlers with same key, add new handlers with new keys

getHandlers

@Transactional(readOnly=true)
java.util.Map<java.lang.String,ComplexObsHandler> getHandlers()
                                                              throws APIException
Gets the handlers map registered

Returns:
map of keys to handlers
Throws:
APIException
Since:
1.5
Expected behavior:
never return null

registerHandler

void registerHandler(java.lang.String key,
                     ComplexObsHandler handler)
                     throws APIException
Registers the given handler with the given key If the given String key exists, that handler is overwritten with the given handler

Parameters:
key - the key name to use for this handler
handler - the class to register with this key
Throws:
APIException
Since:
1.5
Expected behavior:
register handler with the given key

registerHandler

void registerHandler(java.lang.String key,
                     java.lang.String handlerClass)
                     throws APIException
Convenience method for registerHandler(String, ComplexObsHandler)

Parameters:
key - the key name to use for this handler
handlerClass - the class to register with this key
Throws:
APIException
Since:
1.5
Expected behavior:
load handler and register key

removeHandler

void removeHandler(java.lang.String key)
                   throws APIException
Remove the handler associated with the key from list of available handlers

Parameters:
key - the key of the handler to unregister
Throws:
APIException
Since:
1.5
Expected behavior:
remove handler with matching key, not fail with invalid key

getObservationCount

@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.lang.Integer getObservationCount(java.util.List<ConceptName> conceptNames,
                                                                    boolean includeVoided)
Gets the number of observations(including voided ones) that are using the specified conceptNames as valueCodedName answers

Parameters:
conceptNames - the conceptNames to be searched against
includeVoided - whether voided observation should be included
Returns:
The number of observations using the specified conceptNames as valueCodedNames
Since:
Version 1.7
Expected behavior:
return the count of all observations using the specified conceptNames as answers, include voided observations using the specified conceptNames as answers, return zero if no observation is using any of the concepNames in the list

OpenMRS-1.7.x

Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change