# ovok.questionnaires and ovok.questionnaireResponses

Canonical page: https://docs.ovok.com/web-sdk/core/namespaces/questionnaires

`ovok.questionnaires` runs questionnaire operations on the FHIR server. `ovok.questionnaireResponses` saves and processes the answers. Patient apps call both for the signed-in user.

## Pre-fill a questionnaire [#pre-fill-a-questionnaire]

`populate` runs `$populate` on a stored Questionnaire.

```ts
const filled = await ovok.questionnaires.populate('questionnaire-id');
```

- Pass a `Parameters` resource as the second argument to give the server context. Without it, an empty one is sent.
- It resolves to the `Parameters` the server returns.

## Submit a response [#submit-a-response]

```ts
const bundle = await ovok.questionnaireResponses.submit(response);
```

- `submit` saves one QuestionnaireResponse in a transaction and resolves to the response bundle.
- To save derived Observations with it, use `submitWithObservations(response, observations)`. It is one transaction, so the response is never saved without its observations.

## Extract observations [#extract-observations]

```ts
const extracted = await ovok.questionnaireResponses.extract(responseId);
```

- It runs `$extract` on a stored response and resolves to `Parameters`.
- A response that is not stored yet cannot be extracted: submit it first.

## Reference [#reference]

- [questionnaires API reference](/web-sdk/core/reference/core/questionnaires): every method and type.
- [ovok.patient](/web-sdk/core/namespaces/patient) to read a patient's questionnaires and responses.
