Versions Compared

Key

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

This page documents the software requirements and outlines the integration for the OpenSRP-OpenLMIS proof of concept that will be demonstrated to GAVI the week of 26th March 2018.

...

This section was copied from the previous page for reference. This section defines the minimum functional workflows for the proof of concept demo. Stretch activities are clearly marked with (Stretch)

  1. (Current Functionality) OpenSRP Android Client Demo prep to show current functionality
    • The OpenSRP user will login to the stock management module to see the current number of vials available for the antigen
    • The OpenSRP user will perform a number of sample immunizations in the OpenSRP child immunization app for a single antigen (OPV)
    • The OpenSRP user will return to the Stock management module, click the card for the antigen and touch the Issued button to show a reduction in the stock
  2. (New) OpenSRP Android Client Requesting Stock
    • The OpenSRP user is already at the Stock Management Module screen
    • The user will touch a button to request stock based on Ideal Stock Amounts
      • A message will appear verifying that the user is requesting stock "Please confirm that you would like to request stock based on your Ideal Stock Amounts"
    • The device syncs with OpenSRP Server
    • Nifi NiFi queries the OpenSRP Server endpoint every 'n' seconds and identifies that a new stock request has been receivedNifi
      • How do we tell what's "new"? Are new stock requests any with a created data newer than the last created date we saw on the endpoint?
    • NiFi performs internal business logic to map the stock request to the facility, user and ideal stock amount (ISA)
    • Nifi NiFi pushes an order to the OpenLMIS Orders API endpoint in the Fulfillment Microservice. An Order number is returned to Nifi.OpenLMIS user logs in to NiFi.
      • Not sure NiFi can receive an order number, what is it supposed to do with it?
    • OpenLMIS user logs in to verify the order was created
  3. (Current Functionality) OpenLMIS Demo to convert Order to Shipment
    • OpenLMIS user walks through the order fulfillment process
    • A shipment is created
  4. (New) OpenSRP Android Client Receiving Shipment
    • Nifi NiFi queries the OpenLMIS Shipments API in the Fulfillment Service to see if a new shipment has been generated
      • (Note: Should this be the API endpoint, or should we query the Proof of Delivery Endpoint?)
      • How do we tell what's "new"?
    • When a new Shipment is identified, Nifi NiFi queries the Shipment/{id} API endpoint in the Fulfillment service to get the shipment details
    • Nifi NiFi performs business logic on the Shipment details to convert it to the appropriate JSON format required by OpenSRPNifi
      • Does this logic require any data not received from the shipment/{id} endpoint?
    • NiFi posts the JSON to the OpenSRP Server
    • OpenSRP Server receives the shipment information
    • On a regular schedule, OpenSRP Android Client Syncs with the OpenSRP Server
      • A new shipment is received
      • A notification is generated in the Stock Management Module's Shipment section (new section)
    • OpenSRP user touches the shipments section in the stock management module and they are redirected to a page showing that a shipment is available
    • OpenSRP user touches the shipment and they view details of the shipment
    • User can accept shipment
    • (Stretch) User can adjust the amounts of each orderable and touch save
      • On Save action, the antigen amounts update on the tablet
    • OpenSRP Android client will sync with OpenSRP server
    • (Stretch) Nifi NiFi Queries OpenSRP Server on a regular schedule for Proof of Delivery
      • What is the proof of delivery?
    • (Stretch) Nifi NiFi performs the appropriate business logic to accept the proof of delivery and creates the appropriate JSON to post to OpenLMIS
    • (Stretch) Nifi NiFi posts the Proof of Delivery to the OpenLMIS Proof of Delivery API endpoint in the Fulfillment Service.

...

This feature requires development in the Android Client, OpenSRP Server and NifiNiFi.

OpenSRP Android Client

The Android Client will need to be enhanced with a push button that requests stock in the Stock Management module. This button will store the datetime, user and facility information for the stock request and it will sync with the OpenSRP server.

