lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 2a0eee9 8/8: Indicate whether 7702 mortality


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 2a0eee9 8/8: Indicate whether 7702 mortality varies by age or gender
Date: Wed, 13 Mar 2019 20:23:31 -0400 (EDT)

branch: master
commit 2a0eee9d82c061f182bedca9356364108ee6b26b
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Indicate whether 7702 mortality varies by age or gender
    
    Added booleans DB_Irc7702QAxisGender and DB_Irc7702QAxisSmoking to
    indicate whether 7702 mortality is gender- or smoker-distinct.
    
    Strictly speaking, these are redundant, and could be deduced by
    examining the shape of each product's DB_Irc7702QTable entity.
    However, DB_Irc7702QTable shouldn't vary across any other axes,
    and these new entities make the intention both more explicit and
    easier to validate in verify_products().
---
 db_sort.sed         | 30 ++++++++++++++++--------------
 dbdict.cpp          |  4 ++++
 dbdict.hpp          |  2 ++
 dbnames.hpp         |  2 ++
 dbnames.xpp         |  2 ++
 verify_products.cpp | 17 +++++++++++++----
 6 files changed, 39 insertions(+), 18 deletions(-)

diff --git a/db_sort.sed b/db_sort.sed
index 5854392..2cf32cb 100644
--- a/db_sort.sed
+++ b/db_sort.sed
@@ -69,20 +69,22 @@
 /DB_Irc7702NspTable\>/     s/^/B08/
 /DB_SevenPayTable\>/       s/^/B09/
 /DB_Irc7702QTable\>/       s/^/B10/
-/DB_RatingsAffect7702\>/   s/^/B11/
-/DB_CvatMatChangeDefn\>/   s/^/B12/
-/DB_GptMatChangeDefn\>/    s/^/B13/
-/DB_Irc7702BftIsSpecAmt\>/ s/^/B14/
-/DB_RiskyInitial7702Db\>/  s/^/B15/
-/DB_Irc7702Endowment\>/    s/^/B16/
-/DB_Effective7702DboRop\>/ s/^/B17/
-/DB_TermIsQABOrDb7702\>/   s/^/B18/
-/DB_TermIsQABOrDb7702A\>/  s/^/B19/
-/DB_GioIsQAB\>/            s/^/B20/
-/DB_AdbIsQAB\>/            s/^/B21/
-/DB_SpouseRiderIsQAB\>/    s/^/B22/
-/DB_ChildRiderIsQAB\>/     s/^/B23/
-/DB_WpIsQAB\>/             s/^/B24/
+/DB_Irc7702QAxisGender\>/  s/^/B11/
+/DB_Irc7702QAxisSmoking\>/ s/^/B12/
+/DB_RatingsAffect7702\>/   s/^/B13/
+/DB_CvatMatChangeDefn\>/   s/^/B14/
+/DB_GptMatChangeDefn\>/    s/^/B15/
+/DB_Irc7702BftIsSpecAmt\>/ s/^/B16/
+/DB_RiskyInitial7702Db\>/  s/^/B17/
+/DB_Irc7702Endowment\>/    s/^/B18/
+/DB_Effective7702DboRop\>/ s/^/B19/
+/DB_TermIsQABOrDb7702\>/   s/^/B20/
+/DB_TermIsQABOrDb7702A\>/  s/^/B21/
+/DB_GioIsQAB\>/            s/^/B22/
+/DB_AdbIsQAB\>/            s/^/B23/
+/DB_SpouseRiderIsQAB\>/    s/^/B24/
+/DB_ChildRiderIsQAB\>/     s/^/B25/
+/DB_WpIsQAB\>/             s/^/B26/
 # DB_Topic_MortalityCharges
 /DB_CsoEra\>/              s/^/C01/
 /DB_CsoMisprint\>/         s/^/C02/
diff --git a/dbdict.cpp b/dbdict.cpp
index 642801a..1a7c1ac 100644
--- a/dbdict.cpp
+++ b/dbdict.cpp
@@ -154,6 +154,8 @@ void DBDictionary::ascribe_members()
     ascribe("Irc7702NspTable"     , &DBDictionary::Irc7702NspTable     );
     ascribe("SevenPayTable"       , &DBDictionary::SevenPayTable       );
     ascribe("Irc7702QTable"       , &DBDictionary::Irc7702QTable       );
+    ascribe("Irc7702QAxisGender"  , &DBDictionary::Irc7702QAxisGender  );
+    ascribe("Irc7702QAxisSmoking" , &DBDictionary::Irc7702QAxisSmoking );
     ascribe("RatingsAffect7702"   , &DBDictionary::RatingsAffect7702   );
     ascribe("CvatMatChangeDefn"   , &DBDictionary::CvatMatChangeDefn   );
     ascribe("GptMatChangeDefn"    , &DBDictionary::GptMatChangeDefn    );
