HOW TO DYNAMICALLY CAST AN OBJECT IN SAP ABAP

There are two main issues while casting an object dynamically.

  1. If the target object is an abstract super class, then we cannot use CREATE OBJECT lr_super_abstract TYPE REF TO (lv_super_abstract_class_name). Here lv_super_abstract_class name is ‘ZCL_SUPER_ABSTRACT_CLASS’
  2. We cannot use field symbol to do this object casting dynamically.

METHODS object_casting IMPORTING ir_zcl_sub_class TYPE REF TO zcl_sub_class.

METHOD object_casting.

DATA lv_super_abstract_class_name TYPE STRING VALUE ‘ZCL_SUPER_ABSTRACT_CLASS’.

DATA lr_super_abstract_class TYPE REF TO DATA.

CREATE DATA lr_super_abstract_class TYPE REF TO (lv_super_abstract_class_name).

lr_super_abstract_class->* ?= ir_zcl_sub_class.

WRITE:/ ‘ our super abstract class is casted dynamically and its object instance is successfully stored in the reference variable lr_super_abstract_class’

ENDMETHOD.

Note: please don’t use ->* to use the instance object. instance use directly lr_super_abstract_class.

How to do Corona Test on Patient USING SAP ABAP

Introduction:

 This Corona test application is used to test the critical values of the patient. With the help of this application, one can figure out if the patient has Corona Virus. The critical laboratory parameters of the Corona Virus are controlled using the Administrator user interface. The virus details can also be stored in this application. The corona virus symptoms and the patient symptoms are compared in this program. The patient personal details are also entered in this Application.

Data Dictionary:

The first and foremost step in building any application is understanding the type of data involved in the program. The corona virus must be differentiated from other types of virus. Each virus is unique, and it needs to be differentiated using an Id and description. The critical Laboratory parameters of the corona virus in the patient are WBC values, … These parameters must be uniquely identified using an Id, name. Its value determines whether the patient has Corona virus. The lower limit and higher limit of the Laboratory parameters are critical in detecting the corona virus. The symptoms of the corona virus are tracked in the symptom Id and description.

It can be uniquely identified using Id number. So every main entity here has an Id. For example, the entities such as virus, symptom, patient has an unique Id. The following table shows the properties of each entity.

VirusSymptomPatientVirus lab parameter
Virus Id Virus DescriptionSymptom Id Symptom DescriptionPatient Id Patient name Patient age Patient addressParameter Id Parameter name Parameter Critical values

We have successfully identified the critical data in our corona test application. Now we have to Build the ABAP Data Dictionary using the critical data.

Let us create the following Data elements.

  1. Virus entity
  2. Virus Id – ZDE_Virus_Id – > Datatype – Numc03
  3. Virus Description – ZDE_Virus_desc -> Datatype – String
  4. Virus Symptoms
  5. Symptom Id – ZDE_Symptom_Id – Domain -> Numc03 Datatype
  6. Symptom Description – ZDE_Symptom_desc -> Datatype – String
  7. Patient Entity
  8. Patient Id – ZDE_Patient_Id -> Datatype – Numc03
  9. Patient Age – ZDE_Patient_age -> Datatype – Numc02
  10. Patient Name – ZDE_Patient_name -> Datatype – String
  11. Patient Address – ZDE_Patient_address -> Datatype – String
  12. Virus Lab Parameter
  13. Parameter Id – ZDE_Parameter_Id -> Datatype – Numc03
  14. Parameter name – ZDE_Parameter_name -> Datatype – String

Let us now create the following Data tables.

  1. ZTT_Virus_DB => Data table

Field 1 à Virus_Id => ZDE_Virus_Id

Field 2 à Virus_description => ZDE_Virus_desc

  • ZTT_Symptoms => Data table

Field 1 à Symptom_Id => ZDE_Symptom_Id

Field 2 à Symptom_description => ZDE_Symptom_desc

  • ZTT_Patient => Data table

Field 1 àPatient_Id => ZDE_Patient_Id

Field 2 à Patient_name => ZDE_Patient_name

Field 3 à Patient_age => ZDE_Patient_age

Field 4 à Patient_address => ZDE_Patient_address

  • ZTT_Lab_Parameter => Data table

Field 1 àLab_para_Id => ZDE_lab_para_Id

Field 2 à Lab_para_name => ZDE_lab_para_name

Field 3 à Lab_para_low_value => ZDE_lab_para_low_value

Field 4 à Lab_para_high_value => ZDE_lab_para_high_value

Object oriented Branch details

        I.            First branch

First Branch in creating the object-oriented model for corona test application.

     II.            Second Branch

Second branch in the corona test application for the corona symptoms.

    III.            Third Branch

Third Branch in the corona test application for the patient details.

   IV.            Fourth Branch

Fourth Branch for the patient lab test values.

Description of Interfaces and methods.

Interface: One of the key concepts which can be considered as the Skeleton of the object oriented model. Let us consider the following interfaces to implement the corona test application.

  1. ZIF_VIR_DETAILS
  2. ZIF_LAB_ATTRIBUTE_NAME
  3. ZIF_LAB_ATTRIBUTE_VALUE
  4. ZIF_SYMPTOMS
  5. ZIF_PATIENT

Now, Let us look at the definition of each Interfaces.

  1. INTERFACE zif_vir_details

PUBLIC.

METHODS set_vir_details

IMPORTING i_virus_id TYPE zde_virus_id

           i_virus_desc TYPE zde_virus_desc.

METHODS get_vir_details

IMPORTING i_virus_id TYPE zde_virus_id

EXPORTING e_virus_desc TYPE zde_virus_desc.

ENDINTERFACE.

  1. INTERFACE zif_lab_attribute_name

PUBLIC .

METHODS set_attribute_name

IMPORTING i_lab_attribute_name TYPE zde_parameter_name              

                       i_lab_attribute_id TYPE zde_parameter_id

           i_virus_id TYPE zde_virus_id.

METHODS get_attribute_name

IMPORTING i_lab_attribute_id TYPE zde_parameter_id

i_virus_id TYPE zde_virus_id

EXPORTING e_lab_attribute_name TYPE zde_paramete_name.

ENDINTERFACE.

  1. INTERFACE zif_lab_attribute_value

PUBLIC.

METHODS set_lab_attribute_value

IMPORTING i_lab_attribute_id TYPE zde_parameter_id

i_virus_id TYPE zde_virus_id

i_lab_para_low_value TYPE ZDE_lab_para_low_value

i_lab_para_high_value TYPE ZDE_lab_para_high_value.

METHODS get_lab_attribute_value

IMPORTING i_lab_attribute_id TYPE zde_parameter_id

EXPORTING e_lab_para_value TYPE int4

ENDINTERFACE.

  1. INTERFACE ZIF_SYMPTOMS

PUBLIC.

