SlideShare une entreprise Scribd logo
1  sur  16
Télécharger pour lire hors ligne
How We Use Bottle and
    Elasticsearch
  An Adventure in Sinar Project
A background of Malaysian Bill
Watcher
● The big idea, is to let citizen knows what is
  happening in parliament, bills being debated
  and pass
● No it doesn't know the bills that is not
  debated yet.
● Its is scraper based, just because the
  parliament site tend to be stand alone, and
  nobody bother to go there.
● And cheat on twitter notification
The result
● Didn't quite worked out.
● That is not the point of this talk
● You can talk to us later on this
What we use?
● We use bottle micro framework.
● Elasticsearch via pyes
● sqlalchemy for db abstraction(seriously
  thinking to move to mongodb instead, idea?)
● We use bootstrap for css and their js plugin
● with jquery
● Beaufifulsoup for scraping(that is our data
  source)

We only going to cover pyes and bottle
(talk to me later for everything else)
Bottle
●   A micro framework
●   Similar to flask!!!
●   Less feature though
●   But it is OKAY.
Bottle a views
● https://github.com/Sinar/Malaysian-Bill-
  Watcher/blob/master/billwatcher/pages.py
● https://github.com/Sinar/Malaysian-Bill-
  Watcher/blob/master/billwatcher/pages.py
What happen?
● Bottle can return a dict, and it automatically
  output json, if the object in dict is compatible
● Or with View Decorator, the dict can be feed
  to a template
bottle the template
● https://github.com/Sinar/Malaysian-Bill-
  Watcher/blob/master/billwatcher/views/list.tpl
●
What happen?
● Bottle read template from a dict/object
● like most templating language does.
● Have some logic like other, different syntax
  same idea
● Don't have good inheritance though
elasticsearch!!!
● OK I lied, this is written in JAVA
● But hey, it got RESTful API
● and pyes did a lot of the stuff for us already
Before index
● before we do that
● we don't need to create a schema
● But we do it because we can control the
  search priority
Indexer
● https://github.com/Sinar/Malaysian-Bill-
  Watcher/blob/master/billwatcher/indexer.py
then we index
● First flatten your result
● convert to dict
● index
The indexer
● https://github.com/Sinar/Malaysian-Bill-
  Watcher/blob/master/billwatcher/indexer.py
● https://github.com/Sinar/Malaysian-Bill-
  Watcher/blob/master/billwatcher/loader.py
now we search!!!!
● There is some field inside the search result
● https://github.com/Sinar/Malaysian-Bill-
  Watcher/blob/master/billwatcher/pages.py
The future
●   Do localization
●   Find new data source
●   Move template to jinja
●   Seriously thinking of moving to mongodb
●   Seriously still trying to see a better way to
    scrape websites

Contenu connexe

Tendances

Tendances (10)

iRail at hack democracy
iRail at hack democracyiRail at hack democracy
iRail at hack democracy
 
ADDO 2019: Looking back at over 10 years of Devops
ADDO 2019:    Looking back at over 10 years of DevopsADDO 2019:    Looking back at over 10 years of Devops
ADDO 2019: Looking back at over 10 years of Devops
 
RealDay: Angular.js
RealDay: Angular.jsRealDay: Angular.js
RealDay: Angular.js
 
Joomla JLayout
Joomla JLayout Joomla JLayout
Joomla JLayout
 
Last Month in PHP - June through Mid-July 2017
Last Month in PHP - June through Mid-July 2017Last Month in PHP - June through Mid-July 2017
Last Month in PHP - June through Mid-July 2017
 
Successful Joomla migrations that don't hurt Search Engine Rankings
Successful Joomla migrations that don't hurt Search Engine RankingsSuccessful Joomla migrations that don't hurt Search Engine Rankings
Successful Joomla migrations that don't hurt Search Engine Rankings
 
Agile work practices and tools
Agile work practices and toolsAgile work practices and tools
Agile work practices and tools
 
Creating Content in a Pattern Library
Creating Content in a Pattern LibraryCreating Content in a Pattern Library
Creating Content in a Pattern Library
 
JLayout for extension developers
JLayout for extension developersJLayout for extension developers
JLayout for extension developers
 
Tetuan Valley Startup School - Guest mentor Angel Luis Quesada (Kubide)
Tetuan Valley Startup School - Guest mentor Angel Luis Quesada (Kubide)Tetuan Valley Startup School - Guest mentor Angel Luis Quesada (Kubide)
Tetuan Valley Startup School - Guest mentor Angel Luis Quesada (Kubide)
 

En vedette

Get ready for dreamforce 2012
Get ready for dreamforce 2012Get ready for dreamforce 2012
Get ready for dreamforce 2012
sfdcbestpractices
 

En vedette (12)

Why I liked Mezzanine CMS
Why I liked Mezzanine CMSWhy I liked Mezzanine CMS
Why I liked Mezzanine CMS
 
All you need is...Mezzanine!
All you need is...Mezzanine!All you need is...Mezzanine!
All you need is...Mezzanine!
 
Django tips & tricks
Django tips & tricksDjango tips & tricks
Django tips & tricks
 
