Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Make sure you are using opensrp-client-core version >= v1.12.0-SNASPHOT

  2. Make sure you are using opensrp-client-native-form version >= v.1.13.1-SNAPSHOT

  3. Add the following code to the last line in your Application.onCreate method

    Code Block
    NativeFormLibrary
      .getInstance()
      .setClientFormDao(CoreLibrary.getInstance().context().getClientFormRepository());
  4. Change any references, extensions and manifest declarations of com.vijay.jsonwizard.activities.JsonFormActivity to com.vijay.jsonwizard.activities.FormConfigurationJsonFormActivity

    1. Change the AndroidManifest.xml declaration of the JsonFormActivity to FormConfigurationJsonFormActivity

    2. Change any startActivity and startActivityForResult methods to use FormConfigurationJsonFormActivity instead of JsonFormActivity as the target activity

    3. Replace parent activities from JsonFormActivity to FormConfigurationJsonFormActivity in the activities which extend JsonFormActivity

  5. Add the following lines to your AppJobCreator#onCreate method to make the DocumentConfigurationServiceJob available

    Code Block
    languagejava
    case DocumentConfigurationServiceJob.TAG:
                    return new DocumentConfigurationServiceJob(DocumentConfigurationIntentService.class);
  6. Schedule the DocumentConfigurationServiceJob to run every 15 minutes by adding the following line to LoginInteractor#scheduleJobsPeriodically

    Code Block
    DocumentConfigurationServiceJob
                    .scheduleJob(DocumentConfigurationServiceJob.TAG
                            , TimeUnit.MINUTES.toMillis(BuildConfig.CLIENT_SETTINGS_SYNC_MINUTES)
                            , getFlexValue(BuildConfig.CLIENT_SETTINGS_SYNC_MINUTES));
  7. Create the ClientFormRepository and ManifestRepositoryby adding the create statements in the ApplicationRepository eg. ANCRepository or add the create statements as migrations. To create the tables, add the following statements

    Code Block
    languagejava
    ClientFormRepository.createTable(db);
    ManifestRepository.createTable(db);
  8. Add the forms sync to the immediate sync call. This function enables forms sync to happen when the user clicks on the Sync button

  9. When openning opening forms, use com.vijay.jsonwizard.utils.FormUtils#getFormJsonFromRepositoryOrAssets method to fetch the JSON form. The rules & other assets required when loading the form are handled by the FormConfigurationJsonFormActivity

  10. Make an initial upload of the form files:

    1. Clone this repo github.com/OpenSRP/opensrp-server-web

    2. Change client project assets folder path in the configuration file named doc_config_script_configs.properties

    3. Change the server url & authentication credentials in the configuration file named doc_config_script_configs.properties

    4. Change the appId and appVersion values in the configuration file named doc_config_script_configs.properties

    5. Run the main method in InitialFormConfigUploadUtil.java file

    6. Check the output for any failures. Increment the formVersion and repeat in case of any failures

How it works

  1. Changes to the form eg. child_enrollment.json, disease_effects.json are made and tested

  2. Create a Manifest in json form with the package name, app version & forms version as below

...

  • GET request with params

    • form_version (Required) The semantic version of the form

    • form_identifier (Required) The unique identifier of the form eg. en/json.form/maternity/enrollment.json

    • current_form_version (Optional) The current form version on the client app

Client side APIs

Coming soon. This work is under development

...