METHODS set_symptoms

IMPORTING i_symptom_id TYPE zde_symptom_id

           i_symptom_desc TYPE zde_symptom_desc.

METHODS get_symptoms.

EXPORTING et_symptoms TYPE ztt_symptom_ty.

ENDINTERFACE.

INTERFACE zif_patient

PUBLIC.

METHODS set_patient_details

IMPORTING i_patient_id TYPE zde_patient_id

           i_patient_name TYPE zde_patient_name

           i_patient_age TYPE num02

                      i_patient_address TYPE zde_patient_address.

METHODS get_patient_details

IMPORTING i_patient_id TYPE zde_patient_id

EXPORTING e_patient_name TYPE zde_patient_name

e_patient_age TYPE num02

e_patient_address TYPE zde_patient_address.

METHODS set_patient_symptoms

IMPORTING i_symptom_desc TYPE zde_symptom_desc

i_patient_id TYPE zde_patient_id.

METHODS get_patient_symptoms.

IMPORTING i_patient_id TYPE zde_patient_id

EXPORTING et_symptom_desc TYPE ztt_symptom_desc.

METHODS set_patient_lab para_values.

IMPORTING i_patient_id TYPE zde_patient_id

i_lab_para_id TYPE zde_parameter_id

i_lab_para_value TYPE int4.

METHODS get_patient_lab_para_values.

IMPORTING i_patient_id TYPE zde_patient_id   

                       i_lab_para_id TYPE zde_parameter_id

EXPORTING e_lab_para_value TYPE int4.

ENDINTERFACE.

Now we have discussed about the data, Data tables, Object branches, skeleton of the system (Interface).

User Interface

The front end helps us to understand the whole process easily. So lets begin with the user interface for the virology expert team.

User Interface for Virology expert Team

Figure 1 Admin User Interface

The user interface depicts the input elements of the virus information systems. The data which is entered in these textboxes, must be stored in the Database.

Classes and objects

The data from the user interface elements are passed through the classes and objects. These Sar_Covid 19, virus lab parameters, lab limits objects carry the data from the user interface and insert the data into the database. The very next step would be to create objects. Now we will investigate the creation of these classes. We discussed about the different object oriented branches in the beginning. Now we will look in detail about the code for each of these branches.

Picture below depicts the different classes between the UI and Database.

Figure 2 Virus Branch

First Object oriented branch for virus data

Now let’s see the code directly in the above classes.

a)      zcl_Sars_Covid_19

CLASS zcl_sars_covid_19 DEFINITION

 PUBLIC

ABSTRACT CREATE PUBLIC.

PUBLIC SECTION.

 INTERFACES zif_vir_details.

INTERFACES zif_lab_attribute_name.

 INTERFACES zif_lab_attributevalue.

INTERFACES zif_symptoms.

METHODS constructor

IMPORTING i_virus_id TYPE zde_virus_id

i virus_desc TYPE zdevirusdesc.

PROTECTED SECTION.

DATA m_virus_id TYPE zde_virus_id.

DATA m_virus_desc TYPE zde_virusdesc.

PRIVATE SECTION.

ENDCLASS.

CLASS zcl_sars_covid_19 IMPLEMENTATION.

METHOD constructor.

m_virus_id = i_virus_id.

m_virus_desc = i_virus_desc.

ENDMETHOD.

METHOD zif_vir_details~set_vir_details.

ENDMETHOD.

METHOD zif_virdetails~getvirdetails.

ENDMETHOD.

METHOD zif_labattribute_name~set_attribute_name.

ENDMETHOD.

METHOD zif_lab_attribute_name~get_attributename.

ENDMETHOD.

METHOD zif_lab_attribute_value-set_lab_attribute_value.

ENDMETHOD.

 METHOD zif_lab_attribute_value~get_lab_attributevalue.

ENDMETHOD.

METHOD zif_symptoms~set_symptoms.

ENDMETHOD.

METHOD zif_symptoms~get_symptoms.

ENDMETHOD.

ENDCLASS.

b)     zcl_virus_lab_parameters

CLASS zcl_virus_lab_parameters DEFINITION INHERITING FROM zcl_sars_covid_19

PUBLIC ABSTRACT

CREATE PUBLIC.

PUBLIC SECTION.

 METHODS zif_lab_attribute_name~set_attribute_name REDEFINITION. METHODS zif_lab_attribute_name~get_attribute_name REDEFINITION. METHODS constructor

IMPORTING i_virus_id TYPE zde_virus_id

i_virus_desc TYPE zde_virus_desc

i_lab_para_id TYPE zde_lab_para_id

i_lab_para_name TYPE zde_lab_para_name.

PROTECTED SECTION.

DATA m_lab_para_id TYPE zde_lab_para_id.

DATA m_lab_para_name TYPE zde_lab_para_name.

PRIVATE SECTION.

ENDCLASS.

CLASS zcl_virus_lab_parameters IMPLEMENTATION.

METHOD constructor.

 super->constructor( i_virus_id = i_virus_id

   i_virus_desc = i_virus_desc ).

m_lab_para_id = i_lab_para_id.

m_lab_para_name = i_lab_para_name.

ENDMETHOD.

METHOD zif_lab_attribute_name~set_attribute_name.

DATA lt_lab_parameters TYPE STANDARD TABLE OF ztt_lab_para.

DATA ls_lab_parameters LIKE LINE OF lt_lab_parameters.

ls_lab_parameters-parameter_id = i_lab_attribute_id.

ls_lab_parameters-parameter_name = i_lab_attribute_name.

ls_lab_parameters-virus_id = i_virus_id.

SELECT SINGLE * FROM ztt_lab_para INTO ls_lab_parameters WHERE  

                                                           parameter_id = i_lab_attribute_id.

IF sy-subrc <> O.

INSERT INTO ztt_lab_para VALUES ls_lab_parameters.

ENDIF.

ENDMETHOD.

METHOD zif_lab_attribute_name~get_attribute_name.

DATA lt_lab_parameters TYPE STANDARD TABLE OF ztt_lab_para.

FIELD-SYMBOLS <fs_param> LIKE LINE OF lt_lab_parameters.

SELECT * FROM ztt_lab_para INTO TABLE lt_lab_parameters WHERE

Parameter_id = i_lab_attribute_id AND virus id = i_virus_id.

IF sy-subrc = 0.

READ TABLE lt_lab_parameters INDEX 1 ASSIGNING <fs_param>.

IF sy-subrc = 0.

e_lab_attribute_name = <fs_param>-parameter_name.

     ENDIF.

            ENDIF.

ENDMETHOD.

ENDCLASS.

c)      Zcl_lab_limits

CLASS zcl_lab_limits DEFINITION INHERITING FROM zcl_virus_lab_parameters

PUBLIC ABSTRACT

CREATE PUBLIC .

PUBLIC SECTION.

