Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
Training « Les Herbonautes »
Technical presenta4on
Marie-‐Elise LECOQ GBIF France
[email protected] Paris, 24th June, 2015
Technical Presenta4on
General Informa4on Model MVC
Database schema Configura4on files
General informa4on • Play Framework! Version 1.3 (Java)
• Java, JPA, Groovy, HTML and Javascript
• CSS (Bootstrap)
• Database : Oracle
• Web server : Tomcat
MODEL
Java
JPA (Hibernate)
VIEW
Groovy /HTML JavaScript
CONTROLLER
Java
Model – View – Controller
DATABASE
Oracle
Play Framework routes file
HTTP
1
2
7
5 3
4
6
Controller
Model
Configura4on
View
Javascript / CSS
Example (1) URL : ~/missions/11/specimens/22!
!!!!!!!!
!!controller called : Missions.java!function called : contributionBoard(missionId, specimenId) !
Example (2)
connec'on with the model classes
connec'on with the view
Example (3) View repository architecture Controller
Class name : Missions Method name : contribu4onBoard
H_BADGE* type VARCHAR2 (31 char)*P i d NUMBER (19)
F user_id NUMBER (19)
H_BADGE_PK (id)
FK869DB0CC47140EFE (user_id)
mission_specimen*F specimen_id NUMBER (19)*F mission_id NUMBER (19)
FKB670B05B476B7E96 (mission_id)FKB670B05BFC7D37DE (specimen_id)
H_MISSION*P i d NUMBER (19)
bigImageId NUMBER (19)* closed NUMBER (1)
goal NUMBER (10)* hasBigImage NUMBER (1)* hasImage NUMBER (1)
imageId NUMBER (19)lang VARCHAR2 (255 char)
* loading NUMBER (1)openingDate TIMESTAMPpresentation CLOBpriority NUMBER (10)
* published NUMBER (1)report CLOB
* reportPublished NUMBER (1)shortDescription VARCHAR2 (1000 char)tit le VARCHAR2 (1000)
F country_id NUMBER (19)F leader_id NUMBER (19)
H_MISSION_PK (id)
FKAA58EC7594344500 (leader_id)FKAA58EC759B84A56 (country_id)
mission_banned_user*F mission_id NUMBER (19)*F user_id NUMBER (19)
FK5A0DD61947140EFE (user_id)FK5A0DD619476B7E96 (mission_id)
mission_user*F user_id NUMBER (19)*F mission_id NUMBER (19)
FKFC823A9E47140EFE (user_id)FKFC823A9E476B7E96 (mission_id)
contr ibution_col lectors*F contribution_id NUMBER (19)*F botanist_id NUMBER (19)
FK803C4D1565C5D1E (botanist_id)FK803C4D156B1974C8 (contribution_id)
H_COUNTRY*P i d NUMBER (19)
iso VARCHAR2 (255 char)name VARCHAR2 (255 char)
H_COUNTRY_PK (id)
H_ACTIVITY* type VARCHAR2 (31 char)*P i d NUMBER (19)
CREATION_DATE TIMESTAMPF mission_id NUMBER (19)F user_id NUMBER (19)F contribution_id NUMBER (19)F specimen_id NUMBER (19)F badge_id NUMBER (19)
H_ACTIVITY_PK (id)
FK85FEE52647140EFE (user_id)FK85FEE526476B7E96 (mission_id)FK85FEE5268AD45980 (badge_id)FK85FEE526FB39F789 (contribution_id)FK85FEE526FC7D37DE (specimen_id)
H_CONTRIBUTION* type VARCHAR2 (31 char)*P i d NUMBER (19)* canceled NUMBER (1)
CREATION_DATE TIMESTAMP* deducted NUMBER (1)* notPresent NUMBER (1)* notReadable NUMBER (1)* notSure NUMBER (1)* report NUMBER (1)* validatedFromOther NUMBER (1)
collectorNotPresent NUMBER (1)collectorNotSure NUMBER (1)determinerNotPresent NUMBER (1)determinerNotSure NUMBER (1)collectDate TIMESTAMPcollectEndDate TIMESTAMPcollectStartDate TIMESTAMPperiod NUMBER (1)locality VARCHAR2 (255 char)cause NUMBER (10)latitude FLOATlongitude FLOAT
F mission_id NUMBER (19)F specimen_id NUMBER (19)F user_id NUMBER (19)F regionLevel1_id NUMBER (19)F collector_id NUMBER (19)F determiner_id NUMBER (19)F regionLevel2_id NUMBER (19)F country_id NUMBER (19)
H_PRECISION VARCHAR2 (255 char)
H_CONTRIBUTION_PK (id)
FKE522AAA747140EFE (user_id)FKE522AAA7476B7E96 (mission_id)FKE522AAA77CD8C907 (collector_id)FKE522AAA786F20F5E (regionLevel1_id)FKE522AAA786F283BE (regionLevel2_id)FKE522AAA79B84A56 (country_id)FKE522AAA7DD1F69D5 (determiner_id)FKE522AAA7FC7D37DE (specimen_id)
H_USER*P i d NUMBER (19)
address VARCHAR2 (255 char)* admin NUMBER (1)
birthDate TIMESTAMPcity VARCHAR2 (255 char)country RAW (255)description VARCHAR2 (255 char)email VARCHAR2 (255 char)facebookId VARCHAR2 (255 char)facebookUsername VARCHAR2 (255 char)firstName VARCHAR2 (255 char)
* hasImage NUMBER (1)image VARCHAR2 (255 char)imageId NUMBER (19)lastName VARCHAR2 (255 char)
* leader NUMBER (1)CURRENT_LEVEL NUMBER (10)login VARCHAR2 (255 char)password VARCHAR2 (255 char)PENDING_LEVEL NUMBER (10)
* publishInformations NUMBER (1)* receiveMails NUMBER (1)
registrationDate TIMESTAMP
H_USER_PK (id)
H_SPECIMEN*P i d NUMBER (19)
code VARCHAR2 (255 char)collection VARCHAR2 (255 char)
* complete NUMBER (1)* displayed NUMBER (1)
family VARCHAR2 (255 char)firstDiplayed TIMESTAMPgenus VARCHAR2 (255 char)institute VARCHAR2 (255 char)lastModified TIMESTAMPsonneratURL VARCHAR2 (255 char)tileHeight NUMBER (10)tileWidth NUMBER (10)
* ti led NUMBER (1)tilesBaseURL VARCHAR2 (255 char)
* tilingError NUMBER (1)tropicosURL VARCHAR2 (255 char)
* unusable NUMBER (1)ALEA VARCHAR2 (255 char)
H_SPECIMEN_PK (id)
H_CONTRIBUTION_REPORT* type VARCHAR2 (31 char)*P i d NUMBER (19)* complete NUMBER (1)* conflicts NUMBER (1)
count NUMBER (10)lastModified TIMESTAMP
F specimen_id NUMBER (19)validatedContribution_id NUMBER (19)
H_CONTRIBUTION_REPORT_PK (id)
FKED9DA1CCFC7D37DE (specimen_id)
H_CHOICE*P i d NUMBER (19)* answer NUMBER (1)
text VARCHAR2 (255 char)F question_id NUMBER (19)
H_CHOICE_PK (id)
FK4F34ED786AB4470F (question_id)
H_QUESTION*P i d NUMBER (19)
answerDetails VARCHAR2 (1000 char)* hasImage NUMBER (1)
imageId NUMBER (19)sortIndex NUMBER (10)text VARCHAR2 (255 char)
F quiz_id NUMBER (19)
H_QUESTION_PK (id)
FKA3352DFDF525CF2F (quiz_id)
H_QUIZ*P i d NUMBER (19)
description CLOBcongratulations CLOBlang VARCHAR2 (255 char)name VARCHAR2 (255 char)tit le VARCHAR2 (255 char)
* unlockingLevel NUMBER (10)
H_QUIZ_PK (id)
SEEN_SPECIMEN*PF SPECIMEN_ID NUMBER (19)*PF USER_ID NUMBER (19)*PF MISSION_ID NUMBER (19)
PK_SEEN_SPECIMEN (MISSION_ID, USER_ID, SPECIMEN_ID)
FK_MISSION_ID (MISSION_ID)FK_SPECIMEN_ID (SPECIMEN_ID)FK_USER_ID (USER_ID)
IDX_SPECIMEN_ID (SPECIMEN_ID)IDX_USER_ID (USER_ID)IDX_MISSION_ID (MISSION_ID)
H_ANNOUNCEMENT*P i d NUMBER (19)
PUBLICATION_DATE TIMESTAMP* published NUMBER (1)
text VARCHAR2 (255 char)tit le VARCHAR2 (255 char)
F mission_id NUMBER (19)
H_ANNOUNCEMENT_PK (id)
FK9C7753DE476B7E96 (mission_id)
H_COMMENT* type VARCHAR2 (31 char)*P i d NUMBER (19)
CREATION_DATE TIMESTAMPtext VARCHAR2 (1000 char)
F user_id NUMBER (19)F specimen_id NUMBER (19)F mission_id NUMBER (19)
H_COMMENT_PK (id)
FKA340594847140EFE (user_id)FKA3405948476B7E96 (mission_id)FKA3405948FC7D37DE (specimen_id)
H_CONTENT*P i d NUMBER (19)
lang VARCHAR2 (255 char)name VARCHAR2 (255 char)text CLOBtit le VARCHAR2 (255 char)ur l VARCHAR2 (255 char)
H_CONTENT_PK (id)
H_IMAGE*P i d NUMBER (19)
data BLOBmimeType VARCHAR2 (255 char)
H_IMAGE_PK (id)
H_LINK*P i d NUMBER (19)
lang VARCHAR2 (255 char)tit le VARCHAR2 (255 char)ur l VARCHAR2 (255 char)
H_LINK_PK (id)
H_BOTANIST*P i d NUMBER (19)
countries CLOB* createdByUser NUMBER (1)
harvardId NUMBER (19)* hasImage NUMBER (1)
herborariumIndex VARCHAR2 (255 char)imageId NUMBER (19)name VARCHAR2 (255 char)nameInv VARCHAR2 (255 char)period VARCHAR2 (255 char)speciality CLOB
H_BOTANIST_PK (id)
H_ALERT* type VARCHAR2 (31 char)*P i d NUMBER (19)
CREATION_DATE TIMESTAMP* emailSent NUMBER (1)* userRead NUMBER (1)
F user_id NUMBER (19)F mission_id NUMBER (19)F specimenComment_id NUMBER (19)F contribution_id NUMBER (19)F missionComment_id NUMBER (19)
H_ALERT_PK (id)
FK86949E8547140EFE (user_id)FK86949E85476B7E96 (mission_id)FK86949E85923C7924 (specimenComment_id)FK86949E85D7DF3C90 (missionComment_id)FK86949E85FB39F789 (contribution_id)
H_REGION_LEVEL_1*P i d NUMBER (19)
name VARCHAR2 (255 char)F country_id NUMBER (19)
H_REGION_LEVEL_1_PK (id)
FK4E51C8A29B84A56 (country_id)
H_REGION_LEVEL_2*P i d NUMBER (19)
name VARCHAR2 (255 char)F region1_id NUMBER (19)
H_REGION_LEVEL_2_PK (id)
FK4E51C8A3AD82F742 (region1_id)
configura'on files
applica4on.conf i18n routes
configura'on files applica4on.conf i18n 1. add the language in the configura4on.conf 2. create the messages.<lang> 3. The browser will choose our default language as language in the herbonaute routes
messages.fr
messages.en
configura'on files
applica4on.conf i18n routes GET : select on the database POST : insert into the database {} : variable sent by the HTTP or received by the HTTP
Installa4on 1. Install Play Framework version 1.3.7 2. Check out the project with Eclipse 3. Create tables with the DDL located in resources/herbonautes.ddl 4. Edit the configura4on file (applica4on.conf)
a. define i18n b. database configura4on c. Facebook connec4on d. e-‐mail configura4on e. configura4on of func4onality of the herbonautes
5. Create the war file directly in eclipse a. Go to the project workspace file of Eclipse b. Verify the JAVA_HOME configura4on c. Execute the command
play war path_to_the_project --%key –zip –o war_name!6. Deploy in Tomcat and restart it
Configura4on 1. Future leaders sign in 2. Admin gives the Leader role to the users 3. Leaders create their mission 4. Calcula4on of 4les 5. Leaders publish their mission 6. Admin creates a quiz by level
Then open the website to the public and play !
Algorithm
Contribu4on Random draw
Contribu4on (1/6) Result from older versions
• Calcula4on of the complete specimen was not working
• Botanist type was not efficient • Latency period when dele4ng contribu4ons • Latency period when clicking on the next specimen bumons (see random draw)
• Difficulty with e-‐mail alerts and conflicts
Improvement in the version 1.3
Contribu4on (2/6) Algorithm
1. Add a contribu4on
2. Add or modify a contribu4on report
3. Calcula4on of the complete specimen
4. JSON crea4on and view in the contribu4on board
5. Send an alert in case of conflict
Contribu4on (3/6)
Add a contribu4on type
Contribu4ons.add<type>(specimenId)
Add a contribu4on
Contribu4ons.addContribu4on(specimenId)
If you have already contributed for this type and this specimen, the old contribu4on is cancelled. The contribu4on is added to the specimen The event ‘CONTRIBUTION_ADD’ is added to the user ac4vity
Step 1 and 2 of the algorithm
Contribu4on (4/6)
Add or modify the contribu4on report
model.Contribu4on.feedback(Contribu4on) model.Contribu4on.feedback(Contribu4on, boolean showConflicts) model.Contribu4onReport compile(Contribu4onFeedback feedback)
-‐ Calculate if the contribu4on is in conflict with another one (flag ‘conflict’ in the contribu4on report table).
-‐ Calculate if the specimen is completed.
Step 3 of the algorithm
Contribu4on (5/6)
Crea4on of the JSON
controller.Contribu4ons.renderContribu4on(Contribu4on, JsonSerializer<Contribu4on> serializer) controller.Missions.contribu4onBoard(missionId, specimenId) models.serializer.contribu4ons.<type>Contribu4onJsonSerializer.serialize(contribu4on, type, JsonSerializa4onContext context)
Step 4 of the algorithm
If there is conflicts
Contribu4on (6/6) Step 5 of the algorithm
Procedure
1. Alert is created in the database 2. An e-‐mail is sent to the user in conflict with
different links 3. On the page contribu4on, if you click on
the conflict symbol, you will be able to see the modal and change your contribu4on.
Random Draw (1/8) Result from older versions
• Total random draw • Some specimens were not chosen • Specimens were seen by user several 4mes • Complete specimens were not removed • Latency
Development of a new algorithm in the version 1.3
Random Draw (2/8) Algorithm
1. Create a random iden4fier for each specimen based on the ins4tu4on, dataset and specimen code and encode it.
2. Each specimen has to be seen at least one 4me. 3. Each user will see or contribute to each
specimen not complete. 4. Real random draw on all of the not complete
specimens.
Random Draw (3/8) Database system for the random draw
Random Draw (4/8)
Controller method of the random draw
Random Draw (5/8)
Create and save the specimen seen
Random Draw (6/8) Step 2 of the algorithm
Random Draw (7/8) Step 3 of the algorithm
Random Draw (8/8) Step 4 of the algorithm
Discussion
J Thank you J