# Concept/Terminology Provider

`IConceptRepositoryService` in assembly SanteDB.Core.Api version 3.0.1980.0

## Summary

Represents a service which is responsible for the maintenance of concepts.

### Description

This class is responsible for the management of [Concept](http://santesuite.org/assets/doc/net/html/T_SanteDB_Core_Model_DataTypes_Concept.htm), [ConceptSet](http://santesuite.org/assets/doc/net/html/T_SanteDB_Core_Model_DataTypes_ConceptSet.htm), and [ReferenceTerm](http://santesuite.org/assets/doc/net/html/T_SanteDB_Core_Model_DataTypes_ReferenceTerm.htm) definitions from the [SanteDB CDR's concept dictionary](https://help.santesuite.org/santedb/data-and-information-architecture/conceptual-data-model/concept-dictionary). The implementation of this service contract should provide methods for contacting the storage provider (either local database or a remote terminology service) to:

* Resolve [ReferenceTerm](http://santesuite.org/assets/doc/net/html/T_SanteDB_Core_Model_DataTypes_ReferenceTerm.htm) instances from inbound messages from code/system pairs
* Resolve appropriate [ReferenceTerm](http://santesuite.org/assets/doc/net/html/T_SanteDB_Core_Model_DataTypes_ReferenceTerm.htm) data given a [Concept](http://santesuite.org/assets/doc/net/html/T_SanteDB_Core_Model_DataTypes_Concept.htm) instance from the SanteDB CDR to be sent on an outbound message
* Determine the membership of a [Concept](http://santesuite.org/assets/doc/net/html/T_SanteDB_Core_Model_DataTypes_Concept.htm) in a [ConceptSet](http://santesuite.org/assets/doc/net/html/T_SanteDB_Core_Model_DataTypes_ConceptSet.htm)
* Determiner relationships between [Concept](http://santesuite.org/assets/doc/net/html/T_SanteDB_Core_Model_DataTypes_Concept.htm) instances

## Operations

| Operation                   | Response/Return                    | Input/Parameter                                                                                                                           | Description                                                                                                                             |
| --------------------------- | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| FindConceptsByName          | IEnumerable\<Concept>              | <p><em>String</em> <strong>name</strong><br><em>String</em> <strong>language</strong></p>                                                 | Searches for a by name and language.                                                                                                    |
| FindConceptsByReferenceTerm | IEnumerable\<ConceptReferenceTerm> | <p><em>String</em> <strong>code</strong><br><em>Uri</em> <strong>codeSystem</strong></p>                                                  | Finds a concept by reference term information, returning the so the caller can determine if the and are equivalent, narrower than, etc. |
| GetConceptSetMembers        | IEnumerable\<Concept>              | *String* **mnemonic**                                                                                                                     | Gets all the members of the specified concept set                                                                                       |
| GetConceptByReferenceTerm   | Concept                            | <p><em>String</em> <strong>code</strong><br><em>String</em> <strong>codeSystemDomain</strong></p>                                         | Finds a concept by reference term only where the concept is equivalent to the reference term                                            |
| FindConceptsByReferenceTerm | IEnumerable\<ConceptReferenceTerm> | <p><em>String</em> <strong>code</strong><br><em>String</em> <strong>codeSystemDomain</strong></p>                                         | Finds a concept by reference term information, returning the so the caller can determine if the and are equivalent, narrower than, etc. |
| GetConcept                  | Concept                            | *String* **mnemonic**                                                                                                                     | Get a instance given the concept's unique mnemonic                                                                                      |
| Implies                     | Boolean                            | <p><em>Concept</em> <strong>a</strong><br><em>Concept</em> <strong>b</strong></p>                                                         | Returns a value which indicates whether concept implies concept through a indicating the two are the same                               |
| IsMember                    | Boolean                            | <p><em>ConceptSet</em> <strong>set</strong><br><em>Concept</em> <strong>concept</strong></p>                                              | Returns true if the concept is a member of set                                                                                          |
| IsMember                    | Boolean                            | <p><em>Guid</em> <strong>set</strong><br><em>Guid</em> <strong>concept</strong></p>                                                       | Returns true if the concept is a member of set                                                                                          |
| GetConceptReferenceTerm     | ReferenceTerm                      | <p><em>Guid</em> <strong>conceptId</strong><br><em>String</em> <strong>codeSystem</strong><br><em>Boolean</em> <strong>exact</strong></p> | Gets the concept reference term for the specified code system                                                                           |
| GetConceptReferenceTerm     | ReferenceTerm                      | <p><em>String</em> <strong>conceptMnemonic</strong><br><em>String</em> <strong>codeSystem</strong></p>                                    | Gets the concept reference term for the specified code system                                                                           |
| FindReferenceTermsByConcept | IEnumerable\<ConceptReferenceTerm> | <p><em>Guid</em> <strong>conceptId</strong><br><em>String</em> <strong>codeSystem</strong></p>                                            | Finds all reference terms for the concept with in the specified system.                                                                 |
| GetName                     | String                             | <p><em>Guid</em> <strong>conceptId</strong><br><em>String</em> <strong>twoLetterISOLanguageName</strong></p>                              | Get the specified concept name                                                                                                          |
| ExpandConceptSet            | IQueryResultSet\<Concept>          | *Guid* **conceptSetId**                                                                                                                   | Expand the concept set to a flat list of values                                                                                         |
| ExpandConceptSet            | IQueryResultSet\<Concept>          | *String* **conceptSetMnemonic**                                                                                                           | Expand the concept set to a flat list of values                                                                                         |

## Implementations

### LocalConceptRepository - (SanteDB.Core.Api)

Represents a service which is responsible for the maintenance of concepts using local persistence.

#### Service Registration

```markup
...
<section xsi:type="ApplicationServiceContextConfigurationSection" threadPoolSize="4">
	<serviceProviders>
		...
		<add type="SanteDB.Core.Services.Impl.Repository.LocalConceptRepository, SanteDB.Core.Api, Version=3.0.1980.0, Culture=neutral, PublicKeyToken=null" />
		...
	</serviceProviders>
```

## Example Implementation

```csharp
/// Example Implementation
using SanteDB.Core.Services;
/// Other usings here
public class MyConceptRepositoryService : SanteDB.Core.Services.IConceptRepositoryService { 
	public String ServiceName => "My own IConceptRepositoryService service";
	/// <summary>
	/// Searches for a  by name and language.
	/// </summary>
	public IEnumerable<Concept> FindConceptsByName(String name,String language){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Finds a concept by reference term information, returning the              so the caller can determine if the  and  are equivalent,            narrower than, etc.
	/// </summary>
	public IEnumerable<ConceptReferenceTerm> FindConceptsByReferenceTerm(String code,Uri codeSystem){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Gets all the  members of the specified concept set
	/// </summary>
	public IEnumerable<Concept> GetConceptSetMembers(String mnemonic){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Finds a concept by reference term only where the concept is equivalent to the reference term
	/// </summary>
	public Concept GetConceptByReferenceTerm(String code,String codeSystemDomain){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Finds a concept by reference term information, returning the              so the caller can determine if the  and  are equivalent,            narrower than, etc.
	/// </summary>
	public IEnumerable<ConceptReferenceTerm> FindConceptsByReferenceTerm(String code,String codeSystemDomain){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Get a  instance given the concept's unique mnemonic
	/// </summary>
	public Concept GetConcept(String mnemonic){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Returns a value which indicates whether concept  implies concept  through             a  indicating the two are the same
	/// </summary>
	public Boolean Implies(Concept a,Concept b){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Returns true if the concept  is a member of set
	/// </summary>
	public Boolean IsMember(ConceptSet set,Concept concept){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Returns true if the concept  is a member of set
	/// </summary>
	public Boolean IsMember(Guid set,Guid concept){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Gets the concept reference term for the specified code system
	/// </summary>
	public ReferenceTerm GetConceptReferenceTerm(Guid conceptId,String codeSystem,Boolean exact){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Gets the concept reference term for the specified code system
	/// </summary>
	public ReferenceTerm GetConceptReferenceTerm(String conceptMnemonic,String codeSystem){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Finds all reference terms for the concept with  in the specified  system.
	/// </summary>
	public IEnumerable<ConceptReferenceTerm> FindReferenceTermsByConcept(Guid conceptId,String codeSystem){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Get the specified concept name
	/// </summary>
	public String GetName(Guid conceptId,String twoLetterISOLanguageName){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Expand the concept set to a flat list of values
	/// </summary>
	public IQueryResultSet<Concept> ExpandConceptSet(Guid conceptSetId){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Expand the concept set to a flat list of values
	/// </summary>
	public IQueryResultSet<Concept> ExpandConceptSet(String conceptSetMnemonic){
		throw new System.NotImplementedException();
	}
}
```

## References

* [IConceptRepositoryService C# Documentation](http://santesuite.org/assets/doc/net/html/T_SanteDB_Core_Services_IConceptRepositoryService.htm)
* [LocalConceptRepository C# Documentation](http://santesuite.org/assets/doc/net/html/T_SanteDB_Core_Services_Impl_Repository_LocalConceptRepository.htm)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.santesuite.org/developers/server-plugins/implementing-.net-features/service-definitions/concept-terminology-provider.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