METHODS zif_lab_attribute_value~set_lab_attribute_value REDEFINITION. METHODS zif_lab_attribute_value~get_lab_attribute_value REDEFINITION. METHODS constructor

IMPORTING i_virus_id TYPE zde_virus_id

i_virus_desc TYPE zde_virus_desc

i_lab_para_id TYPE zde_parameter_id

i_lab_para_name TYPE zde_parameter_name

i_lab_para_low_value TYPE int4

i_lab_para_high_value TYPE int4.

PROTECTED SECTION.

DATA m_lab_para_low_value TYPE int4.

DATA m_lab para_bigh_value TYPE int4.

PRIVATE SECTION.

ENDCLASS.

CLASS zcl_lab_limits IMPLEMENTATION.

METHOD constructor.

super->constructor( i_virus_id = i_virus_id

i_virus_desc = i_virus_desc

i_lab_para_id = i_lab_para_id

i_lab_para_name = i_lab_para_name).

m_lab_para_low_value = i_lab_para_low_value.

m_lab_para_high_value = i_lab_para_high_value.

ENDMETHOD.

METHOD zif_lab_attribute_value~set_lab_attribute_value.

DATA lt_lab_para_values TYPE STANDARD TABLE OF ztt_lab_para_val. DATA lt_lab_para_values LIKE LINE OF lt_lab_para_values.

DATA lt_lab_para TYPE STANDARD TABLE OF ztt_lab_para.

DATA ls_lab_para LIKE LINE OF lt_lab_para.

SELECT SINGLE * FROM ztt_lab_para INTO Is_lab_para WHERE

                                                   parameter_id = i_lab_attribute_id.

IF sy-subrc = 0.

is_lab_para_values-parameter_name = ls_lab_para-parameter_name. is_lab_para_values-parameter_id = ls_lab_para-parameter_id. is_lab_para_values-para_low_value = i_lab_para_low_value. ls_lab_para_values-para_high_value = i_lab_para_high_value.

                        ENDIF.

INSERT INTO ztt_lab_para_val VALUES lt_lab_para_values. ENDMETHOD.

METHOD zif_lab_attribute_value~get_lab_attribute_value.

DATA lt_lab_para_values TYPE STANDARD TABLE OF ztt_lab_para_val. FIELD-SYMBOLS <fs_param> LIKE LINE OF lt_lab_para_values.

SELECT * FROM ztt_lab_para_val INTO TABLE lt_lab_para_values  

                                       WHERE parameter_id = i_lab_attribute_id.

IF sy-subrc = 0.

      READ TABLE lt_lab_para_values INDEX 1 ASSIGNING <fs_param>.

      IF sy-subrc = 0.

e_lab_para_low_value = <fs_param>-para_low_value. e_lab_para_high_value = <fs_param>-para_high_value.

     ENDIF.

ENDIF.

ENDMETHOD.

ENDCLASS.

d)     Zcl_viro_expert

CLASS zcl_viro_expert DEFINITION INHERITING FROM zcl_lab_limits

PUBLIC FINAL

CREATE PUBLIC .

PUBLIC SECTION.

METHODS zif_vir_details~set_vir_details REDEFINITION.

METHODS zif_vir_details~get_vir_details REDEFINITION.

METHODs constructor

IMPORTING i_virus_id TYPE zde_virus_id

i_virus_desc TYPE zde_virus_desc

i_lab_para_id TYPE zde_parameter_id

i_lab_para_name TYPE zde_parameter_name

i_lab_para_low value TYPE int4

i_lab_para_high_value TYPE int4.

METHODS set_all_virus_values.

PROTECTED SECTION.

PRIVATE SECTION.

ENDCLASS.

CLASS zcl_viro_expert IMPLEMENTATION.

METHOD constructor.

super->constructor( i_virus_id= i_virus_id

        i_virus_desc = i_virus_desc

        i_lab_para_id = i_lab_para_id

        i_lab_para_name = i_lab_para_name

        i_lab_para_low_value = i_lab_para_low_value

        i_lab_para_high_value = i_lab_para_high_value ).

ENDMETHOD.

METHOD set_all_virus_values.

zif_vir_details~set_vir_details( i_virus_id = m_virus_id

   i_virus_desc = m_virus_desc ).

zif_lab_attribute_name~set_attribute_name(

i_lab_attribute_id = m lab_para_id

i_lab_attribute_name = m_lab_para_name

i_virus_id = m_virus_id ).

zif_lab_attribute_value~set_lab_attribute_value(

i_lab_attribute_id = m_lab_para_id

i_virus_id = m virus_id

i_lab_para_low value = m_lab_para_low_value

i_lab_para_high_value = m_lab_para_high_value ).

ENDMETHOD.

METHOD zif_vir_details~set_vir_details.

DATA lt_virus TYPE STANDARD TABLE OF ztt_virus_db.

DATA is_virus LIKE LINE OF lt_virus.

is_virus-virus_id = i_virus_id.

ls_virus-virus_desc = i_virus_desc.

SELECT * FROM ztt_virus_db INTO table lt_virus WHERE virus_id = i_virus_id.

IF sy-subrc <> 0.

INSERT INTO ztt_virus_db VALUES ls_virus.

      ENDIF.

ENDMETHOD.

METHOD zif_vir_details~get_vir_details.

DATA lt_virus_db TYPE STANDARD TABLE OF ztt_virus_db.

FIELD-SYMBOLS <fs_vir> LIKE LINE OF lt_virus_db.

SELECT * FROM ztt_virus_db INTO TABLE lt_virus_db WHERE

virus_id = i_virus_id.

IF sy-subrc = 0.

READ TABLE lt_virus_db ASSIGNING <fs_vir> INDEX 1.

E_virus_desc = <fs_vir>-virus_desc.

ENDIF.

ENDMETHOD.

ENDCLASS.

Second Branch to handle the corona virus symptoms.

Key Member VariablesClass HierarchyDefinition
Virus_Id Virus_descZCL_Sars_Covid_19PUBLIC ABSTRACT
Symptom_IdZCL_SymptomsPUBLIC
 ZCL_Med_ExpertPUBLIC

a)      Zcl_sars_covid_19

This class creation is already discussed in the first branch

b)     Zcl_symptoms

CLASS zcl_symptoms DEFINITION INHERITING FROM zcl_sars_covid_19

 PUBLIC

 CREATE PUBLIC .

 PUBLIC SECTION.

  METHODS zif_symptoms~set_symptoms REDEFINITION.

  METHODS zif_symptoms~get_symptoms REDEFINITION.

 PROTECTED SECTION.

 PRIVATE SECTION.

 ENDCLASS.

