1. Trang chủ
  2. » Cao đẳng - Đại học

PN DSNA presentation

36 335 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 36
Dung lượng 1,47 MB

Nội dung

What is the data modelling? Data modelling is the method used to define and analyze data requirements needed to support the business processes of a project. The data requirements are recorded as a conceptual data model with associated data definitions. In this case study, you will notably discover : How the requirements have influenced the data modelling What are the typical questions when modelling a database

Data Modelling – SKY Case Study Overview of the data modelling for the project SKY in Cambodia April 2011 Agenda Introduction Project overview Data modelling Introduction What is the data modelling? Data modelling is the method used to define and analyze data requirements needed to support the business processes of a project The data requirements are recorded as a conceptual data model with associated data definitions In this case study, you will notably discover : – How the requirements have influenced the data modelling – What are the typical questions when modelling a database Introduction Attention : At any time, in case you don’t understand any point, please let me know by putting your hand 'up! H-SPIS Project Overview Context (1/2) GRET, a French Non Governmental Organization (NGO), has built an Health Insurance program called SKY that enables insured people to access to quality health care in getting rid of money concern and ensuring that future health events won’t impoverish them The program SKY has two main objectives: Secure the assets and incomes of vulnerable Cambodian households by limiting the economic consequences of large health expenditures Insured people pay a regular premium/contribution In exchange, when the insured people are sick, they received all health care needed to recover, without paying anything Facilitate and encourage access for these households to quality health care, both at primary and secondary levels, to prevent severe health risks H-SPIS Project Overview Context (2/2) The GRET works in cooperation with two other organizations specialized in health micro-insurance:  Health Equity Fund (HEF) aims at covering health expenses of poor identified families in Cambodia totally for free URC plays role as an implementer and sub grant to Cambodian NGO to operate HEF at district level  HIP, a new program involved by the GRET, consists in creating a social security for formal sector workers It works with the GMAC (union of Garment Manufacturing employers) representing 80% of the export from Cambodia and 20% of the Gross National Product under the agreement and observance of the Cambodian Ministry of Health (MoH) The insurance premium is paid for half by the factory, the other half by the workers H-SPIS Project Overview Objectives GRET wants to build a common application enabled to gather the common requirements of the organizations GRET, URC and HIP, by maintaining the particular specificities of the streams GRET H-SPIS URC HIP The new combined project is named H-SPIS for Health Social Protection Insurance System! The objectives of the new system H-SPIS, combining the operators applications, are multiple:  Increase the covered population thanks to the sharing of the operator’s network  Share the costs and staff based in the different hospitals and offices in the country Become a reference for a National Social Insurance in Cambodia : quite ambitious! H-SPIS Project Overview Data base Requirements (1/2) The data of the operators GRET, URC and HIP must be contained in a common central database in the Head Office In the provinces or operational districts , the field operators of GRET, URC and HIP cannot access the central database by a standard web connection which is too slow: they must access a local database which contains only the data of the OD The local database must be replicated with the central database aimed at consolidating all the information of the country, for all the operators H-SPIS Project Overview Data base Requirements (2/2) The combined database requirements has lead to the following architecture: Global Database Global Database (HIP, GRET, URC) (HIP, GRET, URC) Hospitals •Control membership Head Office • Project Management • IT Management • Finance (e.g.: invoice •payments) Consultation Data Replication Consultation • Track Consumption Field Office in OD1 Field Office in OD2 • Enter member & premium data • Enter consumption data/claims Field Office in OD3 Database in OD2 Data entry Health Centre Health Centre • Control membership • Track consumption Computerized tasks Manual tasks • Control membership • Track consumption Legend: … … … … … H-SPIS Data modeling Data modeling process To perform the data modeling, you need to proceed the following steps: Identify entity types Identify attributes Apply naming conventions Identify relationships Assign keys Normalize to reduce data redundancy Denormalize to improve performance   10 H-SPIS Data modeling Identify keys : primary keys Difference between the functional and technical key Functional Key Technical Key Represents a value which is comprehensible for the business and users  Doesn’t mean any signification for the business or the users (just internal key in the system)  Is supposed to define in an unique way the records in the table  Define (as a fact) in an unique way the records in the table by automatically incrementing the technical key of +1 for each new row Example : for a person, one’s national ID is the functional key although a technical unique id is defined as primary key for the table H-SPIS Data modeling Identify keys : primary keys What happens in case we not include the OD ID in the primary key of each table? Error for row in double in the TBL_HOUSEHOLD_FAMILY PK_ NUM_ TBL_HOUSEHOLD_FAMILY TBL_HOUSEHOLD_FAMILY FAMILY_ID FAMILY_CODE VAR_ LATIN_NAME 4343422 LONG 6666353 SALZE Global Database 043GGXX KHANG (HIP, GRET, URC) 5354091 SONG 5204532240 GOURSAT 0135244 PRAK 0135112120 TOMG 34402 FSFR34 BOUN … TBL_HOUSEHOLD_FAMILY TBL_HOUSEHOLD_FAMILY PK_ FAMILY_ID NUM_ FAMILY_CODE VAR_ LATIN_NAME 6666353 SALZE 5204532240 GOURSAT TBL_HOUSEHOLD_FAMILY TBL_HOUSEHOLD_FAMILY … TBL_HOUSEHOLD_FAMILY TBL_HOUSEHOLD_FAMILY PK_ FAMILY_ID NUM_ FAMILY_CODE VAR_ LATIN_NAME 4343422 LONG 5354091 SONG 0135244 PRAK Legend: … … Replication Replication process process from from local local tt oo centralized centralized database database … PK_ FAMILY_ID NUM_ FAMILY_CODE VAR_ LATIN_NAME 043GGXX KHANG 34402 FSFR34 BOUN 0135112120 TOMG … … … H-SPIS Data modeling Identify keys : primary keys What happens if we add the OD ID in the primary key of each table? TBL_HOUSEHOLD_FAMILY TBL_HOUSEHOLD_FAMILY No error during replication process since the primary key is composed of the technical ID plus the OD ID PK_ FAMILY _ID PK_OD_ID NUM_ FAMILY_C ODE VAR_ LATIN_NA ME OD1 4343422 LONG OD2 6666353 SALZE OD3 043GGXX KHANG Global Database OD1 5354091 SONG (HIP, GRET, URC) OD2 520453224 GOURSA T OD1 0135244 PRAK OD1 013511212 TOMG 34402 OD1 FSFR34 BOUN TBL_HOUSEHOLD_FAMILY TBL_HOUSEHOLD_FAMILY PK_ FAMILY _ID PK_OD_ID NUM_ FAMILY_C ODE VAR_ LATIN_NA ME OD2 6666353 SALZE OD2 520453224 TBL_HOUSEHOLD_FAMILY TBL_HOUSEHOLD_FAMILY PK_ FAMILY _ID PK_OD_ID NUM_ FAMILY_C ODE VAR_ LATIN_NA ME OD1 4343422 LONG OD1 5354091 SONG OD1 0135244 PRAK … … … … … GOURSA T TBL_HOUSEHOLD_FAMILY TBL_HOUSEHOLD_FAMILY PK_ FAMILY _ID PK_OD_ID NUM_ FAMILY_C ODE VAR_ LATIN_NA ME OD3 043GGXX KHANG 34402 OD3 FSFR34 BOUN OD3 013511212 TOMG … … … H-SPIS Data modeling Identify keys : foreign keys The foreign key identifies a column or a set of columns in one (referencing) table that refers to a set of columns in another (referenced) table The columns in the referencing table must be the primary key or other candidate key in the referenced table The values in one row of the referencing columns must occur in a single row in the referenced table  A primary key can be targeted by multiple foreign keys from other tables  But a primary key does not necessarily have to be the target of any foreign keys  Thus, a row in the referencing table cannot contain values that don't exist in the referenced table (except potentially NULL) This way references can be made to link information together and it is an essential part of database normalization  Multiple rows in the referencing table may refer to the same row in the referenced table Most of the time, it reflects the one (parent table or referenced table) to many (child table, or referencing table) relationship  A table may have multiple foreign keys, and each foreign key can have a different referenced table H-SPIS Data modeling Identify keys : foreign keys The foreign key identifies a column or a set of columns in one (referencing) table that refers to a set of columns in another (referenced) table The columns in the referencing table must be the primary key or other candidate key in the referenced table The values in one row of the referencing columns must occur in a single row in the referenced table  A primary key can be targeted by multiple foreign keys from other tables  But a primary key does not necessarily have to be the target of any foreign keys  Thus, a row in the referencing table cannot contain values that don't exist in the referenced table (except potentially NULL) This way references can be made to link information together and it is an essential part of database normalization  Multiple rows in the referencing table may refer to the same row in the referenced table Most of the time, it reflects the one (parent table or referenced table) to many (child table, or referencing table) relationship  A table may have multiple foreign keys, and each foreign key can have a different referenced table H-SPIS Data modeling Identify keys : foreign keys Examples:  The family table is referenced by the address table and the person table as followed: TBL_HOUSEHOLD_FAMILY TBL_HOUSEHOLD_FAMILY TBL_HOUSEHOLD_PERSON TBL_HOUSEHOLD_PERSON PK_PERSON_ID PK_PERSON_ID PK_OD_ID PK_OD_ID FK_FAMILY_ID FK_FAMILY_ID FIRST FIRST NAME NAME LAST LAST NAME NAME ………… ………… ………… ………… 1 TBL_HOUSEHOLD_ADRESS TBL_HOUSEHOLD_ADRESS PK_FAMILY_ID PK_FAMILY_ID PK_OD_ID PK_OD_ID FK_ADDRESS FK_ADDRESS ID ID FK_OD_ID FK_OD_ID FK_SECTOR_ID FK_SECTOR_ID NUM_FAMILY_CODE NUM_FAMILY_CODE VAR_LATIN_NAME VAR_LATIN_NAME VAR_KHMER_NAME VAR_KHMER_NAME NUM_FAMILY_SIZE NUM_FAMILY_SIZE DATE_REGISTER_DATE DATE_REGISTER_DATE NUM_OLD_FAMILY_CODE NUM_OLD_FAMILY_CODE ………… ………… ………… ………… When a person is added into the system, before you must have created the corresponding family in the database The family id is referred by the person table so that you ensure a person is linked to an existing family 2 PK_ADDRESS_ID PK_ADDRESS_ID PK_OD_ID PK_OD_ID FK_FAMILY_ID FK_FAMILY_ID FK_VILLAGE_ID FK_VILLAGE_ID NUM_STREET_NO NUM_STREET_NO NUM_HOUSE_NO NUM_HOUSE_NO ………… ………… ………… ………… When an address is recorded into the system, before you must have created the corresponding family in the database The family id is referred by the person table so that you ensure a person is linked to an existing family H-SPIS Data modeling Identify keys : foreign keys Examples:  All the tables of the reference domain are referenced by foreign key in the tables containing transactional data TBL_REFERENCE_VILLAGE TBL_REFERENCE_VILLAGE PK_VILLAGE_ID PK_VILLAGE_ID FK_COMMUNE_ID FK_COMMUNE_ID VAR_VILLAGE_NAME VAR_VILLAGE_NAME TBL_REFERENCE_COMMUNE TBL_REFERENCE_COMMUNE PK_COMMUNE ID PK_COMMUNE ID FK_COMMUNE_ID FK_COMMUNE_ID VAR_VILLAGE_NAME VAR_VILLAGE_NAME TBL_SECTOR TBL_SECTOR PK_SECTOR_ID PK_SECTOR_ID VAR_SECTOR_NAME VAR_SECTOR_NAME TBL_HOUSEHOLD_ADRESS TBL_HOUSEHOLD_ADRESS TBL_HOUSEHOLD_FAMILY TBL_HOUSEHOLD_FAMILY TBL_OD TBL_OD PK_OD_ID PK_OD_ID VAR_OD_NAME VAR_OD_NAME PK_FAMILY_ID PK_FAMILY_ID FK_ADDRESS FK_ADDRESS ID ID FK_SECTOR_ID FK_SECTOR_ID FK_OD_ID FK_OD_ID NUM_FAMILY_CODE NUM_FAMILY_CODE VAR_LATIN_NAME VAR_LATIN_NAME VAR_KHMER_NAME VAR_KHMER_NAME NUM_FAMILY_SIZE NUM_FAMILY_SIZE DATE_REGISTER_DATE DATE_REGISTER_DATE NUM_OLD_FAMILY_CODE NUM_OLD_FAMILY_CODE ………… ………… ………… ………… PK_ADDRESS_ID PK_ADDRESS_ID FK_VILLAGE_ID FK_VILLAGE_ID NUM_STREET_NO NUM_STREET_NO NUM_HOUSE_NO NUM_HOUSE_NO ………… ………… ………… ………… TBL_REFERENCE_DISTRICT TBL_REFERENCE_DISTRICT TBL_REFERENCE_PROVINCE TBL_REFERENCE_PROVINCE PK_PROVINCE ID PK_PROVINCE ID VAR_DPROVINCE_NAME VAR_DPROVINCE_NAME PK_DISTRICT ID PK_DISTRICT ID FK_PROVINCE_ID FK_PROVINCE_ID VAR_DISTRICT_NAME VAR_DISTRICT_NAME H-SPIS Data modeling Normalize Data The process of organizing data to minimize redundancy is called normalization The goal of database normalization is to decompose relations with anomalies in order to:  Produce smaller database and limit the volumetry  Define well-structured relations  Minimize redundancies and consecutive risk of incoherencies (an insufficiently normalized table might have the same information can be expressed on multiple rows; therefore updates to the table may result in logical inconsistencies) Example: Normalized data model for family and address FAMILY_TABLE Each information is recorded at PK_FAMILY_ID FAMILY_NAME FAMILY_SIZE …… the minimum in the database => No redundancy of data N’GUYEN TONG LANG A standard piece of database design guidance is that the designer should create ADDRESS_TABLE PK_ADDRESS_ID STREET_NA ME STREET_ NUMBER ZIP_CODE VIILLAGE_NAME Street Ho Chi Minh 45 535225 DA NANG Street N’Guyen 87 546420 HANOÏ Street Hanoï 56 32777 HO CHI MINH CITY H-SPIS Data modeling Denormalize Data However, selective denormalization can subsequently be performed for performance reasons Example: Denormalized data model for family and address FAMILY_TABLE PK_FAMILY_ID FAMILY_NAME FAMILY _SIZE STREET_ NAME STREET_ NUMBER ZIP_CODE VIILLAGE_NAME N’GUYEN Street Ho Chi Minh 45 535225 DA NANG TONG Street N’Guyen 87 546420 HANOÏ LANG Street Hanoï 56 32777 HO CHI MINH CITY PK_FAMILY_ID 2FK_HEALTH_ CENTER_ID FAMILY_NAME FAMILY_SIZE 3…… ADDRESS_TABLE PK_ID STREET NO ZIP_COD E VIILLAGE_NAM E Street Ho Chi Minh 45 535225 DA NANG Street N’Guyen 87 546420 HANOÏ Street Hanoï 56 32777 HO CHI MINH CITY The information of the address is duplicated both in the family and in the address table => this is useful in case of performance issues : the address of the family can be retrieved from one single table (family table) without need to link it with the address table Denormalization is recommended while facing performance issues in getting SQL request results H-SPIS Data modeling Exercises Exercise : Building a SQL Request which enables to know the name of the health center which the N’Guyen family is linked to FAMILY_TABLE PK_FAMILY _ID FK_HEALTH_ CENTER_ID FAMILY_ NAME FAMILY_SIZE N’GUYEN 2 TONG LANG HEALTH_CENTER_TABLE PK_HEALT H_CENTER _ID HEALTH_ CENTER_NA ME Hospital A Hospital B Hospital C …… In the table FAMILY_TABLE, the column FK_HEALTH_ CENTER_ID is defined as a foreign key referencing the PK_HEALTH_CENTER_ID in the HEALTH_CENTER_TABLE H-SPIS Data modeling Exercises Exercise : Answer Sheet SELECT HC.HEALTH_CENTER_NAME FROM HEALTH_CENTER_TABLE HC, FAMILY_TABLE F WHERE HC.PK_HEALTH_CENTER_ID=F.FK_HEALTH_ CENTER_ID AND F.FAMILY_NAME='N’GUYEN'; Note the use of the alias to renamed the tables with a short name: -HEALTH_CENTER_TABLE is replaced by HC -FAMILY_TABLE is replaced by F H-SPIS Data modeling Exercises Exercise : Modelling the data related to the Medical Consumption domain The public health care system in Cambodia is divided in three hierarchal level of health Facilities, where the 1st level corresponds to the unique entry to access cares or treatments and from which, patients are reassigned to higher levels of health facilities (see schema in the next slide) :  The 1st level of care is the Health Center (HC) and corresponds to the commune area It provides services such as consultations, vaccinations and childbirths  The Referral Hospital (RH) providing 2nd level of care  The Province Hospital (PH) corresponds to the 3rd level of care and is provided at provincial & national hospitals : it benefits of a better technical level of care, scanners and surgery What you need to : model these data by identifying : • The different entity types • Their attributes and relations ships • Their primary and foreign keys Don’t forget to apply the naming rules conventions Tips: you must wonder whether: • these data are transactional data or not? • Are they hierarchal? H-SPIS Data modeling Exercises Exercise : Modelling the data related to the Medical Consumption domain A Health center belongs to the Referral hospital area A Referral hospital belongs to a provincial hospital PH X RH X X X X X X X X HC X X X X Legend : X Health center:(HC) Referral hospital(RH) Provincial hospital(PH) X H-SPIS Data modeling Exercises Exercise : Modelling the data related to the Medical Consumption domain When a member requests any Health care to the Health Center, a contact happens between the member and the health facility A contact can be a consultation of a few hours or a hospitalization During these contacts, the patient will be routed to different ward within the Health Facility, in which he/she will be provided different services corresponding to concrete health cares as consultations or exams What you need to : starting from the Person Table, modelize the “Contact” and “Service” Data by identifying the entity types, their attributes and relations ships, and applying the naming rules conventions Note also that you’ll need to link these data to the data modelized in the part A above H-SPIS Data modeling Identify keys : foreign keys Exercise Answer Sheet:  TBL_PERSON TBL_PERSON PK_PERSON_ID PK_PERSON_ID VAR_NAME VAR_NAME VAR_FIRSTNAME VAR_FIRSTNAME VAR_FULLNAME VAR_FULLNAME NUM_AGE NUM_AGE VAR_NATIONAL_ID VAR_NATIONAL_ID …… …… TBL_REFERENCE_HEALTH_ TBL_REFERENCE_HEALTH_ CENTER CENTER PK_HC_ID PK_HC_ID FK_RH_ID FK_RH_ID VAR_HC_NAME VAR_HC_NAME TBL_REFERRAL_HOSPITAL TBL_REFERRAL_HOSPITAL PK_RH ID PK_RH ID FK_PH_ID FK_PH_ID VAR_RH_NAME VAR_RH_NAME TBL_SERVICE TBL_SERVICE PK_SERVICE_ID PK_SERVICE_ID VAR_SERVICE_NAME VAR_SERVICE_NAME TBL_USE_CONTACT TBL_USE_CONTACT TBL_PROVINCIAL_HOSPITAL TBL_PROVINCIAL_HOSPITAL TBL_USE_SERVICE TBL_USE_SERVICE PK_USE_SERVICE_ID PK_USE_SERVICE_ID FK_ADDRESS FK_ADDRESS ID ID FK_SECTOR_ID FK_SECTOR_ID FK_OD_ID FK_OD_ID NUM_FAMILY_CODE NUM_FAMILY_CODE VAR_LATIN_NAME VAR_LATIN_NAME VAR_KHMER_NAME VAR_KHMER_NAME NUM_FAMILY_SIZE NUM_FAMILY_SIZE DATE_REGISTER_DATE DATE_REGISTER_DATE NUM_OLD_FAMILY_CODE NUM_OLD_FAMILY_CODE ………… ………… ………… ………… PK_USE_CONTACT_ID PK_USE_CONTACT_ID FK_PERSON_ID FK_PERSON_ID FK_HC_ID FK_HC_ID CONTACT_DATE CONTACT_DATE CONTACT_DURATION CONTACT_DURATION CONTACT_TYPE CONTACT_TYPE ………… ………… PK_PH ID PK_PH ID VAR_RH_NAME VAR_RH_NAME

Ngày đăng: 16/07/2017, 00:18

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN