Setup App

Demo Video

DIGIT Health Campaign Management Demo | DIGIT HCM

Overview

This guide provides step-by-step instructions to clone and run the Health Campaign Frontline Worker's App locally on your machine. The app is a Flutter application developed for health campaigns.

Pre-requisites

Before you begin, ensure that you have the following installed on your PC:

  • Flutter 3.16.5 version - Flutter SDK.

  • Android Studio or VS Code, any preferred IDE for Flutter development.

  • Android device or emulator for testing.

  • Run the flutter doctor command to ensure all the required checklists are marked.

Steps

  1. Open a terminal and run the following commands:

git clone https://github.com/egovernments/health-campaign-field-worker-app.git

cd health-campaign-field-worker-app

Product Repo: egovernments/health-campaign-field-worker-app

  1. Open the project in your preferred IDE (Android Studio, Visual Studio Code). Make sure that your IDE is configured with the Flutter and Dart plugins.

  2. Create a .env file inside the apps/health_campaign_field_worker_app folder.

Sample .env file:

BASE_URL={replace with base url}
MDMS_API_PATH='egov-mdms-service/v1/_search'
TENANT_ID="mz"`
ACTIONS_API_PATH="access/v1/actions/mdms/_get"
SYNC_DOWN_RETRY_COUNT="3"
RETRY_TIME_INTERVAL="5"
CONNECT_TIMEOUT="120000"
RECEIVE_TIMEOUT="120000"
SEND_TIMEOUT="120000"
CHECK_BANDWIDTH_API="/project/check/bandwidth"
ENV_NAME="DEMO"
  1. Create another file as pubspec_overrides.yaml in the same folder:

# melos_managed_dependency_overrides: digit_components,digit_firebase_services,forms_engine,intl, digit_showcase
dependency_overrides:
  attendance_management:
    path: ../../packages/attendance_management
  dart_mappable_builder:
    path: ../../packages/dart_mappable_builder
  digit_components:
    path: ../../packages/digit_components
  digit_firebase_services:
    path: ../../packages/digit_firebase_services
  digit_showcase:
    path: ../../packages/digit_showcase
  forms_engine:
    path: ../../packages/forms_engine
  intl: ^0.18.0

Note: Check that all the folder names are in the packages folder before overriding the dependencies.

  1. Create another file as pubspec_overrides.yaml in packages/attendance_management/pubspec_overrides.yaml

# melos_managed_dependency_overrides: dart_mappable_builder
# melos_managed_dependency_overrides: digit_components
dependency_overrides:
  digit_components:
    path: ../../packages/digit_components
  dart_mappable_builder:
    path: ../../packages/dart_mappable_builder
  1. Create another file as pubspec_overrides.yaml in packages/forms_engine/pubspec_overrides.yaml

# melos_managed_dependency_overrides: digit_components
dependency_overrides:
  digit_components:
    path: ../digit_components
  1. Run install_bricks.sh bash script which is located in the tools folder. This script fetches and links all the necessary dependencies for the project.

  2. After successfully running the script and setting up the env file, navigate to the app's folder from the terminal:

    cd apps/health_campaign_field_worker_app

  3. Connect your Android device or start an emulator. Ensure that it is visible by running

    flutter devices.

  4. Now, run the following command to launch the app:

    flutter run.

This command will build the app and install it on the connected device or emulator.

Generate APK - Steps

  • Create a .env file inside the apps/health_campaign_field_worker_app folder.

Sample .env file:

BASE_URL={replace with base url}
MDMS_API_PATH='egov-mdms-service/v1/_search'
TENANT_ID="mz"`
ACTIONS_API_PATH="access/v1/actions/mdms/_get"
SYNC_DOWN_RETRY_COUNT="3"
RETRY_TIME_INTERVAL="5"
CONNECT_TIMEOUT="120000"
RECEIVE_TIMEOUT="120000"
SEND_TIMEOUT="120000"
CHECK_BANDWIDTH_API="/project/check/bandwidth"
ENV_NAME="DEMO"
  • Create another file as pubspec_overrides.yaml in the same folder.

# melos_managed_dependency_overrides: digit_components,digit_firebase_services,forms_engine,intl, digit_showcase
dependency_overrides:
  attendance_management:
    path: ../../packages/attendance_management
  dart_mappable_builder:
    path: ../../packages/dart_mappable_builder
  digit_components:
    path: ../../packages/digit_components
  digit_firebase_services:
    path: ../../packages/digit_firebase_services
  digit_showcase:
    path: ../../packages/digit_showcase
  forms_engine:
    path: ../../packages/forms_engine
  intl: ^0.18.0

Note: All the folder names should be in the packages folder, before overriding the dependencies.

  • Create another file as pubspec_overrides.yaml in packages/attendance_management/pubspec_overrides.yaml

# melos_managed_dependency_overrides: dart_mappable_builder
# melos_managed_dependency_overrides: digit_components
dependency_overrides:
  dart_mappable_builder:
    path: ../dart_mappable_builder
  digit_components:
    path: ../digit_components
  • Create another file as pubspec_overrides.yaml in packages/forms_engine/pubspec_overrides.yaml

# melos_managed_dependency_overrides: digit_components
dependency_overrides:
  digit_components:
    path: ../digit_components
  • Run install_bricks.sh bash script which is located in the tools folder. This script fetches and links all the necessary dependencies for the project.

  • After successfully running the script and setting up the env file, navigate to - apps/health_campaign_field_worker_app folder in the terminal, and run the following command to generate the APK:

    flutter build apk --release --no-tree-shake-icons

  • After successfully running the above command, the APK will be generated in the path

    apps/health_campaign_field_worker_app/build\app\outputs\flutter-apk\app-release.apk

  • Install the generated APK on your preferred Android device.

Change Master Data - Steps

All the Master data persist in MDMS under the tenant folders.

Sample: https://github.com/egovernments/health-campaign-mdms/tree/DEV/data/default. App master data persist in:

https://github.com/egovernments/health-campaign-mdms/tree/DEV/data/default/health

Consist of service register: All the APIs that the app utilises to call the server: https://github.com/egovernments/health-campaign-mdms/blob/DEV/data/default/health/service-registry.json

App configuration: Primary details required to run the app:

https://github.com/egovernments/health-campaign-mdms/blob/DEV/data/default/health/field-app-configuration.json Project types: Details of the projects are listed here: https://github.com/egovernments/health-campaign-mdms/blob/DEV/data/default/health/project-types.json

Additional static configs: https://github.com/egovernments/health-campaign-mdms/blob/DEV/data/default/health/symptoms_types.json

Upsert Localisation

  1. Import the following curl in Postman:

Note:

  • Replace the {URL} with the required environment.

  • Get the {authToken} of SUPER_USER.

  • Replace the {tenantId} with the required tenant.

  • Each message object should have a unique code and module.

Sample message to upsert:

{
            "code": "ADMINISTRATION_UNIT_FORM_LABEL",
            "message": "Administrative Unit",
            "module": "hcm-beneficiary",
            "locale": "en_MZ"
      }

API curl

curl --location '{URL}/localization/messages/v1/_upsert' \
--header 'Content-Type: application/json' \
--data '{
    "RequestInfo": {
        "apiId": "emp",
        "ver": "1.0",
        "ts": "10-03-2017 00:00:00",
        "action": "create",
        "did": "1",
        "key": "abcdkey",
        "msgId": "20170310130900",
        "requesterId": "rajesh",
        "authToken": "{authToken}",
        "userInfo": {
            "id": 128
        }
    },
    "tenantId": "{tenantId}",
    "locale": "{locale}", // Eg. en_MZ
    "module": "hcm-common",
    "messages": [
        {
            "code": "ADMINISTRATION_UNIT_FORM_LABEL",
            "message": "Administrative Unit",
            "module": "hcm-beneficiary",
            "locale": "en_MZ"
        }
    ]
}'

If the localisation is not executed prior, then -

Consolidated: https://github.com/egovernments/releasekit/blob/master/localisation/HCM/consolidated/en_MZ/consolidated.json Module Localisation:

https://github.com/egovernments/releasekit/tree/master/localisation/HCM/V1.3

https://creativecommons.org/licenses/by/4.0/