CLASS zcl_symptoms IMPLEMENTATION.

 METHOD zif_symptoms~set_symptoms.

  DATA it_symptoms TYPE STANDARD TABLE OF ztt_symptom.

  DATA is_symptoms LIKE LINE OF lt_symptoms.

  SELECT * FROM ztt_symptom INTO TABLE lt_symptoms WHERE virus_id = m_virus_id AND symptom_id = i_symptom_id.

  IF sy-subrc <> 0.

   ls_symptoms-virus_id = m_virus_id.

   ls_symptoms-symptom_id = i_symptom_id.

   ls_symptoms-symptom_desc = i_symptom_desc.

   INSERT INTO ztt_symptom VALUES ls_symptoms.

  ENDIF.

 ENDMETHOD.

 METHOD zif_symptoms~get_symptoms.

  DATA lt_symptoms TYPE STANDARD TABLE OF ztt_symptom.

  SELECT * FROM ztt_symptom INTO table lt_symptoms WHERE virus_id = m_virus_id.

  LOOP AT lt_symptoms into DATA(ls_symptoms).

    APPEND ls_symptoms TO et_symptoms.

  ENDLOOP.

 ENDMETHOD.

ENDCLASS.

c)      Zcl_med _expert

CLASS zcl_med_expert DEFINITION PUBLIC INHERITING FROM zcl_symptoms

FINAL CREATE PUBLIC .

PUBLIC SECTION.

PROTECTED SECTION.

PRIVATE SECTION.

ENDCLASS.

CLASS zcl_med_expert IMPLEMENTATION.

ENDCLASS.

User interface for the corona virus symptoms

Figure 3 Corona Virus Symptoms

Third Branch for patient details and patient corona symptoms

Key AttributesClass HierarchyDescription
 ZCL_PatientPUBLIC ABSTRACT
 ZCL_Patient_DetPUBLIC
 ZCL_Patient_SymptomPUBLIC
  1. Zcl_patient

CLASS zcl_patient DEFINITION

 PUBLIC

 abstract

 CREATE PUBLIC .

 PUBLIC SECTION.

  INTERFACES zif_patient.

  METHODS constructor.

 PROTECTED SECTION.

 PRIVATE SECTION.

ENDCLASS.

CLASS zcl_patient IMPLEMENTATION.

 METHOD constructor.

 ENDMETHOD.

 METHOD zif_patient~get_patient_details.

 ENDMETHOD.

 METHOD zif_patient~get_patient_symptoms.

 ENDMETHOD.

 METHOD zif_patient~set_patient_details.

 ENDMETHOD.

 METHOD zif_patient~set_patient_symptoms.

 ENDMETHOD.

 METHOD zif_patient~set_patient_lab_para_values.

 ENDMETHOD.

 METHOD zif_patient~get_patient_lab_para_values.

 ENDMETHOD.

ENDCLASS.

  • Zcl_patient_det

CLASS zcl_patient_det DEFINITION INHERITING FROM zcl_patient

PUBLIC

CREATE PUBLIC .

PUBLIC SECTION.

METHODS zif_patient~set_patient_detalis REDEFINITION.

METHODS zif_patient~get_patient_details REDEFINITION.

PROTECTED SECTION.

PRIVATE SECTION.

ENDCLASS.

CLASS zcl_patient_det IMPLEMENTATION.

METHOD zif_patient~set_patient_details.

DATA it_patient TYPE STANDARD TABLE OF ztt_patient_det.

DATA ls_patient LIKE LINE OF it_patient.

ls_patient-patient_id = i_patient_id.

ls_patient-patient_name = i_patient_name.

ls_patient-patient_age = i_patient_age.

ls_patient-patient_address = i_patient_address.

SELECT * FROM ztt_patient_det INTO TABLE it_patient WHERE patient_id = i_patient_id.

IF sy-subrc <> 0.

            INSERT INTO ztt_patient_det VALUES ls_patient.

ENDIF.

ENDMETHOD.

METHOD zif_patient~get_patient_details.

DATA lt_patient TYPE STANDARD TABLE OF ztt_patient_det.

FIELD-SYMBOLS <fs_patient> LIKE LINE OF lt_patient.

SELECT * FROM ztt_patient_det INTO TABLE it_patient WHERE patient_id = i_patient_id.

IF sy-subrc = 0.

READ TABLE it_patient ASSIGNING <fs_patient> INDEX 1.

e_patient_name = <fs_patient>-patient_name.

e_patient_age = <fs_patient>-patient_age.

e_patient_address = <fs_patient>-patient_address.

ENDIF.

ENDMETHOD.

ENDCLASS.

Figure 4 User interface for Patient Details

  • Zcl_patient_symptom

CLASS zcl_patient_symptom DEFINITION INHERITING FROM zcl_patient_det

PUBLIC

CREATE PUBLIC .

PUBLIC SECTION.

METHODS zif_patient~set_patient_symptoms REDEFINITION.

METHODS zif_patient~get_patient_symptoms REDEFINITION.

PROTECTED SECTION.

PRIVATE SECTION.

ENDCLASS.

CLASS zcl_patient_symptom IMPLEMENTATION.

METHOD zif_patient~get_patient_symptoms.

DATA lt_patient_sym TYPE STANDARD TABLE OF ztt_patient_sym.

DATA ls_patient_sym LIKE LINE OF lt_patient_sym.

DATA lt_symptom TYPE STANDARD TABLE OF ztt_symptom.

SELECT * FROM ztt_patient_sym INTO TABLE lt_patient_sym WHERE patient_id = i_patient_id.

IF sy-subrc = 0.

LOOP AT lt_patient_sym INTO ls_patient_sym.

            SELECT * FROM ztt_symptom INTO TABLE lt_symptom WHERE symptom_id = ls_patient_sym-symptom_id.

            LOOP AT lt_symptom INTO DATA(ls_symptom).

                        APPEND ls_symptom-symptom_desc TO et_symptom_desc.

            ENDLOOP.

ENDLOOP.

ENDIF.

ENDMETHOD.

METHOD zif_patient~set_patient_symptoms.

DATA lt_patient_sym TYPE STANDARD TABLE OF ztt_patient_sym.

DATA is_patient_sym LIKE LINE OF lt_patient_sym.

DATA it_symptom TYPE STANDARD TABLE OF ztt_symptom.

DATA 1_max TYPE num02.

SELECT * FROM ztt_symptom INTO TABLE lt_symptom WHERE symptom_desc LIKE i_symptom_desc.

LOOP AT it_symptom INTO DATA(ls_symptom).

ls_patient_sym-patient_id = i_patient_id.

ls_patient_sym-symptom_id = ls_symptom-symptom_id.

SELECT MAX( symptom_record ) INTO 1_max FROM ztt_patient_sym WHERE patient_id = i_patient_id.

ls_patient_sym-symptom_record = 1_max + 01.

INSERT INTO ztt_patient_sym VALUES ls_patient_sym.

ENDLOOP.

ENDMETHOD.