@@ -687,6 +689,8 @@ sample::sample()
     int dims311[e_number_of_axes] = {3, 1, 1, 1, 1, 1, 1}; // gender
     double T7702q[3] = {35, 41, 107,}; // Female, male, unisex.
     Add({DB_Irc7702QTable, e_number_of_axes, dims311, T7702q});
+    Add({DB_Irc7702QAxisGender  , true});
+    Add({DB_Irc7702QAxisSmoking , false});
 
     Add({DB_CvatMatChangeDefn   , 
mce_earlier_of_increase_or_unnecessary_premium});
     Add({DB_GptMatChangeDefn    , 0});
diff --git a/dbdict.hpp b/dbdict.hpp
index fab7c81..d9fed4b 100644
--- a/dbdict.hpp
+++ b/dbdict.hpp
@@ -133,6 +133,8 @@ class LMI_SO DBDictionary
     database_entity Irc7702NspTable     ;
     database_entity SevenPayTable       ;
     database_entity Irc7702QTable       ;
+    database_entity Irc7702QAxisGender  ;
+    database_entity Irc7702QAxisSmoking ;
     database_entity RatingsAffect7702   ;
     database_entity CvatMatChangeDefn   ;
     database_entity GptMatChangeDefn    ;
diff --git a/dbnames.hpp b/dbnames.hpp
index 447b0b5..814fea3 100644
--- a/dbnames.hpp
+++ b/dbnames.hpp
@@ -166,6 +166,8 @@ enum e_database_key
         ,DB_Irc7702NspTable
         ,DB_SevenPayTable
         ,DB_Irc7702QTable
+        ,DB_Irc7702QAxisGender
+        ,DB_Irc7702QAxisSmoking
 
         ,DB_RatingsAffect7702
         ,DB_CvatMatChangeDefn
diff --git a/dbnames.xpp b/dbnames.xpp
index c450dbd..72c8b32 100644
--- a/dbnames.xpp
+++ b/dbnames.xpp
@@ -75,6 +75,8 @@
 {DB_Irc7702NspTable,DB_Topic_7702And7702A,"Irc7702NspTable","7702 and 7702A 
net single premium rates per $1 (index in mortality table database)",}, \
 {DB_SevenPayTable,DB_Topic_7702And7702A,"SevenPayTable","7702A annual 
seven-pay premium rates per $1 (index in mortality table database)",}, \
 {DB_Irc7702QTable,DB_Topic_7702And7702A,"Irc7702QTable","7702 and 7702A annual 
mortality rate (index in mortality table database)",}, \
+{DB_Irc7702QAxisGender,DB_Topic_7702And7702A,"Irc7702QAxisGender","7702 and 
7702A mortality varies by gender: 0=no, 1=yes",}, \
+{DB_Irc7702QAxisSmoking,DB_Topic_7702And7702A,"Irc7702QAxisSmoking","7702 and 
7702A mortality varies by smoking: 0=no, 1=yes",}, \
 {DB_RatingsAffect7702,DB_Topic_7702And7702A,"RatingsAffect7702","Flat extras 
and table ratings affect 7702 and 7702A calculations: 0=no, 1=yes",}, \
 {DB_CvatMatChangeDefn,DB_Topic_7702And7702A,"CvatMatChangeDefn","Definition of 
7702A material change for CVAT: 0=unnec prem, 1=increase, 2=increase after 
unnec prem [not implemented], 3=any unnec prem or increase",}, \
 {DB_GptMatChangeDefn,DB_Topic_7702And7702A,"GptMatChangeDefn","Definition of 
7702A material change for GPT: 0=any adjustment event, 1=any adjustment event 
that increases the guideline limit",}, \
diff --git a/verify_products.cpp b/verify_products.cpp
index 4b4e89e..6bb24e2 100644
--- a/verify_products.cpp
+++ b/verify_products.cpp
@@ -52,11 +52,20 @@ void verify_one_cell
     input["Smoking"    ] = smoking;
     yare_input       const yi(input);
     product_database const db(yi);
-    auto const era = db.query<oenum_cso_era   >(DB_CsoEra);
-    auto const a_b = db.query<oenum_alb_or_anb>(DB_AgeLastOrNearest);
-    auto const t   = db.query<int             >(DB_Irc7702QTable);
-    if(0 == t)
+    auto const era    = db.query<oenum_cso_era   >(DB_CsoEra);
+    auto const a_b    = db.query<oenum_alb_or_anb>(DB_AgeLastOrNearest);
+    auto const t      = db.query<int             >(DB_Irc7702QTable);
+    auto const axis_g = db.query<bool            >(DB_Irc7702QAxisGender);
+    auto const axis_s = db.query<bool            >(DB_Irc7702QAxisSmoking);
+    if
+        (  0 == t
+        || (!axis_g && "Unisex"   != gender)
+        || (!axis_s && "Unismoke" != smoking)
+        )
+        {
         return;
+        }
+
     std::vector<double> const v0 = cso_table
         (era
         ,oe_orthodox



reply via email to

[Prev in Thread] Current Thread [Next in Thread]