Mezzanine簡介 (at) Taichung.py
Mezzanine簡介 (at) Taichung.pyMezzanine簡介 (at) Taichung.py
Mezzanine簡介 (at) Taichung.py
 
Get ready for dreamforce 2012
Get ready for dreamforce 2012Get ready for dreamforce 2012
Get ready for dreamforce 2012
 
Web micro-framework BATTLE!
Web micro-framework BATTLE!Web micro-framework BATTLE!
Web micro-framework BATTLE!
 
Flask vs. Django
Flask vs. DjangoFlask vs. Django
Flask vs. Django
 
Machine Learning and Deep Learning with R
Machine Learning and Deep Learning with RMachine Learning and Deep Learning with R
Machine Learning and Deep Learning with R
 
SXSW 2014: Re-orientating UX Design for the Internet of Things
SXSW 2014: Re-orientating UX Design for the Internet of ThingsSXSW 2014: Re-orientating UX Design for the Internet of Things
SXSW 2014: Re-orientating UX Design for the Internet of Things
 
Overcome the 6 Traps of Agile
Overcome the 6 Traps of AgileOvercome the 6 Traps of Agile
Overcome the 6 Traps of Agile
 
Customer Churn Analytics using Microsoft R Open
Customer Churn Analytics using Microsoft R OpenCustomer Churn Analytics using Microsoft R Open
Customer Churn Analytics using Microsoft R Open
 
Fatal journeys (Team 621) Lessons Learned H4Dip Stanford 2016
Fatal journeys (Team 621) Lessons Learned H4Dip Stanford 2016Fatal journeys (Team 621) Lessons Learned H4Dip Stanford 2016
Fatal journeys (Team 621) Lessons Learned H4Dip Stanford 2016
 

Similaire à How we use Bottle and Elasticsearch

2014 03-25 - GDG Nantes - Web Components avec Polymer
2014 03-25 - GDG Nantes - Web Components avec Polymer2014 03-25 - GDG Nantes - Web Components avec Polymer
2014 03-25 - GDG Nantes - Web Components avec Polymer
Horacio Gonzalez
 
Counterclockwise past present future
Counterclockwise  past present futureCounterclockwise  past present future
Counterclockwise past present future
lolopetit
 
About order form improvements
About order form improvementsAbout order form improvements
About order form improvements
Gengo
 
Introduction to Gengo's New Order Form tech
Introduction to Gengo's New Order Form techIntroduction to Gengo's New Order Form tech
Introduction to Gengo's New Order Form tech
Gengo
 

Similaire à How we use Bottle and Elasticsearch (20)

Python in Industry
Python in IndustryPython in Industry
Python in Industry
 
Kentico Cloud Best Practices
Kentico Cloud Best PracticesKentico Cloud Best Practices
Kentico Cloud Best Practices
 
Super lazy side projects - Hamik Mukelyan
Super lazy side projects - Hamik MukelyanSuper lazy side projects - Hamik Mukelyan
Super lazy side projects - Hamik Mukelyan
 
Devoxx France - Web Components, Polymer et Material Design
Devoxx France -  Web Components, Polymer et Material DesignDevoxx France -  Web Components, Polymer et Material Design
Devoxx France - Web Components, Polymer et Material Design
 
Prototype4Production Presented at FOSSASIA2015 at Singapore
Prototype4Production Presented at FOSSASIA2015 at SingaporePrototype4Production Presented at FOSSASIA2015 at Singapore
Prototype4Production Presented at FOSSASIA2015 at Singapore
 
2014 03-25 - GDG Nantes - Web Components avec Polymer
2014 03-25 - GDG Nantes - Web Components avec Polymer2014 03-25 - GDG Nantes - Web Components avec Polymer
2014 03-25 - GDG Nantes - Web Components avec Polymer
 
Mixing Plone and Django for explosive results
Mixing Plone and Django for explosive resultsMixing Plone and Django for explosive results
Mixing Plone and Django for explosive results
 
Counterclockwise past present future
Counterclockwise  past present futureCounterclockwise  past present future
Counterclockwise past present future
 
Community and Github: 7/27/2011
Community and Github: 7/27/2011Community and Github: 7/27/2011
Community and Github: 7/27/2011
 
Getting started contributing to Apache Spark
Getting started contributing to Apache SparkGetting started contributing to Apache Spark
Getting started contributing to Apache Spark
 
Beyond Polymer - JUG Summer Camp - 2015-09-18
Beyond Polymer - JUG Summer Camp - 2015-09-18Beyond Polymer - JUG Summer Camp - 2015-09-18
Beyond Polymer - JUG Summer Camp - 2015-09-18
 
Sharing (or stealing) the jewels of python with big data & the jvm (1)
Sharing (or stealing) the jewels of python with big data & the jvm (1)Sharing (or stealing) the jewels of python with big data & the jvm (1)
Sharing (or stealing) the jewels of python with big data & the jvm (1)
 
Kubernetes: The Very Hard Way
Kubernetes: The Very Hard WayKubernetes: The Very Hard Way
Kubernetes: The Very Hard Way
 
Me&g@home
Me&g@home Me&g@home
Me&g@home
 