ENDCLASS.

Figure 5 Corona Patient Symptoms

Fourth Branch for Corona patient lab values and corona test

Key AttributesClass NameDefinition
 ZCL_PatientPUBLIC ABSTRACT
 ZCL_Patient_Lab_ValuesPUBLIC
 ZCL_Corona_TestPUBLIC FINAL
  1. Zcl_patient

This class is already discussed in the third branch

  • zcl_patient_lab_values

CLASS zcl_patient_lab_values DEFINITION INHERITING FROM zcl_patient

 PUBLIC

 CREATE PUBLIC .

PUBLIC SECTION.

  METHODS zif_patient~set_patient_lab_para_values REDEFINITION.

  METHODS zif_patient~get_patient_lab_para_values REDEFINITION.

PROTECTED SECTION.

PRIVATE SECTION.

ENDCLASS.

CLASS zcL_patient_lab_values IMPLEMENTATION.

METHOD zif_patient~set_patient_lab_para_values.

 DATA lt_patient_lab TYPE STANDARD TABLE OF ztt_patient_lab.

 DATA ls_patient_lab LIKE LINE OF lt_patient_lab.

 ls_patient_lab-patient_id = i_patient_id.

 ls_patient_lab-lab_para_id = i_lab_para_id.

 ls_patient_lab-pati_lab_para_value = i_lab_para_value.

 SELECT * FROM ztt_patient_lab INTO TABLE lt_patient_lab WHERE patient_id = i_patient id AND lab_para_id = i_lab_para_id.

 IF sy-subrc <> 0.

  INSERT INTO ztt_patient_lab VALUES ls_patient_lab.

 ENDIF.

ENDMETHOD.

METHOD zif_patient~get_patient_lab_para_values.

 DATA lt_patient_lab TYPE STANDARD TABLE OF ztt_patient_lab.

 FIELD-SYMBOLS <fs_patient_lab> LIKE LINE OF lt_patient_lab.

 SELECT * FROM ztt_patient_lab INTO TABLE lt_patient_lab WHERE patient_id = i_patient_id AND lab_para_id = i_lab_para_id.

 IF sy-subrc = 0.

  READ TABLE lt_patient_lab ASSIGNING <fs_patient_lab> INDEX 1.

  e_lab_para_value = <fs_patient_lab>-pati_lab_para_value.

  ENDIF.

ENDMETHOD.

ENDCLASS.

Figure 6 Patient Lab Values

  • Zcl_corona_test

CLASS zcl_corona_test DEFINITION INHERITING FROM zcl_patient_lab_values

 PUBLIC

 FINAL

 CREATE PUBLIC .

 PUBLIC SECTION.

  METHODS get_patient_object EXPORTING rr_patient TYPE REF TO zif_patient.

  METHODS check_patient_symptoms IMPORTING i_patient_id TYPE zde_virus_id    EXPORTING e_corona_symptom TYPE abap_bool.

  METHODS get_patient_corona_test IMPORTING i_patient_id TYPE zde_virus_id    RETURNING VALUE(e_patient_corona_test) TYPE abap_bool.

  METHODS check_lab_value IMPORTING i_patient_lab_value TYPE int4 i_lab_para_id TYPE zde_virus_id RETURNING VALUE(r_wbc_critical) TYPE abap_bool.

 PROTECTED SECTION.

 PRIVATE SECTION.

ENDCLASS.

CLASS zcl_corona_test IMPLEMENTATION.

 METHOD get_patient_object.

  rr_patient = NEW zcl_patient_symptom( ).

 ENDMETHOD.

 METHOD check_patient_symptoms.

  get_patient_object( IMPORTING rr_patient = DATA(lr_patient) ).

  lr_patient->get_patient_symptoms( EXPORTING i_patient_id = i_patient_id IMPORTING et_symptom_desc = DATA(lt_symptom_desc) ).

  IF lines( lt_symptom_desc ) > 2.

  e_corona_symptom = abap_true.

  ELSE.

  e_corona_symptom = abap_false.

  ENDIF.

 ENDMETHOD.

Business Logic:

METHOD get_patient_corona_test.

 DATA(lr_patient) = NEW zcl_patient_lab_values( ).

 lr_patient->zif_patient~get_patient_lab_para_values( EXPORTING i_patient_id = i_patient_id i_lab_para_id = ‘500’

                                                                             IMPORTING e_lab_para_value = DATA(l_wbc_value) ).

 lr_patient->zif_patient~get_patient_lab_para_values( EXPORTING i_patient_id = i_patient_id i_lab_para_id = ‘501’

                                                                            IMPORTING e_lab_para_value = DATA(l_neu_value) ).

 lr_patient->zif_patient~get_patient_lab_para_values( EXPORTING i_patient_id = i_patient_id i_lab_para_id = ‘502’

                                                                             IMPORTING e_lab_para_value = DATA(l_lym_value) ).

 lr_patient->zif_patient~get_patient_lab_para_values( EXPORTING i_patient_id = i_patient_id i_lab_para_id = ‘503’

                                                                 IMPORTING e_lab_para_value = DATA(1_ast_value) ).

 IF check_lab_value( i_patient_lab_value = l_wbc_value i_lab_para_id = ‘500’) = abap_true

  AND

  check_lab_value( i_patient_lab_value = l_neu_value i_lab_para_id = ‘501’) = abap_true

  AND

  check_lab_value( i_patient_lab_value = l_lym_value i_lab_para_id = ‘502’) = abap_true

  AND

  check_lab_value( i_patient_lab_value = l_ast_value i_lab_para_id = ‘503’) = abap_true.

  e_patient_corona_test = abap_true.

 else.

  e_patient_coron7test = abap_false.

 endif.

 ENDMETHOD.

Business rule

