UPDATE EVENTS ARCHIVE

From Agri4castWiki
Jump to: navigation, search


Introduction

The procedure UPDATE_EVENTS_ARCHIVE is a part of the PMB. It supplies the interface to signal the PMB about the appearance of a certain event. Essentially, it is used to signal the successful completion of a step in an automated production line.

Interface

The function update_events_archive is installed in the database schema PMB. It uses parameters as listed in next table.


parameter type remarks
<return value> (varchar2) CLOB a message containing 'OK' if the event was successfully logged, otherwise an empty string.
pEVENT_ID varchar2 the identifier of the event type for which an event is reported. See table PMB.EVENTS for a list of valid event types.
pOBSERVATION_DATE varchar2 Date of the processed data in this step. format: 'YYYY-MM-DD'. See the oracle formatting of dates for details
pDELIVERY_TIME varchar2 Date and time that the data were succesfully processed in this step. format: 'YYYY-MM-DD HH24:MI:SS'. See the oracle formatting of dates for details


Normally it returns the message: '<status>OK</status>'. In some cases, e.g. as in observation date is invalid, or delivery date is in the future, it adds also an item to the table LOG_EVENTS_ARCHIVE_ERRORS, also located in the schema PMB.

Example

As an example, the call to PMB.UPDATE EVENTS ARCHIVE is presented as included in the code of CMETEO, after completion of the aggregation:

    l_result := pmb.update_events_archive
      ( pevent_id         => g_event_id  -- see table PMB.EVENTS for a list of valid ID's.
      , pobservation_date => to_char(v_dd_start, 'yyyy-mm-dd')  -- date in de processed data
      , pdelivery_time    => to_char(v_now, 'yyyy-mm-dd hh24:mi:ss')
      , premark           => p_procedure||' '||p_theme  -- here, the procedure is 'cmeteo'. See [[CMETEO]] for details of the theme
      );
    add_process_log('Info: '||l_result,1,p_procedure||'.sent_process_completed (3)');