Getting Started Contributing to Apache Spark – From PR, CR, JIRA, and Beyond
Getting Started Contributing to Apache Spark – From PR, CR, JIRA, and BeyondGetting Started Contributing to Apache Spark – From PR, CR, JIRA, and Beyond
Getting Started Contributing to Apache Spark – From PR, CR, JIRA, and Beyond
 
About order form improvements
About order form improvementsAbout order form improvements
About order form improvements
 
Introduction to Gengo's New Order Form tech
Introduction to Gengo's New Order Form techIntroduction to Gengo's New Order Form tech
Introduction to Gengo's New Order Form tech
 
Trino: A Ludicrously Fast Query Engine - Pulsar Summit NA 2021
Trino: A Ludicrously Fast Query Engine - Pulsar Summit NA 2021Trino: A Ludicrously Fast Query Engine - Pulsar Summit NA 2021
Trino: A Ludicrously Fast Query Engine - Pulsar Summit NA 2021
 
Serverless for High Performance Computing
Serverless for High Performance ComputingServerless for High Performance Computing
Serverless for High Performance Computing
 
Build, deploy and scale: Django, GraphQL and SPA (DjangoCon EU 2021)
Build, deploy and scale: Django, GraphQL and SPA  (DjangoCon EU 2021)Build, deploy and scale: Django, GraphQL and SPA  (DjangoCon EU 2021)
Build, deploy and scale: Django, GraphQL and SPA (DjangoCon EU 2021)
 

Plus de swee meng ng (9)

Civic tech in malaysia and beyond
Civic tech in malaysia and beyondCivic tech in malaysia and beyond
Civic tech in malaysia and beyond
 
High Level View of Civic Tech
High Level View of Civic TechHigh Level View of Civic Tech
High Level View of Civic Tech
 
Python on pi
Python on piPython on pi
Python on pi
 
Lvl.up
Lvl.upLvl.up
Lvl.up
 
Data prospecting
Data prospectingData prospecting
Data prospecting
 
Hackerspacekl
HackerspaceklHackerspacekl
Hackerspacekl
 
Build website in_django
Build website in_django Build website in_django
Build website in_django
 
a hands on guide to django
a hands on guide to djangoa hands on guide to django
a hands on guide to django
 
introduction to linux desktop draft 5
introduction to linux desktop draft 5introduction to linux desktop draft 5
introduction to linux desktop draft 5
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Dernier (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 

How we use Bottle and Elasticsearch

  • 1. How We Use Bottle and Elasticsearch An Adventure in Sinar Project
  • 2. A background of Malaysian Bill Watcher ● The big idea, is to let citizen knows what is happening in parliament, bills being debated and pass ● No it doesn't know the bills that is not debated yet. ● Its is scraper based, just because the parliament site tend to be stand alone, and nobody bother to go there. ● And cheat on twitter notification
  • 3. The result ● Didn't quite worked out. ● That is not the point of this talk ● You can talk to us later on this
  • 4. What we use? ● We use bottle micro framework. ● Elasticsearch via pyes ● sqlalchemy for db abstraction(seriously thinking to move to mongodb instead, idea?) ● We use bootstrap for css and their js plugin ● with jquery ● Beaufifulsoup for scraping(that is our data source) We only going to cover pyes and bottle (talk to me later for everything else)
  • 5. Bottle ● A micro framework ● Similar to flask!!! ● Less feature though ● But it is OKAY.
  • 6. Bottle a views ● https://github.com/Sinar/Malaysian-Bill- Watcher/blob/master/billwatcher/pages.py ● https://github.com/Sinar/Malaysian-Bill- Watcher/blob/master/billwatcher/pages.py
  • 7. What happen? ● Bottle can return a dict, and it automatically output json, if the object in dict is compatible ● Or with View Decorator, the dict can be feed to a template
  • 8. bottle the template ● https://github.com/Sinar/Malaysian-Bill- Watcher/blob/master/billwatcher/views/list.tpl ●
  • 9. What happen? ● Bottle read template from a dict/object ● like most templating language does. ● Have some logic like other, different syntax same idea ● Don't have good inheritance though
  • 10. elasticsearch!!! ● OK I lied, this is written in JAVA ● But hey, it got RESTful API ● and pyes did a lot of the stuff for us already
  • 11. Before index ● before we do that ● we don't need to create a schema ● But we do it because we can control the search priority
  • 12. Indexer ● https://github.com/Sinar/Malaysian-Bill- Watcher/blob/master/billwatcher/indexer.py
  • 13. then we index ● First flatten your result ● convert to dict ● index
  • 14. The indexer ● https://github.com/Sinar/Malaysian-Bill- Watcher/blob/master/billwatcher/indexer.py ● https://github.com/Sinar/Malaysian-Bill- Watcher/blob/master/billwatcher/loader.py
  • 15. now we search!!!! ● There is some field inside the search result ● https://github.com/Sinar/Malaysian-Bill- Watcher/blob/master/billwatcher/pages.py
  • 16. The future ● Do localization ● Find new data source ● Move template to jinja ● Seriously thinking of moving to mongodb ● Seriously still trying to see a better way to scrape websites