METHOD check_lab_value.

 DATA(lr_lab_para) = NEW zcl_viro_expert( i_virus_id = 001

                                                             i_virus_desc = ‘ ‘

                                                             i_lab_para_id = i_lab_para_id

                                                             i_lab_para_name = ‘ ‘

                                                             i_lab_para_low_value = ‘ ‘

                                                             i_lab_para_high_value =’ ‘ ).

 lr_lab_para->zif_1ab_attribute_value—get_lab_attribute_value(

                                                EXPORTING i_1ab_attribute_id = i_lab_para_id

                                                IMPORTING e_lab_para_low_value = DATA(l_lab_para_low_value)

                                                e_lab_para_high_value = DATA(l_lab_para_high_value)

  IF i_patient_lab_value >= l_lab_para_low_value AND

    i_patient_lab_value <= 1_1ab_para_high_value.

   r wbc_critical = abap_true.

  ENDIF.

 ENDMETHOD.

ENDCLASS.

Button click events:

The picture below shows button click events which occurs in the user interface.

The below code is used to take the input values of the corona test from the user interface elements of the application.

REPORT zvir_program.

DATA lr_virus TYPE REF TO zcl_viro_expert.

DATA lr_med_expert TYPE REF TO zcl_med_expert.

DATA lr_corona_test TYPE REF TO zcl_corona_test.

DATA lr_patient_det TYPE REF TO zcl_patient_det.

DATA lr_patient TYPE REF TO zif_patient.

lr_virus = NEW zcl_viro_expert( i_virus_id = 001

                                               i_virus_desc = ‘SARS COVID 19’

                                               i_lab_para_id = 500

                                               i_lab_para_name =

                                               i_lab_para_value = 3000 ).

1r_med_expert = NEW zcl_med_expert( i_virus_id = 001 i_virus_desc = ‘SARS COVID 19’ ).

lr_med_expert->zif_symptoms~set_symptoms( i_symptom_id = 200 i_symptom_desc = ‘Fever’ ).

lr_corona_test = NEW zcl_corona_test( ).

lr_corona_test->get_patient_object( IMPORTING rr_patient = lr_patient ).

1r_patient->set_patient_details( i_patient_id = 300

                                                i_patient_age = 31

                                                i_patient_name = ‘Mahesh’

                                                i_patient_address = ‘No.22 old madras road’ ).

lr_patient->set_patient_symptoms( i_patient_id = 300 i_symptom_desc = ‘Fever’).

lr_coronatest->zif_patient~set_patient_lab_para_values( i_patient_id = 300

                                                                                   i_lab_para_id = 500

                                                                                   i_lab_para_value = 6800 ).

DATA(r_corona_test_result) = lr_corona_test->get_patient_corona_test( i_patient_id = 300 ).

if r_corona_test_result = abap_true.

            WRITE: / ‘Patient corona test is positive’.

else.

            write: / ‘Patient corona test is negative’.

endif.

Conclusion:

The developed Corona test application is used to test the Critical Medical parameters of the patient. The Corona Symptoms are compared to the patient symptoms. The corona test is evaluated based on the values of the laboratory parameters. The different Laboratory parameter can also be administered centrally in the system.

How to create different SARS COVID variants in SAP ABAP

Required Elements in creating the classifications.

  • Structure – It includes the details such as variant id, variant name, amino acid changes, potential, spread.
  • Interface Definition – The variant details of the sars covid 2 will be handled here.
  • Abstract super class definition – This class implements the interface. The constructor is used to set the details of the variant.
  • Sars covid variant 1 sub class definition – It inherits the Abstract super class definition.
  • Report creation – It creates the instances of the sars covid 2 variant.

Structure definition:

Before creating the structure, let’s define the Data elements for the fields of the structure. All the fields of the structure can be defined with string type of data element. The variant can be identified with the key element as variant id.Let’s create a data element as ‚ZDE_Variant_string‘ with string type domain. Another Data element ZDE_VARIANT_ID with int4 type domain.

Let’s define the structure name ‚ZSVARIANT_DETAILS‘ with description

The fields of the structure are created as shown below.

  • Field = Variant_id , Data element = ZDE_VARIANT_ID, Domain type INT4
  • Field = Variant_name, Data element = ZDE_VARIANT_STRING, Domain type STRING
  • Field = amino acid changes, Data element = ZDE_VARIANT_STRING, Domain type STRING
  • Field = Potential, Data element = ZDE_VARIANT_STRING, Domain type STRING
  • Field = Spread, Data element = ZDE_VARIANT_STRING, Domain type STRING

Interface definition:

INTERFACE zif_sars_covid_2_variants

    PUBLIC.

METHODS get_variant_details EXPORTING es_variant_details TYPE zsvariant_details.

ENDINTERFACE.

Abstract super class definition and implementation:

CLASS zcl_sars_covid_2 DEFINITION.

    PUBLIC

    ABSTRACT

    CREATE PUBLIC.

     PUBLIC SECTION.

                INTERFACES zif_sars_covid_2_variants.

                METHODS constructor IMPORTING is_variant_details TYPE zsvariant_details.

    PROTECTED SECTION.

    PRIVATE SECTION.

                DATA ps_variant_details TYPE zsvariant_details.

ENDCLASS.

CLASS zcl_sars_covid_2 IMPLEMENTATION.

                METHOD zif_sars_covid_2_variants~get_variant_details.

                               Es_variant_details = ps_variant_details.

                ENDMETHOD.

                METHOD constructor.

                               Ps_variant_details = is_variant_details.

                ENDMETHOD.

ENDCLASS.

Sars covid variant 1 sub class definition

CLASS zcl_sars_covid_variant1  DEFINITION

PUBLIC

INHERITING FROM zcl_sars_covid_2

FINAL

CREATE PUBLIC.

PUBLIC SECTION.

PROTECTED SECTION.

PRIVATE SECTION.

ENDCLASS.

CLASS zcl_sars_covid_variant1 IMPLEMENTATION.

ENDCLASS.

REPORT TO CREATE INSTANCES OF THE COVID 2 VARIANTS.

REPORT zpr_sars_covid_program.

DATA lr_variant1 TYPE REF TO zcl_sars_covid_variant1.

DATA lr_variant2 TYPE REF TO zcl_sars_covid_variant1.

DATA lr_variant3 TYPE REF TO zcl_sars_covid_variant1.

DATA lt_variant_details TYPE TABLE OF ztvariant_details.

DATA ls_variant_details TYPE zsvariant_details.

DATA ls_print_variant_details TYPE zsvariant_details.

FIELD-SYMBOLS <lv_field> TYPE any.

Ls_variant_details-variant_id = 001.

Ls_variant_details-variant_name = ‚VOC 202012/01‘.

Ls_variant_details-amino_acid_changes = ‚ S: del 69-70, del 144, N501Y, A570D, P681H, T716I, S982A, D1118H‘‘.

Ls_variant_details-potential = ‚ increased transmissibility‘

Ls_variant_details-spread = ‚ UK and other european countries‘.

Lr_variant1 = NEW zcl_sars_covid_variant1( is_variant_details = ls_variant_details ).

Lr_variant1->zif_sars_covid_2_variants~get_variant_details( IMPORTING

                                                                                              Es_variant_details = ls_print_variant_details ).

WRITE: / ‚Variant ID:‘, ls_print_variant_details-Variant_id.

WRITE:/ ,Variant name:‘, ls_print_variant_details-variant_name.

WRITE:/ ,Amino acid changes:‘, ls_print_variant_details-amino_acid_changes.

WRITE:/ ,Potential:‘, ls_print_variant_details-potential.

WRITE:/ ,Spread:‘, ls_print_variant_details-spread.

Ls_variant_details-variant_id = 002.

Ls_variant_details-variant_name = ‚ 501.V2‘.

Ls_variant_details-amino_acid_changes = ‚S: D80A, D215G, E484K, N501Y and A701V‘.

Ls_variant_details-potential = ,increased transmissibility‘

Ls_variant_details-spread = ‚ South Africa, two cases recently detected in the UK‘.

Lr_variant2 = NEW zcl_sars_covid_variant1( is_variant_details = ls_variant_details ).

Lr_variant2->zif_sars_covid_2_variants~get_variant_details( IMPORTING

                                                                                              Es_variant_details = ls_print_variant_details ).

Ls_variant_details-variant_id = 003.

Ls_variant_details-variant_name = ‚Danish mink variant‘.

Ls_variant_details-amino_acid_changes = ‚ S: del 69-70, Y453F‘.

Ls_variant_details-potential = , Transmission from mink to humans and community spread confirmed without any change in transmissibility‘

Ls_variant_details-spread = ‚ Denmark‘.

Lr_variant3 = NEW zcl_sars_covid_variant1( is_variant_details = ls_variant_details ).

Lr_variant3->zif_sars_covid_2_variants~get_variant_details( IMPORTING

                                                                                              Es_variant_details = ls_print_variant_details ).

WRITE: / ‚Variant ID:‘, ls_print_variant_details-Variant_id.

WRITE:/ ,Variant name:‘, ls_print_variant_details-variant_name.

WRITE:/ ,Amino acid changes:‘, ls_print_variant_details-amino_acid_changes.

WRITE:/ ,Potential:‘, ls_print_variant_details-potential.

WRITE:/ ,Spread:‘, ls_print_variant_details-spread.

References: Covid variant details are taken from below report.

European centre for Disease Prevention and Control: Risk related to spread of new SARSCoV-2 variants of concern in the EU/EEA

How to interpret Inheritance in SAP ABAP object oriented programming

INHERITANCE EXAMPLE

CLASS zcl_big_boss DEFINITION PUBLIC CREATE PUBLIC.

   PUBLIC SECTION.

   METHODS set_name IMPORTING i_name TYPE string.

   METHODS get_name EXPORTING e_name TYPE string.

   METHODS set_age IMPORTING i_age TYPE int4.

   METHODS get_age EXPORTING e_age TYPE int4.

   METHODS set_profession IMPORTING i_profession TYPE string.

   METHODS get_profession EXPORTING e_profession TYPE string.

   PROTECTED SECTION.

   PRIVATE SECTION.

   DATA p_name TYPE string.

   DATA p_age TYPE int4.

   DATA p_profession TYPE string.

ENDCLASS.

CLASS zcl_big_boss IMPLEMENTATION.

METHOD set_name.

  p_name = i_name.

ENDMETHOD.

METHOD get_name.

  e_name = p_name.

ENDMETHOD.

METHOD set_age.

   P_age = i_age.

ENDMETHOD.

METHOD get_age.

   E_age = p_age.

ENDMETHOD.

METHOD set_profession.

   P_profession = i_profession.

ENDMETHOD.

METHOD get_profession.

   E_profession = p_profession.

ENDMETHOD.

ENDCLASS.

CLASS zcl_candidate DEFINITION INHERITING FROM zcl_big_boss

PUBLIC

FINAL

CREATE PUBLIC.

PUBLIC SECTION.

METHODS set_big_boss_charac TYPE string.

METHODS get_big_boss_charac TYPE string.

PROTECTED SECTION.

  DATA pro_big_boss_charac TYPE string.

PRIVATE SECTION.

ENDCLASS.

CLASS zcl_candidate IMPLEMENTATION.

METHOD set_big_boss_charac.

                Pro_big_boss_charac = i_big_boss_charac.

ENDMETHOD.

METHOD get_big_boss_charac.

                e_big_boss_charac = pro_big_boss_charac.

ENDMETHOD.

ENDCLASS.

REPORT TO ACCESS GETTER AND SETTER METHODS.

DATA lr_candidate TYPE REF TO zcl_candidate.

DATA l_name TYPE string.

DATA l_age TYPE int4.

DATA l_profession TYPE string.

DATA l_big_boss_charac TYPE string.

Lr_candidate = NEW zcl_candidate( ).

Lr_candidate->set_name(  EXPORTING i_name = ‚Bala‘ ).

Lr_candidate->set_age( EXPORTING i_age = 24 ).

Lr_candidate->set_profession( EXPORTING i_profession = ‚Model‘ ).

Lr_candidate->set_big_boss_charac( EXPORTING i_big_boss_charac = ‚Open Talk‘ ).

 Lr_candidate ->get_name( IMPORTING e_name = l_name ).

Lr_candidate ->get_age( IMPORTING e_age = l_age ).

Lr_candidate ->get_profession( IMPORTING e_profession = l_profession ).

Lr_candidate->get_big_boss_charac( IMPORTING e_big_boss_charac = l_big_boss_charac ).

WRITE: / ‚NAME OF THE CONTESTANT:‘ , l_name.

WRITE:/ ,AGE OF THE CONTESTANT:‘; l_age.

WRITE:/ ,PROFESSION OF THE CONTESTANT:‘, L_PROFESSION.

WRITE:/ ‚Big boss characteristics‘, l_big_boss_charac

How to do encapsulation in SAP ABAP

CLASS big_boss DEFINITION.

   PUBLIC SECTION.

   METHODS set_name IMPORTING i_name TYPE string.

   METHODS get_name EXPORTING e_name TYPE string.

   METHODS set_age IMPORTING i_age TYPE int4.

   METHODS get_age EXPORTING e_age TYPE int4.

   METHODS set_profession IMPORTING i_profession TYPE string.

   METHODS get_profession EXPORTING e_profession TYPE string.

   PROTECTED SECTION.

   PRIVATE SECTION.

   DATA p_name TYPE string.

   DATA p_age TYPE int4.

   DATA p_profession TYPE string.

ENDCLASS.

CLASS big_boss IMPLEMENTATION.

METHOD set_name.

  p_name = i_name.

ENDMETHOD.

METHOD get_name.

  e_name = p_name.

ENDMETHOD.

METHOD set_age.

   P_age = i_age.

ENDMETHOD.

METHOD get_age.

   E_age = p_age.

ENDMETHOD.

METHOD set_profession.

   P_profession = i_profession.

ENDMETHOD.

METHOD get_profession.

   E_profession = p_profession.

ENDMETHOD.

ENDCLASS.

REPORT TO ACCESS GETTER AND SETTER METHODS.

DATA lr_bigboss TYPE REF TO bigboss.

DATA l_name TYPE string.

DATA l_age TYPE int4.

DATA l_profession TYPE string.

Lr_bigboss = NEW bigboss( ).

Lr_bigboss->set_name(  EXPORTING i_name = ‚Bala‘ ).

Lr_bigboss->set_age( EXPORTING i_age = 24 ).

Lr_bigboss->set_profession( EXPORTING i_profession = ‚Model and Mr. India‘ ).

 Lr_bigboss->get_name( IMPORTING e_name = l_name ).

Lr_bigboss->get_age( IMPORTING e_age = l_age ).

Lr_bigboss->get_profession( IMPORTING e_profession = l_profession ).

WRITE: / ‚NAME OF THE CONTESTANT:‘ , l_name.

WRITE:/ ,AGE OF THE CONTESTANT:‘; l_age.

WRITE:/ ,PROFESSION OF THE CONTESTANT:‘, L_PROFESSION.

In the future we’ll be ‘Data Trash Engineers’.

The next decade will see the emergence of strange new job “data trash engineer” will arrive to replace those made obsolete by robots and automation, but the report’s authors warn that they’ll require society to handle a big shift in education and training. There has been plenty of fear in recent years about the rise of artificial intelligence, with forecasts suggesting that anything from  33 per cent to 50 per cent of certain jobs at risk of being taken over by machines.

In the report, it outlines the professions that will appear in the future as society adapts to a more automated and highly digitised world, with many of them reading like something from a sci-fi film or dystopian novel. With names like “head of machine personality design” and “flying car developer,” some of them are fairly self-explanatory and already semi-familiar, yet others suggest that the future will be a very strange place indeed.


Data Trash Engineer

Summary:

The theory behind junk data is often wrong, and we need to fix it. Data that has not been used by anyone in the past 12 months, has no foreseeable use as initially imagined, and isn’t necessary for regulatory purposes, can still be turned into insights. Just like food waste is a carbon that can be used to produce green energy, data waste is still meaningful if cleaned.

We’re seeking data trash engineers who can identify unused data in our organization, clean that data and feed it into machine-learning algorithms to find hidden insights by not only increasing how much data is collected, but also improving the data quality.

In the end, the goal of the data trash engineer is to transform data from trash to treasure. The possibilities are endless, and we expect the employee in this role to originate award-winning ideas.

What it takes to become a Data Trash Engineer?

In today’s business world, we often struggle to manage the ever-expanding volume of data around us, while also ensuring the quality of that data. As a result, we often end up labelling piles of data as waste if it hasn’t been used in the last 12 months. However, if we mine, refine and distribute it, data trash can be profitable, and the return on investment can be significant.


As a key member of a fast-paced, high-performing and highly-visible data analytics team, the data trash engineer will have the opportunity to use quantitative skills and develop well-rounded business insights by working across various functions on impactful, business-focused projects.

In this role, you’ll apply analytical rigor and statistical methods to data trash in order to guide decision-making, product development and strategic initiatives. This will be done by creating a “data trash nutrition labelling” system that will rate the quality of waste datasets and manage the “data-growth-data-trash” ratio.

For instance, if we’re expecting 30% annual growth in data over the next 12 months, the data trash engineer will ensure 30% of the data labelled as trash is cleaned and translated into key business decisions. In the end, this role will help us fix the data trash problem by establishing a ”trash-to-treasure” data supply chain.

What exactly Data Trash Engineers do?

  • Create a data trash nutrition labelling system to rate the quality of each dataset. Perform end-to-end analyses that include business requirement specifications, data cleaning, analyzing, modelling, validating and facilitating gradual improvements.
  • Become a champion of the “trash-to-treasure” innovation program by helping business teams find new opportunities, enhance customer interactions and uncover new business models. Review, analyze and share results to guide improvements, decision-making and program optimizations.
  • Design AI test experiments that focus on enhancing customer experiences of our offerings, services and programs, as well as offer consultation and closely monitor experiment execution. The data trash engineer will ensure an uninterrupted supply of clean data is available for AI technologies to deliver the required results.
  • Participate in the planning and strategy of key business projects by making business recommendations with effective presentations at multiple levels of stakeholders through visually compelling analytical results from the trash-to-treasure program.
  • Drive collaboration and partnership with other data teams to ensure customer success.
  • Partner closely with our legal teams to ensure we’re treating all customer data to comply with appropriate confidentiality and usage.

“The goal of the data trash engineer is to transform data from trash to treasure. The possibilities are endless, and we expect the employee in this role to originate award-winning ideas”.


SKILLS & QUALIFICATIONS:

  • A master’s degree in a quantitative discipline (e.g., statistics, computer science, quantitative psychology, applied mathematics).
  • Three to five years of experience with various data analysis tools, data mining tools and statistical packages.
  • Experience working on big data and machine learning technologies, such as Azure Cosmos DB, TLC, Azure ML, Cortana Analytics, R, Python and SQL.
  • Proficiency with analytical tools (R, SAS, Matlab, Python or Stata).
  • Development experience in at least one scripting language, such as Python, Java, C, C++, Ruby or Perl.
  • Solid interpersonal, cross-organizational collaboration capabilities, as well as written, verbal and visual communication skills to present complex analytical results concisely and effectively.
  • Experience developing data visualization offerings and dashboards.

Conclusion:

So far, we have learned what is Data Trash Engineering, what they do and how to become one by satisfying skills and qualifications.

How to connect MYSQL Database with python using pycharm IDE

In this blog, we will see about how to connect a database to python using PyCharm IDE.

Here we are going to connect mysql database to python. In the similar fashion we can connect any database software to python.

Here are the pre-requisite needed for establishing connection between python and mysql or any database

PRE-REQUISITE:

  1. Adding database plugin in Pycharm
  2. Install mysql-connector packages

Adding database Plugin:

Database plugin supports addition of packages to support the connection between database and python.Below are the steps to add the database plugin.

i) Select PyCharm-> Preferences or select Settings options from the IDE

 ii) Select Plugins sections on the left pane of pop up dialog box.The list of plugins available from Market place will be displayed like csv , UI themes etc. As per our needs we can add the appropriate plugins.

iii) Type database in search box and install the database navigator plugin.

Installing MySQL Python connector packages:

MySql connector packages need to be installed to establish connection between mysql and python. Follow the below steps to install the same using Pycharm.

i) Go to File -> New Preferences of the project. Select Project Interpreter to add the package.

 ii) Select the “+” icon to install the package. Search the mysql python connector packages and install them.

iii)Install mysql-connector and mysql-connector-python packages.

Adding new connection to connect MySQL Database

This step is essential to setup a connection to access the mysql database from python.

In this process we will need the database details we are going to connect like hostname, port, username and password.

i) Go to View -> DB Browser . In the left pane you will be able to view the DB Browser section. 

ii) Select “+” icon to Add new connection. Then select the database going to be accessed.

Here we are going to connect mysql database server. The DB – Navigator settings dialog box will pop up .

iii)Provide the mysql db connection details as below

   * Hostname

   * Port

   * Username and Password

Then select Test Connection for success status  and select OK. 

iv) After the connection is set up . The database schema and corresponding table details will be shown in the DB Browser section in the left pane.