# Configure and Import ODK Form

This document provides step-by-step instructions for configuring the ODK central into the PBMS and importing the ODK form. After importing the ODK form, only the fields and their values customised using the JSON formatter are included in the individual/group registries of the PBMS.

Note:

Every ODK form must have its own ODK importer.

## Prerequisites

* A user must have an Administrator role to access ODK Central in OpenG2P systems.
* A user must know the pyjq syntax to customise the value in the JSON Formatter fields.

## Procedure

1. Click the main icon ![](https://1895884874-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnKdOHLbjDdIln1QDNwSx%2Fuploads%2Fgit-blob-04035215d78b73c4cc8238ae5303c552b094ec15%2Fmenu-icon.png?alt=media) and select ODK.

<figure><img src="https://1895884874-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnKdOHLbjDdIln1QDNwSx%2Fuploads%2Fgit-blob-74e78f9b255decc1f18fe503d067c797d396260c%2Fpbms-odk-app.png?alt=media" alt=""><figcaption></figcaption></figure>

***ODK*** screen is displayed. You can find two tabs.

* [ODK Import](#odk-import)
* [Configuration](#odk-configuration)

### ODK Import

By default, ODK -> ODK Import page is displayed.

<figure><img src="https://1895884874-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnKdOHLbjDdIln1QDNwSx%2Fuploads%2Fgit-blob-40cdfc289caf7776e693c4a9afd49e3365ae1157%2Fpbms-odk-screen.png?alt=media" alt=""><figcaption></figcaption></figure>

2. Click the **New** button.

***ODK Import New*** screen is displayed.

<figure><img src="https://1895884874-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnKdOHLbjDdIln1QDNwSx%2Fuploads%2Fgit-blob-9519476bb5fdcaed3664fbffa97046a6c3a13fb2%2Fodk-import-new.png?alt=media" alt=""><figcaption></figcaption></figure>

The fields and their descriptions are given below.

3. Customize the ODK Importer based on the ODK form fields

<table><thead><tr><th width="226">Parameters</th><th>Description</th></tr></thead><tbody><tr><td><strong>ODK CONFIGURATION</strong></td><td></td></tr><tr><td><strong>ODK Config</strong></td><td>The name of the ODK configuration</td></tr><tr><td><strong>TARGET SETTINGS</strong></td><td></td></tr><tr><td><strong>Target Registry</strong></td><td><p>Specifies whether imported records should be associated with individual or group registries within the PBMS.</p><p>Select the appropriate value from the drop-down. The valid values are:</p><ul><li>Individual</li><li>Groups</li></ul></td></tr><tr><td><strong>JSON Formatter</strong></td><td>Enables users to define a custom JSON formatter for transforming retrieved data before importing it into the PBMS. Refer to relevant documentation for details on utilizing the JSON formatter using <a href="https://pypi.org/project/pyjq/">PYJQ library</a>.</td></tr><tr><td><strong>TIME INTERVAL</strong></td><td></td></tr><tr><td><strong>Interval in Hours (Optional)</strong></td><td>Defines the interval (in hours) at which the import process should be automatically triggered. This allows for scheduled data updates.</td></tr><tr><td><strong>PROGRAM DETAILS</strong></td><td></td></tr><tr><td><strong>Program</strong></td><td>Map the registrant into the program.</td></tr><tr><td><a href="#test-connection"><strong>Test Connection</strong></a></td><td><ul><li>Verifies the established connection between the ODK Importer and ODK Central.</li><li>Ensures that the ODK Importer can effectively communicate with ODK Central, the server hosting the ODK forms.</li><li>Enables seamless data transfer between the two systems</li></ul></td></tr><tr><td><a href="#import-records"><strong>Import Records</strong></a></td><td><ul><li>Tracks the progress of data import and identifies any errors that may occur during the process.</li><li>Provides users with real-time updates on the status of their data import, allowing them to quickly address any issues and ensure a smooth import process.</li></ul></td></tr><tr><td><strong>Start/Stop</strong></td><td><p><em><strong>Start</strong></em> executes the scheduled job to run periodically at fixed times, dates, or intervals.</p><p><em><strong>Stop</strong></em> terminates the scheduled job.</p></td></tr></tbody></table>

| Icon                                                                                                                                                                                                                                                   | Click to                                                                                                                                                                                                                                    |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <img src="https://1895884874-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnKdOHLbjDdIln1QDNwSx%2Fuploads%2Fgit-blob-b6f0b2a4064d79d04550e0b271d00575206f0b10%2FActions.png?alt=media" alt="" data-size="original">              | <p>Select the appropriate value. The available values are:</p><ul><li>Archive</li><li>Duplicate</li><li>Change Password</li><li>Disable two-factor authentication</li><li>Send Password Reset Instructions</li><li>Privacy Lookup</li></ul> |
| <img src="https://1895884874-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnKdOHLbjDdIln1QDNwSx%2Fuploads%2Fgit-blob-843f8175332ed2465f83d2585eae57031142fb1f%2Ficon-save-manually.png?alt=media" alt="" data-size="original">   | Save manually the individual data and exit from the screen.                                                                                                                                                                                 |
| <img src="https://1895884874-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnKdOHLbjDdIln1QDNwSx%2Fuploads%2Fgit-blob-eaa9f395650b513ffba668e9638c701bce29630f%2Fdiscard-changes-icon.png?alt=media" alt="" data-size="original"> | Discard changes and exit from the screen.                                                                                                                                                                                                   |

### Configuration

4. Click the tab ***Configuration*** in the menu bar.

***Configuration*** screen is displayed.

<figure><img src="https://1895884874-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnKdOHLbjDdIln1QDNwSx%2Fuploads%2Fgit-blob-dc5078e3b2882c0fad3859556b68f57468bacaf1%2Fpbms-odk-config.png?alt=media" alt=""><figcaption></figcaption></figure>

5. Click the ***New*** button.

***Configuration New*** screen is displayed.

<figure><img src="https://1895884874-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnKdOHLbjDdIln1QDNwSx%2Fuploads%2Fgit-blob-a368d3f02fdf2bab5999a874175b8adfe1944de6%2Fodk-configuration-new.png?alt=media" alt=""><figcaption></figcaption></figure>

The fields and their descriptions are given below.

6. Enter the valid values to access ODK Central in OpenG2P systems.

| Field                   | Description                                                            |
| ----------------------- | ---------------------------------------------------------------------- |
| ***ODK Configuration*** |                                                                        |
| Name                    | Enter the name for the ODK importer.                                   |
| Base URL                | Enter the URL of the ODK Central.                                      |
| Username                | Enter the username which is used to login ODK Central                  |
| Password                | Enter the password which is used to login ODK Central                  |
| ***Project details***   |                                                                        |
| Project                 | <p>Enter the project number.</p><p>For example, 3</p>                  |
| Form ID                 | <p>Enter the ID of the form.</p><p>For example, Safety-Net-Program</p> |

**Sample ODK form URL**

<figure><img src="https://1895884874-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnKdOHLbjDdIln1QDNwSx%2Fuploads%2Fgit-blob-c2d64fd57ebc5beb4761b318c0be43baf41c1a91%2Fodk-form-url.png?alt=media" alt=""><figcaption></figcaption></figure>

### Test Connection

***Test Connection*** feature establishes the connection between ***ODK Central*** and ***PBMS***.

7. Click the ***Test Connection*** button.

If the ***Test Connection*** feature connects the ***ODK Central*** and ***PBMS*** successfully, a successful message pop ups.

<figure><img src="https://1895884874-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnKdOHLbjDdIln1QDNwSx%2Fuploads%2Fgit-blob-e843e7c17713b8415b12d339afbd95791639af5b%2Fodk-import-test-connection.png?alt=media" alt=""><figcaption></figcaption></figure>

If the ***Test Connection*** feature unable to connect the ***ODK Central*** and ***OpenG2P*** systems, an error message pop ups.

<figure><img src="https://1895884874-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnKdOHLbjDdIln1QDNwSx%2Fuploads%2Fgit-blob-0ee47425676c56c0f9eda628aeffb1e503b378e5%2Fodkimp-testconnect-fail.png?alt=media" alt=""><figcaption></figcaption></figure>

8. Click the ***OK*** button to exit the dialog box.

### Import Records

***Import Records*** feature imports and stores the records in PBMS.

9. Click the ***Import Records*** button.

If the ODK form is imported successfully, a success message pops up.

<figure><img src="https://1895884874-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnKdOHLbjDdIln1QDNwSx%2Fuploads%2Fgit-blob-8fc66db52f48ef28657e90ea33704626b211da5e%2Fimport-records.png?alt=media" alt=""><figcaption></figcaption></figure>

If no new ODK forms are submitted, ODK form records will not be imported.

<figure><img src="https://1895884874-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnKdOHLbjDdIln1QDNwSx%2Fuploads%2Fgit-blob-e354bab703bb420df470801057d49a49b46355f1%2Fimport-records-fail.png?alt=media" alt=""><figcaption></figcaption></figure>

You can find the configuration details in the ***ODK Configuration*** screen and imported ODK forms' status in the ***ODK Import*** screen.

This completes the process of importing an ODK form from ODK Central into the PBMS.

### JSON Formatter

Configure the required fields based on the ODK form field using pyjq JSON formatter.

**Sample JSON Formatter**

<figure><img src="https://1895884874-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnKdOHLbjDdIln1QDNwSx%2Fuploads%2Fgit-blob-f70b7250b7df2104938c0bc7578ef27afee91605%2FJSON-formatter-1.png?alt=media" alt=""><figcaption><p>JSON Formatter</p></figcaption></figure>