...

  • (NOTE: This is not final and will need to be reviewed by the developer team)
  • We will need to add an "Order" endpoint to the REST API that allows users to GET and POST Orders
  • This endpoint will be available at the following endpoint /rest/stockresource/order/
    • Is a /rest/ prefix a thing? 
    • Methods:
      • /add - maybe POST / The add method will have to be enhanced
        • Does this add an order?
      • /sync - The sync method will have to be enhanced to get order events
        • What does this endpoint do?
      • /getOrders - maybe GET /{id} This is a new GET method that will get orders by facility. This will be the primary endpoint that Nifi NiFi queries to get order updates. Filter parameters will need to include asOfDateTime (ServerVersion) so we can minimize the number of results returned.

      ...

            • What's the DB column holding the time we want to filter on? Suggest query param key as "min-{the column name}"

      1.6 Sync Enhancement:

      • The Sync service will need to be modified to include these orders and appropriately place the order content.

      ...

      NiFi

      Nifi NiFi will be responsible for querying the /getOrders API endpoint and kicking off the orders in OpenLMIS. The getOrders API will be queried on a regular schedule for new orders. When a new order is received, a Nifi NiFi Flow is run that ultimately creates an order in the /api/Orders endpoint in OpenLMIS. The structure of orders in OpenLMIS are defined by the project and we will need to hard code these for the demo.

      Once an order is created, the order number will be stored in Nifi NiFi for future use.Nifi

      NiFi can not store any permanent data

      NiFi will need to create a number of maps:

      ...

      • When OpenSRP sees that a facility has requested an Order in from the getOrders API, it will:
        • Map the OpenSRP Facility ID to the OpenLMIS facility ID
        • Query Nifi NiFi for the order template for the OpenLMIS facility IDthe OpenLMIS facility ID
          • There's no way to query NiFi, we can store a JSON mapping in NiFi and convert from OSRP to OLMIS facility ID (alright, I guess that's a kind of "query" :)
        • Complete the appropriate fields in the Order Template, (Order Date, Source, etc)
        • Save a log of the order
          • What's this log for, how accesible does it need to be?
        • Post the Order to the OpenLMIS /api/Orders/ endpoint
        • Store the Order number in a log
          • What's this log for, how accesible does it need to be?
      • Authentication will be stored in Nifi with a demo credentials

      ...

      • (NOTE: This is not final and will need to be reviewed by the developer team)
      • We will need to add a "Shipment" endpoint to the REST API that allows users to GET and POST Shipments
      • This endpoint will be available at the following endpoint /rest/stockresource/shipment/
        • Methods:
          • /add - The add method will have to be enhanced to include the ability to add a Shipment from NifiNiFi.
          • /sync - The sync method will have to be enhanced to get shipment events and sync them down to the Android client
          • /getShipments - This is a new GET method that will allow Android client get shipments by location. This will be the primary endpoint that the Android client queries to get shipment updates. Filter parameters will need to include ServerVersion so we can ensure the sync is applied appropriately.

      ...

      • The Sync service will need to be modified to include these shipments and appropriately place the shipment content on the Android client.

      ...

      NiFi

      Nifi NiFi is responsible for querying the OpenLMIS Shipments API to identify if there are any shipments that are on the way. When a shipment is received, NifiNiFi, queries further for the shipment content, performs the correct business logic and posts a shipment to the OpenSRP Server /rest/stockresource/shipment/add endpoint.

      • Content of the shipments will be standardized for the demo from OpenLMIS (Need help from VR on this)

      Business Logic:

      • Nifi NiFi will need to keep a map of OpenSRP facility ID vs OpenLMIS Location ID
      • Nifi NiFi will need to do quality control to ensure shipments only include products that are already hard coded in OpenSRP
      • Nifi NiFi will convert from orderables to Antigen Types and units across the systems. Only the antigen name (i.e. OPV) will be sent to OpenSRP for this
      • Nifi NiFi will need to develop a standardized JSON payload that can be easily parsed by the client.

      ...