# Data Validation

**URL:** <https://forum.rasa.com/t/data-validation/14834>\
**Category:** Rasa Open Source\
**Created:** [August 26, 2019, 6:56pm UTC](https://forum.rasa.com/t/data-validation/14834 "2019-08-26T18:56:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anne](https://avatars.discourse-cdn.com/v4/letter/a/ccd318/32.png) [@anne](https://forum.rasa.com/u/anne)\
**Post date:** [August 26, 2019, 6:56pm UTC](https://forum.rasa.com/t/data-validation/14834/1 "2019-08-26T18:56:47Z")

</div>

Hello,

I am trying to write a validation script for my data as suggested in the document [Validate Data](https://rasa.com/docs/rasa/user-guide/validate-files/). But, m getting error while running my script. Can you please help me with the place where m going wrong ?

-------validation.py file--------

```auto
import logging
from rasa.core.validator import Validator

logfile = 'nlu_model.log'
logging.basicConfig(filename=logfile, level=logging.DEBUG)
validator = Validator('domain.yml', 'data/nlu.md', 'data/stories.md')
validator.verify_all()

```

------Error------

```auto
Traceback (most recent call last):
  File "validate.py", line 12, in <module>
    validator.verify_all()
  File "/home/user/Documents/dev_env/venv/lib64/python3.6/site-packages/rasa/core/validator.py", line 152, in verify_all
    self.verify_intents_in_stories()
  File "/home/user/Documents/dev_env/venv/lib64/python3.6/site-packages/rasa/core/validator.py", line 69, in verify_intents_in_stories
    domain_intents = self.verify_intents()
  File "/home/user/Documents/dev_env/venv/lib64/python3.6/site-packages/rasa/core/validator.py", line 41, in verify_intents
    for intent in self.domain.intent_properties:
AttributeError: 'str' object has no attribute 'intent_properties'

```

---

<div class="post-metadata">

**Author:** ![Tanja](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tanja/32/4696_2.png) [@Tanja](https://forum.rasa.com/u/Tanja)\
**Post date:** [August 27, 2019, 6:29am UTC](https://forum.rasa.com/t/data-validation/14834/2 "2019-08-27T06:29:29Z")

</div>

`Validator` does not expect strings but `domain: Domain, intents: TrainingData, stories: List[StoryStep]`.

If you are using python3.7 you can use

```auto
import logging
import asyncio
from rasa.core.validator import Validator
from rasa.importers.rasa import RasaFileImporter

file_importer = RasaFileImporter.load_from_config(
    'config.yml', 'domain.yml', ['data/nlu.md', 'data/stories.md']
)

domain = asyncio.run(file_importer.get_domain())
nlu_data = asyncio.run(file_importer.get_nlu_data())
story_graph = asyncio.run(file_importer.get_stories())

logfile = 'nlu_model.log'
logging.basicConfig(filename=logfile, level=logging.DEBUG)
validator = Validator(domain, nlu_data, story_graph.story_steps)
validator.verify_all()

```

---

<div class="post-metadata">

**Author:** ![anne](https://avatars.discourse-cdn.com/v4/letter/a/ccd318/32.png) [@anne](https://forum.rasa.com/u/anne)\
**Post date:** [August 28, 2019, 3:40am UTC](https://forum.rasa.com/t/data-validation/14834/3 "2019-08-28T03:40:38Z")

</div>

Thankyou Tanja,

We are using python 3.6. So, i modified the asyncio.run command. But, it fails to fetch the story\_steps. Is there any other way to fetch the stories ?? (I tried to create an object of NluDataImporter and try to fetch the stories, but, it failed.)

----- Error on using the above code-----------

```auto
Traceback (most recent call last):
  File "validate.py", line 10, in <module>
    domain = asyncio.run(file_importer.get_domain())
AttributeError: module 'asyncio' has no attribute 'run'

```

------------Updated Code to make it compatible with Python 3.6---------

```auto
domain = asyncio.get_event_loop()
domain.run_until_complete(file_importer.get_domain())

nlu_data = asyncio.get_event_loop()
nlu_data.run_until_complete(file_importer.get_nlu_data())

story_graph = asyncio.get_event_loop()
story_graph.run_until_complete(file_importer.get_stories())

logfile = 'nlu_model.log'
logging.basicConfig(filename=logfile, level=logging.DEBUG)
validator = Validator(domain, nlu_data, story_graph.story_steps)
validator.verify_all()

```

---------------Error with updated code---------------

```auto
Traceback (most recent call last):
  File "validate.py", line 21, in <module>
    validator = Validator(domain, nlu_data, story_graph.story_steps)
AttributeError: 'Loop' object has no attribute 'story_steps'

```

---

<div class="post-metadata">

**Author:** ![Tanja](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tanja/32/4696_2.png) [@Tanja](https://forum.rasa.com/u/Tanja)\
**Post date:** [August 28, 2019, 5:46am UTC](https://forum.rasa.com/t/data-validation/14834/4 "2019-08-28T05:46:32Z")

</div>

The way you use asyncio is not correct. Here the version which should work with python3.6:

```auto
import logging
import asyncio
from rasa.core.validator import Validator
from rasa.importers.rasa import RasaFileImporter

file_importer = RasaFileImporter.load_from_config(
    'config.yml', 'domain.yml', ['data/nlu.md', 'data/stories.md']
)

loop = asyncio.get_event_loop()
domain = loop.run_until_complete(file_importer.get_domain())
nlu_data = loop.run_until_complete(file_importer.get_nlu_data())
story_graph = loop.run_until_complete(file_importer.get_stories())

logfile = 'nlu_model.log'
logging.basicConfig(filename=logfile, level=logging.DEBUG)
validator = Validator(domain, nlu_data, story_graph.story_steps)
validator.verify_all()

```

---

<div class="post-metadata">

**Author:** ![anne](https://avatars.discourse-cdn.com/v4/letter/a/ccd318/32.png) [@anne](https://forum.rasa.com/u/anne)\
**Post date:** [August 28, 2019, 6:06am UTC](https://forum.rasa.com/t/data-validation/14834/5 "2019-08-28T06:06:16Z")

</div>

Oh… Thanks a ton… 🙂
