# Currency Process Flow

## Identify the Country Name

**getCurrency** flow is used to get the Currency of a Country. Once getCurrency flow is invoked, Rawspeech is passed to the **getCurrency** flow to identify the Country Name.

getCountryName parses the RawSpeech against the list of country from **pycountry** and return the country name identified.

* In case the country is not identified then default country name is returned.
* This is for questions such as what is capital?, So no country is passed thus it default's the country and returns India in this example.

{% hint style="info" %}
[pycountry ](https://pypi.org/project/pycountry/)packages provides the ISO databases for the standards for Countries, Languages, Deleted Countries, Subdivisions of Countries, Currencies, Scripts.
{% endhint %}

```python
while i<len(pycountry.countries):
    if subStrCheck(rawspeech,(list(pycountry.countries)[i].name)):
        countryname = list(pycountry.countries)[i].name
        break
    i = i+1
    if i == len(pycountry.countries):
        countryname = "India" 
```

## Identify the Numeric Id for the Country Name

Once the country name is identified then **pycountry** package is used to get the numeric id of a Country.

Numeric Id will be used as lookup to get the currencies for a country.

```python
countriesattributes = pycountry.countries.get(name=countryname)
countrynumericid = countriesattributes.numeric
```

## Identify the Currency for the Given Numeric ID

Currency Name and Currency Symbol are identified using **pycountry.currencies** by passing the country numeric id identified in previous step.

Attribute name provides the name of the currency and alpha\_3 gives the currency symbol.

```python
currencyname = pycountry.currencies.get(numeric=countrynumericid).name
currencysymbol = pycountry.currencies.get(numeric=countrynumericid).alpha_3
```

{% hint style="success" %}
Aryan Shares the Currency Name and Symbol for the requested Country and flow is completed successfully. Control is passed to NextStep.

```python
PrintText(aifriend,"Currency for " + countryname + " is " + currencyname + " and symbol is " + currencysymbol )
SpeakText(aifriend,"Currency for " + countryname + " is " + currencyname + " and symbol is " + currencysymbol )
```

{% endhint %}


---

# 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://aryanai.gitbook.io/docs.aryanandarya/my-skills/currency-of-india/currency-process-flow.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.
