## QAry Architecture

Flow Chart (DFD)

```mermaid
graph TD
    ES(fa:fa-server Elastic Search) --> |search results| Q(fa:fa-laptop qary)
  Q --> |search query| ES
  Q --> |upload document| ES
    API(fa:fa-server REST API) --> |question| Q
    Q --> |answer| API
  Q --> |text+question|B(fa:fa-laptop BERT)
  B --> |score+answer|Q
  W(fa:fa-cloud Wikipedia) --> |article text|Q
```


[![](https://mermaid.ink/img/eyJjb2RlIjoiZ3JhcGggVERcblx0RVMoZmE6ZmEtc2VydmVyIEVsYXN0aWMgU2VhcmNoKSAtLT4gfHNlYXJjaCByZXN1bHRzfCBRKGZhOmZhLWxhcHRvcCBxYXJ5KVxuICBRIC0tPiB8c2VhcmNoIHF1ZXJ5fCBFU1xuICBRIC0tPiB8dXBsb2FkIGRvY3VtZW50fCBFU1xuXHRBUEkoZmE6ZmEtc2VydmVyIFJFU1QgQVBJKSAtLT4gfHF1ZXN0aW9ufCBRXG5cdFEgLS0-IHxhbnN3ZXJ8IEFQSVxuICBRIC0tPiB8dGV4dCtxdWVzdGlvbnxCKGZhOmZhLWxhcHRvcCBCRVJUKVxuICBCIC0tPiB8c2NvcmUrYW5zd2VyfFFcbiAgVyhmYTpmYS1jbG91ZCBXaWtpcGVkaWEpIC0tPiB8YXJ0aWNsZSB0ZXh0fFEgXG5cblx0XHRcdFx0IiwibWVybWFpZCI6eyJ0aGVtZSI6ImRlZmF1bHQiLCJ0aGVtZVZhcmlhYmxlcyI6eyJiYWNrZ3JvdW5kIjoid2hpdGUiLCJwcmltYXJ5Q29sb3IiOiIjRUNFQ0ZGIiwic2Vjb25kYXJ5Q29sb3IiOiIjZmZmZmRlIiwidGVydGlhcnlDb2xvciI6ImhzbCg4MCwgMTAwJSwgOTYuMjc0NTA5ODAzOSUpIiwicHJpbWFyeUJvcmRlckNvbG9yIjoiaHNsKDI0MCwgNjAlLCA4Ni4yNzQ1MDk4MDM5JSkiLCJzZWNvbmRhcnlCb3JkZXJDb2xvciI6ImhzbCg2MCwgNjAlL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