public interface ConceptService extends OpenmrsService
To get a list of concepts:
List<Concept> concepts = Context.getConceptService().getAllConcepts();To get a single concept:
// if there is a concept row in the database with concept_id = 3845 Concept concept = Context.getConceptService().getConcept(3845); String name = concept.getPreferredName(Context.getLocale()).getName();To save a concept to the database
Concept concept = new Concept(); concept.setConceptClass(Context.getConceptService().getConceptClass(3)); concept.setDatatype(Context.getConceptService().getConceptDatatype(17)); concept.setName... ... // and other required values on the concept Context.getConceptService().saveConcept(concept);
Context
Modifier and Type | Method and Description |
---|---|
void |
checkIfLocked()
Check if the concepts are locked and if so, throw exception during manipulation of concept
|
Iterator<Concept> |
conceptIterator()
Returns an iterator for all concepts, including retired and expired.
|
void |
convertBooleanConceptToCoded(Concept conceptToChange)
Changes the datatype of a concept from boolean to coded when it has observations it is
associated to.
|
void |
deleteConceptStopWord(Integer conceptStopWordId)
Delete the given
ConceptStopWord in the database |
List<ConceptSearchResult> |
findConceptAnswers(String phrase,
Locale locale,
Concept concept)
Finds concepts that are possible value coded answers to concept parameter
|
List<ConceptMapType> |
getActiveConceptMapTypes()
Returns a list of concept map types currently in the database excluding hidden ones
|
List<ConceptAttributeType> |
getAllConceptAttributeTypes() |
List<ConceptClass> |
getAllConceptClasses()
Return a list of concept classes currently in the database
|
List<ConceptClass> |
getAllConceptClasses(boolean includeRetired)
Return a list of concept classes currently in the database
|
List<ConceptDatatype> |
getAllConceptDatatypes()
Return a list of all concept datatypes currently in the database
|
List<ConceptDatatype> |
getAllConceptDatatypes(boolean includeRetired)
Return a list of concept datatypes currently in the database
|
List<ConceptNameTag> |
getAllConceptNameTags()
Get all the concept name tags defined in the database, included voided ones
|
List<ConceptProposal> |
getAllConceptProposals(boolean includeCompleted)
Get a List of all concept proposals
|
List<ConceptReferenceTerm> |
getAllConceptReferenceTerms()
Gets a list of all concept reference terms saved in the database
|
List<Concept> |
getAllConcepts()
Return a list of unretired concepts sorted by concept id ascending and
|
List<Concept> |
getAllConcepts(String sortBy,
boolean asc,
boolean includeRetired)
Return a list of concepts sorted on sortBy in dir direction (asc/desc)
|
List<ConceptSource> |
getAllConceptSources(boolean includeRetired)
Return a list of concept sources currently in the database Whether or not to return retired
concept sources is decided by the boolean includeRetired param
|
List<ConceptStopWord> |
getAllConceptStopWords()
Get all the concept stop words
|
List<Drug> |
getAllDrugs()
Return a list of drugs currently in the database that are not retired
|
List<Drug> |
getAllDrugs(boolean includeRetired)
Get drugs by concept.
|
Concept |
getConcept(Integer conceptId)
Gets the concept with the given id
|
Concept |
getConcept(String conceptIdOrName)
Get Concept by id or name convenience method
|
ConceptAnswer |
getConceptAnswer(Integer conceptAnswerId)
Gets the ConceptAnswer with the given id
|
ConceptAnswer |
getConceptAnswerByUuid(String uuid)
Get ConceptAnswer by its UUID
|
ConceptAttribute |
getConceptAttributeByUuid(String uuid) |
ConceptAttributeType |
getConceptAttributeType(Integer id) |
ConceptAttributeType |
getConceptAttributeTypeByName(String exactName)
Retrieves a ConceptAttributeType object based on the name provided
|
ConceptAttributeType |
getConceptAttributeTypeByUuid(String uuid) |
List<ConceptAttributeType> |
getConceptAttributeTypes(String name)
Find concept attribute types matching the given parameters.
|
Concept |
getConceptByMapping(String code,
String sourceName)
Looks up a concept via
ConceptMap This will return the Concept which contains
a ConceptMap entry whose sourceCode is equal to the passed
conceptCode and whose ConceptSource has either a name or
hl7Code that is equal to the passed mappingCode . |
Concept |
getConceptByMapping(String code,
String sourceName,
Boolean includeRetired)
Looks up a concept via
ConceptMap This will return the Concept which contains
a ConceptMap entry whose sourceCode is equal to the passed
conceptCode and whose ConceptSource has either a name or
hl7Code that is equal to the passed mappingCode . |
Concept |
getConceptByName(String name)
Return a Concept that matches the name exactly
|
Concept |
getConceptByReference(String conceptRef)
Get the concept by conceptRef where the conceptRef can either be: 1) an integer id like 5090
2) a mapping type id like "XYZ:HT" 3) a uuid like "a3e12268-74bf-11df-9768-17cfc9833272" 4) a
name like "PLATELETS" 5) the fully qualified name of a Java constant which contains one of the above
|
Concept |
getConceptByUuid(String uuid)
Get Concept by its UUID
|
ConceptClass |
getConceptClass(Integer conceptClassId)
Return a Concept class matching the given identifier
|
ConceptClass |
getConceptClassByName(String name)
Return a Concept class matching the given name
|
ConceptClass |
getConceptClassByUuid(String uuid)
Get ConceptClass by its UUID
|
ConceptComplex |
getConceptComplex(Integer conceptId)
Get a ComplexConcept with the given conceptId
|
ConceptDatatype |
getConceptDatatype(Integer i)
Return a ConceptDatatype matching the given identifier
|
ConceptDatatype |
getConceptDatatypeByName(String name)
Return a Concept datatype matching the given name
|
ConceptDatatype |
getConceptDatatypeByUuid(String uuid)
Get ConceptDatatype by its UUID
|
ConceptDescription |
getConceptDescriptionByUuid(String uuid)
Get ConceptDescription by its UUID
|
List<Integer> |
getConceptIdsByMapping(String code,
String sourceName,
boolean includeRetired)
Looks up concepts via
ConceptMap This will return the list of ids for all
Concept s which contain a ConceptMap entry whose sourceCode is
equal to the passed conceptCode and whose ConceptSource has either a
name or hl7Code that is equal to the passed
mappingCode |
List<ConceptMap> |
getConceptMappingsToSource(ConceptSource conceptSource)
Returns a list of mappings from concepts to terms in the given reference terminology
|
ConceptMapType |
getConceptMapType(Integer conceptMapTypeId)
Return a concept map type matching the given concept map type id
|
ConceptMapType |
getConceptMapTypeByName(String name)
Return a concept map type matching the given name
|
ConceptMapType |
getConceptMapTypeByUuid(String uuid)
Return a concept map type matching the given uuid
|
List<ConceptMapType> |
getConceptMapTypes(boolean includeRetired,
boolean includeHidden)
Returns a list of concept map types currently in the database including or excluding retired
and hidden ones as specified by the includeRetired and includeHidden arguments
|
ConceptName |
getConceptName(Integer conceptNameId)
Gets the concept-name with the given id
|
ConceptName |
getConceptNameByUuid(String uuid)
Get ConceptName by its UUID
|
ConceptNameTag |
getConceptNameTag(Integer id)
Gets the
ConceptNameTag with the given database primary key |
ConceptNameTag |
getConceptNameTagByName(String tag)
Search for a ConceptNameTag by name
|
ConceptNameTag |
getConceptNameTagByUuid(String uuid)
Get ConceptNameTag by its UUID
|
ConceptNumeric |
getConceptNumeric(Integer conceptId)
Get the ConceptNumeric with the given id
|
ConceptNumeric |
getConceptNumericByUuid(String uuid)
Get ConceptNumeric by its UUID
|
ConceptProposal |
getConceptProposal(Integer conceptProposalId)
Get a ConceptProposal by conceptProposalId
|
ConceptProposal |
getConceptProposalByUuid(String uuid)
Get ConceptProposal by its UUID
|
List<ConceptProposal> |
getConceptProposals(String text)
Find matching concept proposals
|
ConceptReferenceTerm |
getConceptReferenceTerm(Integer conceptReferenceTermId)
Gets the concept reference term with the specified concept reference term id
|
ConceptReferenceTerm |
getConceptReferenceTermByCode(String code,
ConceptSource conceptSource)
Gets a concept reference term with the specified code from the specified concept source
|
List<ConceptReferenceTerm> |
getConceptReferenceTermByCode(String code,
ConceptSource conceptSource,
boolean includeRetired)
Gets a list of concept reference terms with the specified code from the specified concept source
|
ConceptReferenceTerm |
getConceptReferenceTermByName(String name,
ConceptSource conceptSource)
Gets a concept reference term with the specified name from the specified concept source
ignoring all retired ones
|
ConceptReferenceTerm |
getConceptReferenceTermByUuid(String uuid)
Gets the concept reference term with the specified uuid
|
List<ConceptReferenceTerm> |
getConceptReferenceTerms(boolean includeRetired)
Gets a list of concept reference terms saved in the database
|
List<ConceptReferenceTerm> |
getConceptReferenceTerms(String query,
ConceptSource conceptSource,
Integer start,
Integer length,
boolean includeRetired)
Finds the concept reference term in the database that have a code or name that contains the
specified search phrase.
|
List<ConceptSearchResult> |
getConcepts(String phrase,
List<Locale> locales,
boolean includeRetired,
List<ConceptClass> requireClasses,
List<ConceptClass> excludeClasses,
List<ConceptDatatype> requireDatatypes,
List<ConceptDatatype> excludeDatatypes,
Concept answersToConcept,
Integer start,
Integer size)
Searches for concepts by the given parameters.
|
List<ConceptSearchResult> |
getConcepts(String phrase,
Locale locale,
boolean includeRetired)
Searches for concepts with the given parameters
|
List<Concept> |
getConceptsByAnswer(Concept concept)
Returns all possible Concepts to which this concept is a value-coded answer.
|
List<Concept> |
getConceptsByClass(ConceptClass cc) |
List<Concept> |
getConceptsByConceptSet(Concept concept)
Return a List of all concepts within a concept set
|
List<Concept> |
getConceptsByMapping(String code,
String sourceName)
Looks up a concept via
ConceptMap This will return the list of concepts
Concept s which contain a ConceptMap entry whose sourceCode is
equal to the passed conceptCode and whose ConceptSource has either a
name or hl7Code that is equal to the passed
mappingCode |
List<Concept> |
getConceptsByMapping(String code,
String sourceName,
boolean includeRetired)
Looks up a concept via
ConceptMap This will return the list of Concept s which
contain a ConceptMap entry whose sourceCode is equal to the passed
conceptCode and whose ConceptSource has either a name or
hl7Code that is equal to the passed mappingCode . |
List<Concept> |
getConceptsByName(String name)
Returns a list of concepts matching any part of a concept name, this method is case
insensitive to the concept name string
|
List<Concept> |
getConceptsByName(String name,
Locale locale,
Boolean exactLocale)
Returns a list of concepts with the same name in the given locale.
|
ConceptSet |
getConceptSetByUuid(String uuid)
Get ConceptSet by its UUID
|
List<ConceptSet> |
getConceptSetsByConcept(Concept concept)
Return a list of the concept sets with concept_set matching concept
For example to find all concepts for ARVs, you would do
getConceptSets(getConcept("ANTIRETROVIRAL MEDICATIONS")) and then take the conceptIds from
the resulting list.
|
ConceptSource |
getConceptSource(Integer i)
Return a Concept source matching the given concept source id
|
ConceptSource |
getConceptSourceByHL7Code(String hl7Code)
Get a ConceptSource by its hl7Code.
|
ConceptSource |
getConceptSourceByName(String conceptSourceName)
Lookup a ConceptSource by its name property
|
ConceptSource |
getConceptSourceByUniqueId(String uniqueId)
Get a ConceptSource by its unique id.
|
ConceptSource |
getConceptSourceByUuid(String uuid)
Get ConceptSource by its UUID
|
List<String> |
getConceptStopWords(Locale locale)
Gets the list of
ConceptStopWord for given locale |
List<Concept> |
getConceptsWithDrugsInFormulary()
Convenience method for finding concepts associated with drugs in formulary.
|
Integer |
getCountOfConceptReferenceTerms(String query,
ConceptSource conceptSource,
boolean includeRetired)
Returns the count of concept reference terms that match the specified arguments
|
Integer |
getCountOfConcepts(String phrase,
List<Locale> locales,
boolean includeRetired,
List<ConceptClass> requireClasses,
List<ConceptClass> excludeClasses,
List<ConceptDatatype> requireDatatypes,
List<ConceptDatatype> excludeDatatypes,
Concept answersToConcept)
Return the number of concepts matching a search phrase and the specified arguments
|
Integer |
getCountOfDrugs(String drugName,
Concept concept,
boolean searchOnPhrase,
boolean searchDrugConceptNames,
boolean includeRetired)
Return the number of drugs with matching names or concept drug names
|
ConceptMapType |
getDefaultConceptMapType()
Gets the concept map type to be used as the default.
|
Drug |
getDrug(Integer drugId)
Get the Drug with the given id
|
Drug |
getDrug(String drugNameOrId)
Return the drug object corresponding to the given name or drugId
|
Drug |
getDrugByMapping(String code,
ConceptSource conceptSource,
Collection<ConceptMapType> withAnyOfTheseTypesOrOrderOfPreference)
Gets the "best" matching drug, i.e. matching the earliest ConceptMapType passed in e.g.
|
Drug |
getDrugByUuid(String uuid)
Get Drug by its UUID
|
DrugIngredient |
getDrugIngredientByUuid(String uuid)
Get Drug Ingredient by its UUID
|
List<Drug> |
getDrugs(String phrase)
Find drugs in the system.
|
List<Drug> |
getDrugs(String drugName,
Concept concept,
boolean searchKeywords,
boolean searchDrugConceptNames,
boolean includeRetired,
Integer start,
Integer length)
Returns a list of drugs with matching names or concept drug names and returns a specific
number of them from the specified starting position.
|
List<Drug> |
getDrugs(String searchPhrase,
Locale locale,
boolean exactLocale,
boolean includeRetired)
Fetches un retired drugs that match the specified search phrase.
|
List<Drug> |
getDrugsByConcept(Concept concept)
Return a list of drugs associated with the given concept
|
List<Drug> |
getDrugsByIngredient(Concept ingredient)
Gets drugs by the given ingredient, which can be either the drug itself or any ingredient.
|
List<Drug> |
getDrugsByMapping(String code,
ConceptSource conceptSource,
Collection<ConceptMapType> withAnyOfTheseTypes,
boolean includeRetired)
Fetches all drugs with reference mappings to the specified concept source that match the
specified code and concept map types
|
Concept |
getFalseConcept()
Returns the FALSE concept
|
Set<Locale> |
getLocalesOfConceptNames()
Gets the set of unique Locales used by existing concept names.
|
Integer |
getMaxConceptId()
Gets the highest concept-id used by a concept.
|
Concept |
getNextConcept(Concept concept)
Finds the next concept in the dictionary that has the next largest concept id
|
List<ConceptSearchResult> |
getOrderableConcepts(String phrase,
List<Locale> locales,
boolean includeRetired,
Integer start,
Integer length)
An Orderable concept is one where its conceptClass has a mapping in the order_type_class_map
table.
|
Concept |
getPrevConcept(Concept concept)
Finds the previous concept in the dictionary that has the next lowest concept id
|
List<Concept> |
getProposedConcepts(String text)
Find matching proposed concepts
|
List<ConceptReferenceTermMap> |
getReferenceTermMappingsTo(ConceptReferenceTerm term)
Fetches all the
ConceptReferenceTermMap where the specified reference term is the
termB i.e mappings added to other terms pointing to it |
List<ConceptSet> |
getSetsContainingConcept(Concept concept)
Find all sets that the given concept is a member of
|
Concept |
getTrueConcept()
Returns the TRUE concept
|
Concept |
getUnknownConcept()
Returns the UNKNOWN concept
|
boolean |
hasAnyConceptAttribute(ConceptAttributeType conceptAttributeType) |
boolean |
hasAnyObservation(Concept concept)
Checks if there are any observations (including voided observations) for a concept.
|
boolean |
hasAnyObservation(ConceptName conceptName)
Checks if there are any observations (including voided observations) using a conceptName.
|
boolean |
isConceptNameDuplicate(ConceptName name)
Determines if the given concept name is a duplicate.
|
Concept |
mapConceptProposalToConcept(ConceptProposal cp,
Concept mappedConcept)
Maps a concept proposal to a concept
|
Concept |
mapConceptProposalToConcept(ConceptProposal cp,
Concept mappedConcept,
Locale locale)
Maps a concept proposal to a concept
|
void |
purgeConcept(Concept conceptOrConceptNumeric)
Completely purge a
Concept or ConceptNumeric from the database. |
void |
purgeConceptAttributeType(ConceptAttributeType conceptAttributeType)
Completely removes a concept attribute type from the database
|
void |
purgeConceptClass(ConceptClass cc)
Purge a ConceptClass
|
void |
purgeConceptMapType(ConceptMapType conceptMapType)
Completely purges a concept map type from the database
|
void |
purgeConceptNameTag(ConceptNameTag cnt)
Purge a ConceptNameTag
|
void |
purgeConceptProposal(ConceptProposal cp)
Removes a concept proposal from the database entirely.
|
void |
purgeConceptReferenceTerm(ConceptReferenceTerm conceptReferenceTerm)
Purges the specified concept reference term from the database
|
ConceptSource |
purgeConceptSource(ConceptSource cs)
Delete ConceptSource
|
void |
purgeDrug(Drug drug)
Completely purge a Drug from the database.
|
Concept |
retireConcept(Concept conceptOrConceptNumeric,
String reason)
Retiring a concept essentially removes it from circulation
|
ConceptAttributeType |
retireConceptAttributeType(ConceptAttributeType conceptAttributeType,
String reason)
Retire a concept attribute type
|
ConceptMapType |
retireConceptMapType(ConceptMapType conceptMapType,
String retireReason)
Retiring a concept map type essentially removes it from circulation
|
ConceptReferenceTerm |
retireConceptReferenceTerm(ConceptReferenceTerm conceptReferenceTerm,
String retireReason)
Retiring a concept reference term essentially removes it from circulation
|
ConceptSource |
retireConceptSource(ConceptSource cs,
String reason)
This effectively removes a concept source from the database.
|
Drug |
retireDrug(Drug drug,
String reason)
Retiring a Drug essentially removes it from circulation
|
Concept |
saveConcept(Concept concept)
Save or update the given
Concept or ConceptNumeric in the database
If this is a new concept, the returned concept will have a new Concept.getConceptId()
inserted into it that was generated by the database |
ConceptAttributeType |
saveConceptAttributeType(ConceptAttributeType conceptAttributeType)
Creates or updates the given concept attribute type in the database
|
ConceptClass |
saveConceptClass(ConceptClass cc)
Creates or updates a concept class
|
ConceptMapType |
saveConceptMapType(ConceptMapType conceptMapType)
Saves or updates the specified concept map type in the database
|
ConceptNameTag |
saveConceptNameTag(ConceptNameTag nameTag)
Creates a new Concept name tag if none exists.
|
ConceptProposal |
saveConceptProposal(ConceptProposal conceptProposal)
Saves/updates/proposes a concept proposal
|
ConceptReferenceTerm |
saveConceptReferenceTerm(ConceptReferenceTerm conceptReferenceTerm)
Stores the specified concept reference term to the database
|
ConceptSource |
saveConceptSource(ConceptSource conceptSource)
Create a new ConceptSource
|
ConceptStopWord |
saveConceptStopWord(ConceptStopWord conceptStopWord)
Save the given
ConceptStopWord in the database
If this is a new concept stop word, the returned concept stop word will have a new
ConceptStopWord.getConceptStopWordId() inserted into it that was
generated by the database
|
Drug |
saveDrug(Drug drug)
Save or update the given
Drug in the database. |
void |
setConceptDAO(ConceptDAO dao)
Sets the data access object for Concepts.
|
ConceptAttributeType |
unretireConceptAttributeType(ConceptAttributeType conceptAttributeType)
Un-Retire a concept attribute type
|
ConceptMapType |
unretireConceptMapType(ConceptMapType conceptMapType)
Marks a concept map type that is currently retired as not retired.
|
ConceptReferenceTerm |
unretireConceptReferenceTerm(ConceptReferenceTerm conceptReferenceTerm)
Marks a concept reference term that is currently retired as not retired.
|
Drug |
unretireDrug(Drug drug)
Marks a drug that is currently retired as not retired.
|
void |
updateConceptIndex(Concept concept)
Iterates over the words in names and synonyms (for each locale) and updates the concept
index, note that this only updates the index of the specified concept.
|
void |
updateConceptIndexes()
Iterates over all concepts and calls updateConceptIndexes(Concept concept)
|
onShutdown, onStartup
void setConceptDAO(ConceptDAO dao)
dao
- The data access object to use@Authorized(value="Get Concepts") Concept getConceptByUuid(String uuid)
uuid
- @Authorized(value="Manage Concepts") Concept saveConcept(Concept concept) throws APIException
Concept
or ConceptNumeric
in the database
If this is a new concept, the returned concept will have a new Concept.getConceptId()
inserted into it that was generated by the database
concept
- The Concept
or ConceptNumeric
to save or updateConcept
or ConceptNumeric
that was saved or updatedAPIException
ConceptsLockedException
ConceptInUseException
- Should put generated concept id onto returned concept
Should create new concept in database
Should update concept already existing in database
Should generate id for new concept if none is specified
Should keep id for new concept if one is specified
Should save non ConceptNumeric object as conceptNumeric
Should save non ConceptComplex object as conceptComplex
Should save changes between concept numeric and complex
Should save a ConceptNumeric as a concept
Should save a new ConceptNumeric
Should void the conceptName if the text of the name has changed
Should create a new conceptName when the old name is changed
Should set a preferred name for each locale if none is marked
Should not fail when a duplicate name is edited to a unique value
Should create a reference term for a concept mapping on the fly when editing a concept
Should create a reference term for a concept mapping on the fly when creating a concept
Should add new concept name
Should not set audit info if the concept is not edited
Should set audit info if an item is removed from any of its child collections
Should set audit info if any item in the child collections is edited
Should set audit info if an item is added to any of its child collections
Should pass when saving a concept after removing a name
Should save a conceptNumeric with allowDecimal value@Authorized(value="Manage Concepts") Drug saveDrug(Drug drug) throws APIException
Drug
in the database. If this is a new drug, the
returned drug object will have a new Drug.getDrugId()
inserted into it that was
generated by the databasedrug
- The Drug to save or updateAPIException
- Should put generated drug id onto returned drug
Should create new drug in database
Should update drug already existing in database@Authorized(value="Purge Concepts") void purgeConcept(Concept conceptOrConceptNumeric) throws APIException
Concept
or ConceptNumeric
from the database.
This should not typically be used unless desperately needed. Most should just be retired. See
retireConcept(Concept, String)
conceptOrConceptNumeric
- The Concept
or ConceptNumeric
to
remove from the systemAPIException
- Should purge the concept if not being used by an obs
Should fail if any of the conceptNames of the concept is being used by an obs@Authorized(value="Manage Concepts") Concept retireConcept(Concept conceptOrConceptNumeric, String reason) throws APIException
conceptOrConceptNumeric
- The Concept
or ConceptNumeric
to
retirereason
- The retire reasonConcept
or ConceptNumeric
APIException
- Should fail if no reason is given
Should retire the given concept@Authorized(value="Manage Concepts") Drug retireDrug(Drug drug, String reason) throws APIException
drug
- The Drug to retirereason
- The retire reasonAPIException
@Authorized(value="Manage Concepts") Drug unretireDrug(Drug drug) throws APIException
drug
- that is current set as retiredAPIException
- Should mark drug as not retired
Should not change attributes of drug that is already not retired@Authorized(value="Purge Concepts") void purgeDrug(Drug drug) throws APIException
drug
- The Drug to remove from the systemAPIException
- Should purge the given drug@Authorized(value="Get Concepts") Concept getConcept(Integer conceptId) throws APIException
conceptId
- APIException
@Authorized(value="Get Concepts") ConceptName getConceptName(Integer conceptNameId) throws APIException
conceptNameId
- APIException
@Authorized(value="Get Concepts") ConceptAnswer getConceptAnswer(Integer conceptAnswerId) throws APIException
conceptAnswerId
- APIException
@Authorized(value="Get Concepts") Drug getDrug(Integer drugId) throws APIException
drugId
- APIException
@Authorized(value="Get Concepts") ConceptNumeric getConceptNumeric(Integer conceptId) throws APIException
conceptId
- The ConceptNumeric idAPIException
@Authorized(value="Get Concepts") ConceptClass getConceptClass(Integer conceptClassId) throws APIException
conceptClassId
- the concept class identifierAPIException
@Authorized(value="Get Concepts") List<Concept> getAllConcepts() throws APIException
APIException
@Authorized(value="Get Concepts") List<Concept> getAllConcepts(String sortBy, boolean asc, boolean includeRetired) throws APIException
sortBy
- The property name to sort by; if null or invalid, concept_id is used.asc
- true = sort ascending; false = sort descendingincludeRetired
- If true
, retired concepts will also be returnedAPIException
- Should order by concept id and include retired when given no parameters
Should order by concept id descending when set asc parameter to false
Should exclude retired concepts when set includeRetired to false
Should order by a concept name field
Should order by a concept field@Authorized(value="Get Concepts") List<Concept> getConceptsByName(String name) throws APIException
name
- The search stringAPIException
@Authorized(value="Get Concepts") Concept getConceptByName(String name) throws APIException
name
- The search stringAPIException
@Authorized(value="Get Concepts") Concept getConcept(String conceptIdOrName) throws APIException
conceptIdOrName
- APIException
- Should return null given null parameter@Authorized(value="Get Concepts") Concept getConceptByReference(String conceptRef)
conceptRef
- the concept string identifier@Authorized(value="Get Concepts") Drug getDrugByUuid(String uuid)
uuid
- @Authorized(value="Get Concepts") DrugIngredient getDrugIngredientByUuid(String uuid)
uuid
- the uuid for the drug ingredient to get@Authorized(value="Get Concepts") Drug getDrug(String drugNameOrId) throws APIException
drugNameOrId
- String name or drugId to match exactly onAPIException
- Should return the matching drug object
Should return null if no matching drug is found@Authorized(value="Get Concepts") List<Drug> getAllDrugs() throws APIException
APIException
@Authorized(value="Get Concepts") List<Drug> getDrugsByConcept(Concept concept) throws APIException
concept
- APIException
@Authorized(value="Get Concepts") List<Drug> getAllDrugs(boolean includeRetired)
includeRetired
- If true
then the search will include voided Drugs@Authorized(value="Get Concepts") List<Drug> getDrugs(String phrase) throws APIException
phrase
- Search phraseAPIException
@Authorized(value="Get Concepts") List<Concept> getConceptsByClass(ConceptClass cc) throws APIException
cc
- ConceptClassAPIException
- Should not fail due to no name in search@Authorized(value="Get Concept Classes") ConceptClass getConceptClassByName(String name) throws APIException
name
- APIException
@Authorized(value="Get Concept Classes") List<ConceptClass> getAllConceptClasses() throws APIException
APIException
@Authorized(value="Get Concept Classes") List<ConceptClass> getAllConceptClasses(boolean includeRetired) throws APIException
includeRetired
- include retired concept classes in the search results?APIException
@Authorized(value="Get Concept Classes") ConceptClass getConceptClassByUuid(String uuid)
uuid
- @Authorized(value="Get Concepts") ConceptAnswer getConceptAnswerByUuid(String uuid)
uuid
- @Authorized(value="Get Concepts") ConceptName getConceptNameByUuid(String uuid)
uuid
- @Authorized(value="Get Concepts") ConceptSet getConceptSetByUuid(String uuid)
uuid
- @Authorized(value="Get Concept Sources") ConceptSource getConceptSourceByUuid(String uuid)
uuid
- @Authorized(value="Manage Concept Classes") ConceptClass saveConceptClass(ConceptClass cc) throws APIException
cc
- ConceptClass to create or updateAPIException
- Should save the the given ConceptClass@Authorized(value="Purge Concept Classes") void purgeConceptClass(ConceptClass cc) throws APIException
cc
- ConceptClass to deleteAPIException
- Should delete the given ConceptClass@Authorized(value="Manage Concept Name tags") void purgeConceptNameTag(ConceptNameTag cnt) throws APIException
cnt
- ConceptNameTag to deleteAPIException
@Authorized(value="Get Concept Datatypes") List<ConceptDatatype> getAllConceptDatatypes() throws APIException
APIException
@Authorized(value="Get Concept Datatypes") List<ConceptDatatype> getAllConceptDatatypes(boolean includeRetired) throws APIException
includeRetired
- boolean - include the retired datatypes?APIException
@Authorized(value="Get Concept Datatypes") ConceptDatatype getConceptDatatype(Integer i) throws APIException
i
- Integer for the requested ConceptDatatypeAPIException
@Authorized(value="Get Concept Datatypes") ConceptDatatype getConceptDatatypeByUuid(String uuid)
uuid
- @Authorized(value="Get Concept Datatypes") ConceptDatatype getConceptDatatypeByName(String name) throws APIException
name
- APIException
- Should return an exact match on name
Should not return a fuzzy match on name@Authorized(value="Get Concepts") List<ConceptSet> getConceptSetsByConcept(Concept concept) throws APIException
For example to find all concepts for ARVs, you would do getConceptSets(getConcept("ANTIRETROVIRAL MEDICATIONS")) and then take the conceptIds from the resulting list.
concept
- The concept representing the concept setAPIException
@Authorized(value="Get Concepts") List<Concept> getConceptsByConceptSet(Concept concept) throws APIException
concept
- The concept representing the concept setAPIException
@Authorized(value="Get Concepts") List<ConceptSet> getSetsContainingConcept(Concept concept) throws APIException
concept
- APIException
@Authorized(value="Get Concept Proposals") List<ConceptProposal> getAllConceptProposals(boolean includeCompleted) throws APIException
includeCompleted
- boolean - include completed proposals as well?APIException
- Should return all concept proposals including retired ones when given true
Should return all concept proposals excluding retired ones when given false@Authorized(value="Get Concepts") ConceptNumeric getConceptNumericByUuid(String uuid)
uuid
- @Authorized(value="Get Concept Proposals") ConceptProposal getConceptProposal(Integer conceptProposalId) throws APIException
conceptProposalId
- the Integer concept proposal IdAPIException
@Authorized(value="Get Concept Proposals") List<ConceptProposal> getConceptProposals(String text) throws APIException
text
- APIException
@Authorized(value="Get Concept Proposals") List<Concept> getProposedConcepts(String text) throws APIException
text
- APIException
@Authorized(value={"Add Concept Proposals","Edit Concept Proposals"}) ConceptProposal saveConceptProposal(ConceptProposal conceptProposal) throws APIException
conceptProposal
- The ConceptProposal to saveAPIException
@Authorized(value="Purge Concept Proposals") void purgeConceptProposal(ConceptProposal cp) throws APIException
cp
- APIException
- Should purge the given concept proposal@Authorized(value="Manage Concepts") Concept mapConceptProposalToConcept(ConceptProposal cp, Concept mappedConcept) throws APIException
cp
- mappedConcept
- APIException
- Should not require mapped concept on reject action
Should allow rejecting proposals
Should throw APIException when mapping to null concept@Authorized(value="Manage Concepts") Concept mapConceptProposalToConcept(ConceptProposal cp, Concept mappedConcept, Locale locale) throws APIException
cp
- mappedConcept
- locale
- of concept proposalAPIException
- Should not require mapped concept on reject action
Should allow rejecting proposals
Should throw APIException when mapping to null concept
Should set value coded name when add synonym is selected
Should not set value coded name when add concept is selected
Should fail when adding a duplicate synonym@Authorized(value="Get Concepts") List<Concept> getConceptsByAnswer(Concept concept) throws APIException
concept
- APIException
- Should return an empty list if concept id is null@Authorized(value="Get Concepts") Concept getPrevConcept(Concept concept) throws APIException
concept
- the offset ConceptAPIException
- Should return the concept previous to the given concept@Authorized(value="Get Concepts") Concept getNextConcept(Concept concept) throws APIException
concept
- the offset ConceptAPIException
- Should return the concept next to the given concept@Authorized(value="Get Concepts") void checkIfLocked() throws ConceptsLockedException
ConceptsLockedException
@Authorized(value="Get Concept Proposals") ConceptProposal getConceptProposalByUuid(String uuid)
uuid
- @Authorized(value="Get Concepts") List<Concept> getConceptsWithDrugsInFormulary() throws APIException
APIException
- Should give a list of all matching concepts@Authorized(value="Get Concepts") ConceptNameTag getConceptNameTagByUuid(String uuid)
uuid
- Concept.setPreferredName(ConceptName)
,
Concept.setFullySpecifiedName(ConceptName)
,
Should find object given valid uuid
Should return null if no object found with given uuid
@Authorized(value="Get Concepts") ConceptComplex getConceptComplex(Integer conceptId)
conceptId
- of the ComplexConcept@Authorized(value="Get Concepts") ConceptNameTag getConceptNameTagByName(String tag)
tag
- String name of ConceptNameTagConcept.getPreferredName(Locale)
,
Concept.getFullySpecifiedName(Locale)
,
Concept.getShortNameInLocale(Locale)
,
Concept.getShortestName(Locale, Boolean)
@Authorized(value="Get Concepts") Set<Locale> getLocalesOfConceptNames()
@Authorized(value="Get Concept Sources") List<ConceptSource> getAllConceptSources(boolean includeRetired) throws APIException
includeRetired
- whether or not to include retired sourcesAPIException
@Authorized(value="Get Concept Sources") ConceptSource getConceptSource(Integer i) throws APIException
i
- Integer conceptSourceIdAPIException
@Authorized(value="Manage Concept Sources") ConceptSource saveConceptSource(ConceptSource conceptSource) throws APIException
conceptSource
- ConceptSource to createAPIException
- Should not set creator if one is supplied already
Should not set date created if one is supplied already
Should save a ConceptSource with a null hl7Code
Should not save a ConceptSource if voided is null@Authorized(value="Purge Concept Sources") ConceptSource purgeConceptSource(ConceptSource cs) throws APIException
cs
- ConceptSource object deleteAPIException
- Should purge the given concept source@Authorized(value="Purge Concept Sources") ConceptSource retireConceptSource(ConceptSource cs, String reason) throws APIException
cs
- the concept source to retirereason
- why the concept source is to be retired, must not be empty of nullAPIException
- Should retire concept source@Authorized(value="Manage Concept Name tags") ConceptNameTag saveConceptNameTag(ConceptNameTag nameTag)
nameTag
- the concept name tag to be saved@Authorized(value="Get Concepts") Integer getMaxConceptId()
@Authorized(value="Get Concepts") Iterator<Concept> conceptIterator()
@Authorized(value="Get Concepts") Concept getConceptByMapping(String code, String sourceName) throws APIException
ConceptMap
This will return the Concept
which contains
a ConceptMap
entry whose sourceCode
is equal to the passed
conceptCode
and whose ConceptSource
has either a name
or
hl7Code
that is equal to the passed mappingCode
. Delegates to
getConceptByMapping(code,sourceName,includeRetired) with includeRetired=truecode
- the code associated with a concept within a given ConceptSource
sourceName
- the name or hl7Code of the ConceptSource
to checkConcept
that has the given mapping, or null if no Concept
foundAPIException
- Should get concept with given code and and source hl7 code
Should get concept with given code and source name
Should return null if source code does not exist
Should return null if mapping does not exist@Authorized(value="Get Concepts") Concept getConceptByMapping(String code, String sourceName, Boolean includeRetired) throws APIException
ConceptMap
This will return the Concept
which contains
a ConceptMap
entry whose sourceCode
is equal to the passed
conceptCode
and whose ConceptSource
has either a name
or
hl7Code
that is equal to the passed mappingCode
. Operates under
the assumption that each mappingCode in a ConceptSource
references one and only one
non-retired Concept
: if the underlying dao method returns more than one non-retired
concept, this method will throw an exception; if the underlying dao method returns more than
one concept, but only one non-retired concept, this method will return the non-retired
concept; if the dao only returns retired concepts, this method will simply return the first
concept in the list returns by the dao method; retired concepts can be excluded by setting
the includeRetired parameter to false, but the above logic still appliescode
- the code associated with a concept within a given ConceptSource
sourceName
- the name or hl7Code of the ConceptSource
to checkincludeRetired
- whether or not to include retired conceptsConcept
that has the given mapping, or null if no Concept
foundAPIException
- Should get concept with given code and and source hl7 code
Should get concept with given code and source name
Should return null if source code does not exist
Should return null if mapping does not exist@Authorized(value="Get Concepts") List<Concept> getConceptsByMapping(String code, String sourceName) throws APIException
ConceptMap
This will return the list of concepts
Concept
s which contain a ConceptMap
entry whose sourceCode
is
equal to the passed conceptCode
and whose ConceptSource
has either a
name
or hl7Code
that is equal to the passed
mappingCode
code
- the code associated with a concept within a given ConceptSource
sourceName
- the name or hl7Code of the ConceptSource
to checkConcept
s that has the given mapping, or null if no
Concept
foundAPIException
- if the specified source+code maps to more than one concept
Should get concepts with given code and and source hl7 code
Should get concepts with given code and source name
Should return empty list if source code does not exist
Should return empty list if mapping does not exist
Should include retired concepts@Authorized(value="Get Concepts") List<Concept> getConceptsByMapping(String code, String sourceName, boolean includeRetired) throws APIException
ConceptMap
This will return the list of Concept
s which
contain a ConceptMap
entry whose sourceCode
is equal to the passed
conceptCode
and whose ConceptSource
has either a name
or
hl7Code
that is equal to the passed mappingCode
. Delegates to
getConceptsByMapping(code,sourceName,includeRetired) with includeRetired=truecode
- the code associated with a concept within a given ConceptSource
sourceName
- the name or hl7Code of the ConceptSource
to checkincludeRetired
- whether or not to include retired conceptsConcept
s that has the given mapping, or null if no
Concept
foundAPIException
- if the specified source+code maps to more than one concept
Should get concepts with given code and and source hl7 code
Should get concepts with given code and source name
Should return empty list if source code does not exist
Should return empty list if mapping does not exist@Authorized(value="Get Concepts") List<Integer> getConceptIdsByMapping(String code, String sourceName, boolean includeRetired) throws APIException
ConceptMap
This will return the list of ids for all
Concept
s which contain a ConceptMap
entry whose sourceCode
is
equal to the passed conceptCode
and whose ConceptSource
has either a
name
or hl7Code
that is equal to the passed
mappingCode
code
- the code associated with a concept within a given ConceptSource
sourceName
- the name or hl7Code of the ConceptSource
to checkincludeRetired
- whether or not to include retired conceptsConcept
s that have the given mapping, or an empty List if none foundAPIException
- if the specified source+code maps to more than one concept@Authorized(value="Get Concepts") List<ConceptNameTag> getAllConceptNameTags()
@Authorized(value="Get Concepts") ConceptNameTag getConceptNameTag(Integer id)
ConceptNameTag
with the given database primary keyid
- the concept name tag id to findConceptNameTag
or null if none found@Authorized(value="Get Concepts") ConceptDescription getConceptDescriptionByUuid(String uuid)
uuid
- @Authorized(value="Get Concept Sources") ConceptSource getConceptSourceByName(String conceptSourceName) throws APIException
conceptSourceName
- APIException
- Should get ConceptSource with the given name
Should return null if no ConceptSource with that name is found@Authorized(value="Get Concept Sources") ConceptSource getConceptSourceByUniqueId(String uniqueId) throws APIException
uniqueId
- the unique idAPIException
- Should get concept source with the given unique id
Should return null if no concept source with given unique id is found
Should return null if given an empty string
Should fail if given null@Authorized(value="Get Concept Sources") ConceptSource getConceptSourceByHL7Code(String hl7Code) throws APIException
hl7Code
- the hl7CodeAPIException
- Should get concept source with the given hl7Code
Should return null if no concept source with given hl7Code is found
Should return null if given an empty string
Should fail if given null@Authorized(value="Get Concepts") boolean hasAnyObservation(Concept concept)
concept
- which used or not used by an observationAPIException
@Authorized(value="Get Concepts") Concept getTrueConcept()
@Authorized(value="Get Concepts") Concept getFalseConcept()
@Authorized(value="Get Concepts") Concept getUnknownConcept()
@Authorized(value="Manage Concepts") void convertBooleanConceptToCoded(Concept conceptToChange) throws APIException
conceptToChange
- the concept which to changeAPIException
- Should convert the datatype of a boolean concept to coded
Should fail if the datatype of the concept is not boolean
Should explicitly add true concept as a value_Coded answer
Should explicitly add false concept as a value_Coded answer@Authorized(value="Get Concepts") boolean hasAnyObservation(ConceptName conceptName) throws APIException
conceptName
- which is used or not used by an observationAPIException
@Authorized(value="Get Concepts") List<ConceptSearchResult> getConcepts(String phrase, List<Locale> locales, boolean includeRetired, List<ConceptClass> requireClasses, List<ConceptClass> excludeClasses, List<ConceptDatatype> requireDatatypes, List<ConceptDatatype> excludeDatatypes, Concept answersToConcept, Integer start, Integer size) throws APIException
phrase
- matched to the start of any word in any of the names of a concept (if
blank/null, matches all concepts)locales
- List<Locale> to restrict toincludeRetired
- boolean if false, will exclude retired conceptsrequireClasses
- List<ConceptClass> to restrict toexcludeClasses
- List<ConceptClass> to leave out of resultsrequireDatatypes
- List<ConceptDatatype> to restrict toexcludeDatatypes
- List<ConceptDatatype> to leave out of resultsanswersToConcept
- all results will be a possible answer to this conceptstart
- all results less than this number will be removedsize
- if non zero, all results after start
+ size
will be
removedAPIException
- Should return concept search results that match unique concepts
Should return a search result whose concept name contains all word tokens as first
Should return a search result for phrase with stop words
Should not return concepts with matching names that are voided
Should return preferred names higher
Should find concept by full code@Authorized(value="Get Concepts") List<ConceptSearchResult> findConceptAnswers(String phrase, Locale locale, Concept concept) throws APIException
phrase
- locale
- concept
- the answers to match onAPIException
- Should return a list of all matching concept search results@Authorized(value="Manage Concepts") void updateConceptIndex(Concept concept) throws APIException
updateConceptIndexes()
if you wish to update the entire concept index.concept
- the concept whose index is to be updatedAPIException
@Authorized(value="Manage Concepts") void updateConceptIndexes() throws APIException
APIException
@Authorized(value="Get Concepts") List<ConceptSearchResult> getConcepts(String phrase, Locale locale, boolean includeRetired) throws APIException
phrase
- the string to search against (if blank/null, matches all concepts)locale
- the locale in which to search for the conceptsincludeRetired
- Specifies whether to include retired conceptsAPIException
- Should give a list of ConceptSearchResult for the matching Concepts@Authorized(value="Get Concepts") Integer getCountOfConcepts(String phrase, List<Locale> locales, boolean includeRetired, List<ConceptClass> requireClasses, List<ConceptClass> excludeClasses, List<ConceptDatatype> requireDatatypes, List<ConceptDatatype> excludeDatatypes, Concept answersToConcept)
phrase
- matched to the start of any word in any of the names of a conceptlocales
- List<Locale> to restrict toincludeRetired
- Specifies whether to include retired conceptsrequireClasses
- List<ConceptClass> to restrict toexcludeClasses
- List<ConceptClass> to leave out of resultsrequireDatatypes
- List<ConceptDatatype> to restrict toexcludeDatatypes
- List<ConceptDatatype> to leave out of resultsanswersToConcept
- all results will be a possible answer to this conceptAPIException
@Authorized(value="Get Concepts") Integer getCountOfDrugs(String drugName, Concept concept, boolean searchOnPhrase, boolean searchDrugConceptNames, boolean includeRetired) throws APIException
drugName
- the name of the drugconcept
- the drug conceptsearchOnPhrase
- Specifies if the search should match names starting with or contain the
textsearchDrugConceptNames
- Specifies whether a search on concept names for the drug's
concept should be done or notincludeRetired
- specifies whether to include retired drugsAPIException
- Should return the total number of matching drugs@Authorized(value="Get Concepts") List<Drug> getDrugs(String drugName, Concept concept, boolean searchKeywords, boolean searchDrugConceptNames, boolean includeRetired, Integer start, Integer length) throws APIException
drugName
- the name of the drugconcept
- the drug conceptsearchKeywords
- (since 1.11) Specifies whether the search should match keywords or just
phrasesearchDrugConceptNames
- Specifies whether a search on concept names for the drug's
concept should be done or notincludeRetired
- specifies whether to include retired drugsstart
- beginning index for the batchlength
- number of drugs to return in the batchAPIException
@Authorized(value="Get Concepts") List<String> getConceptStopWords(Locale locale)
ConceptStopWord
for given localelocale
- The locale in which to search for the ConceptStopWord
ConceptStopWord
if Locale is null@Authorized(value="Manage Concept Stop Words") ConceptStopWord saveConceptStopWord(ConceptStopWord conceptStopWord) throws APIException
ConceptStopWord
in the database
If this is a new concept stop word, the returned concept stop word will have a new
ConceptStopWord.getConceptStopWordId()
inserted into it that was
generated by the database
conceptStopWord
- The ConceptStopWord
to save or updateConceptStopWord
that was saved or updatedAPIException
- Should generated concept stop word id onto returned concept stop word
Should save concept stop word into database
Should assign default Locale
Should save concept stop word in uppercase
Should fail if a duplicate conceptStopWord in a locale is added@Authorized(value="Manage Concept Stop Words") void deleteConceptStopWord(Integer conceptStopWordId) throws APIException
ConceptStopWord
in the databaseconceptStopWordId
- The ConceptStopWord
to deleteAPIException
- Should delete the given concept stop word from the database@Authorized(value="Get Concepts") List<ConceptStopWord> getAllConceptStopWords()
ConceptStopWord
Should return all the concept stop words
Should return empty list if nothing found@Authorized(value="Get Concepts") List<Drug> getDrugsByIngredient(Concept ingredient)
@Authorized(value="Get Concept Map Types") List<ConceptMapType> getActiveConceptMapTypes() throws APIException
APIException
- Should return all the concept map types excluding hidden ones@Authorized(value="Get Concept Map Types") List<ConceptMapType> getConceptMapTypes(boolean includeRetired, boolean includeHidden) throws APIException
includeRetired
- specifies if retired concept map types should be includedAPIException
- Should return all the concept map types if includeRetired and hidden are set to true
Should return only un retired concept map types if includeRetired is set to false
Should not include hidden concept map types if includeHidden is set to false@Authorized(value="Get Concept Map Types") ConceptMapType getConceptMapType(Integer conceptMapTypeId) throws APIException
conceptMapTypeId
- Integer concept map type idAPIException
@Authorized(value="Get Concept Map Types") ConceptMapType getConceptMapTypeByUuid(String uuid) throws APIException
uuid
- the uuid to search againstAPIException
- Should return a conceptMapType matching the specified uuid@Authorized(value="Get Concept Map Types") ConceptMapType getConceptMapTypeByName(String name) throws APIException
name
- the name to search againstAPIException
- Should return a conceptMapType matching the specified name
Should be case insensitive@Authorized(value="Manage Concept Map Types") ConceptMapType saveConceptMapType(ConceptMapType conceptMapType) throws APIException
conceptMapType
- the concept map type to saveAPIException
- Should add the specified concept map type to the database and assign to it an id
Should update an existing concept map type@Authorized(value="Manage Concept Map Types") ConceptMapType retireConceptMapType(ConceptMapType conceptMapType, String retireReason) throws APIException
conceptMapType
- the concept map type to retireretireReason
- the reason why the concept map type is being retiredAPIException
- Should retire the specified conceptMapType with the given retire reason
Should should set the default retire reason if none is given@Authorized(value="Manage Concept Map Types") ConceptMapType unretireConceptMapType(ConceptMapType conceptMapType) throws APIException
conceptMapType
- the concept map type to unretireAPIException
- Should unretire the specified concept map type and drop all retire related fields@Authorized(value="Purge Concept Map Types") void purgeConceptMapType(ConceptMapType conceptMapType) throws APIException
conceptMapType
- the concept map type to purge from the databaseAPIException
- Should delete the specified conceptMapType from the database@Authorized(value="Get Concepts") List<ConceptMap> getConceptMappingsToSource(ConceptSource conceptSource) throws APIException
conceptSource
- APIException
- Should return a List of ConceptMaps from the given source@Authorized(value="Get Concept Reference Terms") List<ConceptReferenceTerm> getAllConceptReferenceTerms() throws APIException
APIException
- Should return all concept reference terms in the database@Authorized(value="Get Concept Reference Terms") List<ConceptReferenceTerm> getConceptReferenceTerms(boolean includeRetired) throws APIException
includeRetired
- specifies if retired concept reference terms should be includedAPIException
- Should return all the concept reference terms if includeRetired is set to true
Should return only un retired concept reference terms if includeRetired is set to false@Authorized(value="Get Concept Reference Terms") ConceptReferenceTerm getConceptReferenceTerm(Integer conceptReferenceTermId) throws APIException
conceptReferenceTermId
- the concept reference term id to search againstAPIException
@Authorized(value="Get Concept Reference Terms") ConceptReferenceTerm getConceptReferenceTermByUuid(String uuid) throws APIException
uuid
- the uuid to search againstAPIException
- Should return the concept reference term that matches the given uuid@Authorized(value="Get Concept Reference Terms") ConceptReferenceTerm getConceptReferenceTermByName(String name, ConceptSource conceptSource) throws APIException
name
- the name to match againstconceptSource
- the concept source to match againstAPIException
- Should return a concept reference term that matches the given name from the given source
Should be case insensitive
Should return null if no concept reference term is found@Authorized(value="Get Concept Reference Terms") ConceptReferenceTerm getConceptReferenceTermByCode(String code, ConceptSource conceptSource) throws APIException
code
- the code to match againstconceptSource
- the concept source to match againstAPIException
- Should return a concept reference term that matches the given code from the given source@Authorized(value="Get Concept Reference Terms") List<ConceptReferenceTerm> getConceptReferenceTermByCode(String code, ConceptSource conceptSource, boolean includeRetired) throws APIException
code
- the code to match againstconceptSource
- the concept source to match againstincludeRetired
- specifies if retired concept reference terms should be includedAPIException
- Should return a list of concept reference terms that matches the given code from the given source@Authorized(value="Manage Concept Reference Terms") ConceptReferenceTerm saveConceptReferenceTerm(ConceptReferenceTerm conceptReferenceTerm) throws APIException
conceptReferenceTerm
- the concept reference term object to saveAPIException
- Should add a concept reference term to the database and assign an id to it
Should update changes to the concept reference term in the database@Authorized(value="Manage Concept Reference Terms") ConceptReferenceTerm retireConceptReferenceTerm(ConceptReferenceTerm conceptReferenceTerm, String retireReason) throws APIException
conceptReferenceTerm
- the concept reference term object to retireretireReason
- the reason why the concept reference term is being retiredAPIException
- Should retire the specified concept reference term with the given retire reason
Should should set the default retire reason if none is given@Authorized(value="Manage Concept Reference Terms") ConceptReferenceTerm unretireConceptReferenceTerm(ConceptReferenceTerm conceptReferenceTerm) throws APIException
conceptReferenceTerm
- the concept reference term to unretireAPIException
- Should unretire the specified concept reference term and drop all retire related fields@Authorized(value="Purge Concept Reference Terms") void purgeConceptReferenceTerm(ConceptReferenceTerm conceptReferenceTerm) throws APIException
conceptReferenceTerm
- the concept reference term object to purgeAPIException
- Should purge the given concept reference term
Should fail if given concept reference term is in use@Authorized(value="Get Concept Reference Terms") List<ConceptReferenceTerm> getConceptReferenceTerms(String query, ConceptSource conceptSource, Integer start, Integer length, boolean includeRetired) throws APIException
query
- the string to match against the reference term names or codesconceptSource
- the concept source from which the terms should be looked upstart
- beginning index for the batchlength
- number of terms to return in the batchincludeRetired
- specifies if the retired terms should be includedConceptReferenceTerm
sAPIException
- Should return unique terms with a code or name containing the search phrase
Should return only the concept reference terms from the given concept source@Authorized(value="Get Concept Reference Terms") Integer getCountOfConceptReferenceTerms(String query, ConceptSource conceptSource, boolean includeRetired) throws APIException
query
- the string to match against the reference term namesconceptSource
- the concept source from which the terms should be looked upincludeRetired
- specifies if retired concept reference terms should be includedAPIException
- Should include retired terms if includeRetired is set to true
Should not include retired terms if includeRetired is set to false@Authorized(value="Get Concept Reference Terms") List<ConceptReferenceTermMap> getReferenceTermMappingsTo(ConceptReferenceTerm term) throws APIException
ConceptReferenceTermMap
where the specified reference term is the
termB i.e mappings added to other terms pointing to itterm
- the term to match againstConceptReferenceTermMap
sAPIException
- Should return all concept reference term maps where the specified term is the termB@Authorized(value="Get Concepts") List<Concept> getConceptsByName(String name, Locale locale, Boolean exactLocale) throws APIException
This method is case insensitive. It searches for exactly matching names and close matching locales (if exactLocale = false). It considers only non-voided names and all concepts.
name
- locale
- null
= all localesexactLocale
- false
if search for both global and country specific,
true
if null
APIException
@Authorized(value="Get Concept Map Types") ConceptMapType getDefaultConceptMapType() throws APIException
concept.defaultConceptMapType
global property.ConceptMapType
APIException
- Should return same as by default
Should return type as set in gp@Authorized(value="Get Concepts") boolean isConceptNameDuplicate(ConceptName name)
Concept name is considered duplicate if it is a default non-retired name for a non-voided concept and there is another name, which is:
name
- @Authorized(value="Get Concepts") List<Drug> getDrugs(String searchPhrase, Locale locale, boolean exactLocale, boolean includeRetired)
searchPhrase
- The string to match againstlocale
- The locale to match against when searching in drug concept namesexactLocale
- If false then concepts with names in a broader locale will be matched e.g
in case en_GB is passed in then en will be matchedincludeRetired
- Specifies if retired drugs that match should be included or not@Authorized(value="Get Concepts") List<Drug> getDrugsByMapping(String code, ConceptSource conceptSource, Collection<ConceptMapType> withAnyOfTheseTypes, boolean includeRetired) throws APIException
code
- the code the reference term code to match onconceptSource
- the concept source on which to match onwithAnyOfTheseTypes
- the ConceptMapTypes to match onincludeRetired
- specifies if retired drugs should be included or notDrug
APIException
- Should get a list of all drugs that match on all the parameter values
Should return retired and non-retired drugs if includeRetired is set to true
Should return empty list if no matches are found
Should match on the code
Should match on the concept source
Should match on the map types
Should fail if no code and concept source and withAnyOfTheseTypes are provided
Should exclude duplicate matches
Should fail if source is null@Authorized(value="Get Concepts") Drug getDrugByMapping(String code, ConceptSource conceptSource, Collection<ConceptMapType> withAnyOfTheseTypesOrOrderOfPreference) throws APIException
code
- the code the reference term code to match onconceptSource
- the concept source to match onwithAnyOfTheseTypesOrOrderOfPreference
- the ConceptMapTypes to match onDrug
APIException
- Should return a drug that matches the code and source
Should return a drug that matches the code and source and the best map type
Should fail if multiple drugs are found matching the best map type
Should return null if no match found
Should fail if no code and concept source and withAnyOfTheseTypes are provided
Should fail if source is null@Authorized(value="Get Concepts") List<ConceptSearchResult> getOrderableConcepts(String phrase, List<Locale> locales, boolean includeRetired, Integer start, Integer length)
phrase
- the phrase to match onlocales
- list of locales to match onincludeRetired
- include retired concepts or notstart
- start index of search resultslength
- number of concept results to be returned@Authorized(value="Get Concept Attribute Types") List<ConceptAttributeType> getAllConceptAttributeTypes()
ConceptAttributeType
s@Authorized(value="Manage Concept Attribute Types") ConceptAttributeType saveConceptAttributeType(ConceptAttributeType conceptAttributeType)
conceptAttributeType
- @Authorized(value="Get Concept Attribute Types") ConceptAttributeType getConceptAttributeType(Integer id)
id
- ConceptAttributeType
with the given internal id@Authorized(value="Get Concept Attribute Types") ConceptAttributeType getConceptAttributeTypeByUuid(String uuid)
uuid
- ConceptAttributeType
with the given uuid@Authorized(value="Purge Concept Attribute Types") void purgeConceptAttributeType(ConceptAttributeType conceptAttributeType)
conceptAttributeType
- @Authorized(value="Get Concept Attribute Types") List<ConceptAttributeType> getConceptAttributeTypes(String name) throws APIException
name
- (optional) The name of typeAPIException
- Should return concept attribute types performing fuzzy match on given name
Should return empty list when no concept attribute types match given name@Authorized(value="Get Concept Attribute Types") ConceptAttributeType getConceptAttributeTypeByName(String exactName)
exactName
- ConceptAttributeType
with the specified name@Authorized(value="Manage Concept Attribute Types") ConceptAttributeType retireConceptAttributeType(ConceptAttributeType conceptAttributeType, String reason)
conceptAttributeType
- the concept attribute type to be retiredreason
- for retiring the concept attribute type@Authorized(value="Manage Concept Attribute Types") ConceptAttributeType unretireConceptAttributeType(ConceptAttributeType conceptAttributeType)
conceptAttributeType
- the concept type attribute to unretire@Authorized(value="Get Concepts") ConceptAttribute getConceptAttributeByUuid(String uuid)
uuid
- ConceptAttribute
with the given uuid@Authorized(value="Get Concepts") boolean hasAnyConceptAttribute(ConceptAttributeType conceptAttributeType)
conceptAttributeType
- Copyright © 2024 OpenMRS Inc.. All rights reserved.