U bent hier

Voortbestaan

Wijzigingen lijsten open standaarden, 23 maart

Forum Standaardisatie - 26 maart 2020 - 2:49pm

Op 23 maart 2020 heeft het Overheidsbrede Beleidsoverleg Digitale Overheid (OBDO) twee wijzigingen aan de officiële lijsten met open standaarden goedgekeurd. GWSW wordt als verplichte standaard op de ‘Pas toe of leg uit’-lijst opgenomen en OIDC wordt op de lijst Aanbevolen standaarden geplaatst. Beide aanpassingen zijn per direct ingegaan.

GWSW, ‘Pas toe of leg uit’
GWSW staat voor Gegevenswoordenboek Stedelijk Water. Door inzet van deze standaard kunnen significante verbeteringen ontstaan in gegevensbeheer, met name voor het gezamenlijk beheren van stedelijke (afval)watersystemen.

GWSW maakt het mogelijk om diverse objecten die een rol spelen bij waterbeheer te visualiseren op een gebiedskaart, bijvoorbeeld uitlaten en pompen. Het uitwisselen van gegevens tussen beheersystemen onderling wordt makkelijker en het berekenen van de watercapaciteit gaat spoediger. De standaard draagt daarmee bij aan interoperabiliteit in de benodigde informatievoorziening rondom waterbeheer.

OIDC, aanbevolen standaarden
OIDC (OpenID Connect) is een open en gedistribueerde manier om authenticatiediensten naar keuze te kunnen hergebruiken bij meerdere (semi-)overheidsdienstverleners.

De standaard geeft apparaten en programma’s de mogelijkheid om de identiteit van een gebruiker te controleren op basis van verschillende authenticatieservices, waarbij profielinformatie van gebruiker volgens een gestandaardiseerde wijze beschikbaar wordt gesteld aan de daarvoor geautoriseerde apparaten en programma’s.
Door OIDC op te nemen op de lijst aanbevolen standaarden wil Forum Standaardisatie een impuls geven aan de ontwikkeling van een breed gedragen Nederlands profiel voor de standaard.

Event date donderdag, maart 26, 2020

A new homeschooling resource on file formats

Mad File Format Science - 20 maart 2020 - 11:05am

Continuing from the theme of my last post, I’ve created a page for learning about file formats. I don’t know much about educational theory, but I’ve picked out links to articles and videos which I consider suitable for high school students starting out to learn about formats. With so many people figuring out how to educate their kids without classrooms, creating resources is one thing I can do. If you think the page is useful, please link to it where the people who can use it will see it.

Helping a nation of homeschoolers: Digital preservation

Mad File Format Science - 18 maart 2020 - 1:13pm

We’ve abruptly become a nation of homeschoolers. People are figuring out how to do it with no preparation. They have to face a lot of issues, most of which I’m not helpful with. One of them is finding good material on the Internet. There’s no lack of well-written, informative pages; the hard part is sorting them out from all the garbage. Many of us can help in our fields of expertise by providing pointers to the best material.

On Twitter I saw a call for “expert sniffers,” people who can find the experts. We can do that where we’re specialists if not experts. We need to find articles that are good from an educational standpoint. Presenting all the knowledge isn’t enough; the hard part is presenting it in a way that learners can understand.

I’ll be reviving this blog for a little while to provide some guides as best I can. To start with, I’m offering my e-book, Files that Last, for just 99 cents through the end of April. It’s seven years old, but as a book for “everygeek,” it still has useful information for people trying to understand how they can preserve their data. It might even help some students to start toward a career in digital preservation. At that price, buyers aren’t risking much.

The coupon code to get the special 99-cent price on Files that Last is DS75L.

I’m planning to follow this post with some curated link collections on file formats and preservation.

If you’ve got an area of specialization, you could do something similar. Feel free to link to this post.

Locating and Sampling Arabic and Arabic-Malayalam Manuscripts in Kerala, South India

Endangered Archives Blog - 27 februari 2020 - 9:39am
This initiative to locate and survey endangered archives in Kerala was awarded as a pilot project grant by the Endangered Archive Programme in May 2019. Besides surveying and contacting public and...

(From the Endangered Archives Blog: Lynda Barraclough on histories in peril)

Beyond Digitisation: Engaging the Community Around The Barbados Mercury

Endangered Archives Blog - 27 februari 2020 - 9:34am
While digitisation of the Barbados Mercury (EAP1086) was completed in December 2018, it was not an endpoint. It allowed the Barbados Archives to initiate a series of workshops and initiatives aiming...

(From the Endangered Archives Blog: Lynda Barraclough on histories in peril)

Rare Buddhist Sanskrit Manuscripts from Rural Kathmandu and the Hill Areas of Nepal

Endangered Archives Blog - 27 februari 2020 - 9:31am
Among all the ancient languages, Sanskrit excels as being used in the greatest number of written works. Sanskrit is used for mainly Hindu and Buddhist manuscripts, covering medical manuals,...

(From the Endangered Archives Blog: Lynda Barraclough on histories in peril)

Delivering Research Data Management Services (DRDMS) MOOC

Digital Curation Centre - 26 februari 2020 - 2:39pm
Our successful online course on Delivering Research Data Management Services is now on its second run since the 24th of February. Over 1500 participants from 116 countries joined us earlier in September. Following the incredible interest in the material, the course is now CPD CertifiedJoin us now! Watch the trailer.           

Read more

Save the non-confirmed date!

Digital Curation Centre - 23 februari 2020 - 1:47pm
RDM service delivery models: procure, provide, partner 16th OR 17th March, Melbourne We have a workshop agenda and provisional room booking but need your input to confirm dates and locations! See the event programme and register your interest. Image by John Schnobrich

Read more

Openbare consultatie: REST API Design Rules, EPUB 3.2 en OAuth

Forum Standaardisatie - 21 februari 2020 - 7:01am

Van 21 februari tot en met 20 maart houdt Forum Standaardisatie openbare consultatie over drie  voorgestelde wijzingen met betrekking tot de ‘Pas toe of leg uit’-lijst en de lijst Aanbevolen standaarden. Deze adviezen komen voort uit de toetsingsprocedure van het Forum. Via internetconsultatie.nl kunt u de volledige adviezen lezen en er over meepraten.
U kunt reageren op:

  • Het advies om de standaard REST API Design Rules op de ‘pas toe of leg uit’ lijst te plaatsen. Met REST API’s kunnen applicaties en databronnen snel en effectief met elkaar verbinden en eenvoudig informatie uitwisselen. Meer info en/of reageer: https://www.internetconsultatie.nl/epub.

  • Het advies voor een versiewijzing van EPUB (naar 3.2) op de lijst van aanbevolen standaarden. EPUB is een standaard voor het publiceren van niet-reviseerbare elektronische documenten, geoptimaliseerd voor gebruik op - maar niet beperkt tot - draagbare apparaten zoals e-readers, tablets en smartphones.
    Meer info en/of reageer: https://www.internetconsultatie.nl/rest_api_design_rules.

  • Het advies om het Nederlands overheidsprofiel OAuth op de ‘pas toe of leg uit’-lijst te plaatsen conform het Forumadvies van 2017. En om de onderliggende standaard OAuth op de lijst aanbevolen standaarden te plaatsen. Meer info en/of reageer: https://www.internetconsultatie.nl/oauth.

Openbare consultaties

Forum Standaardisatie biedt na het afronden van een toetsingsprocedure de mogelijkheid om te reageren op de opgestelde adviezen. Heeft u opmerkingen, vragen of problemen? Geef deze dan binnen de aangegeven termijn door. De ingezonden reacties worden door Forum Standaardisatie in beschouwing genomen.
 

Event date vrijdag, februari 21, 2020

Grip krijgen op goed domeinnaambeheer

Forum Standaardisatie - 20 februari 2020 - 9:59am

Een wildgroei van websites, onduidelijke domeinnamen en inconsistente extensies. Als burger zie je soms door de bomen het bos niet meer. Goed domeinnaambeheer is voor de overheid cruciaal om betrouwbaar en duidelijk informatie uit te wisselen, maar hoe pak je dat nu op? We interviewden drie projectinitiators/-managers die domeinnaambeheer voor e-mail en/of websites hebben aangepakt voor hun organisatie.

domeinnaamopruim.png Afbeelding van een prullenbak met daarin domeinamen

Ruud Paulusse (Nationale Politie), Ahmed Daoud (Ministerie BZK) en Raoul Zonnenberg (Ministerie VWS) vertellen in de interviews hoe zij domeinbeheer aangepakt hebben. Afspraken maken, draagvlak creëren, volhouden en durven om de bezem er doorheen te halen; dat zijn enkele van de tips die zij ons meegeven. Goed domeinnaambeheer vereist tijd/capaciteit en draagvlak. Gelukkig zijn er een hoop partijen die je kunnen helpen. 

Lees het interview in iBestuur Magazine #33, pagina 48.

Event date donderdag, februari 20, 2020

Buddhism on the ground

Endangered Archives Blog - 7 februari 2020 - 11:58pm
A manuscript in Sanskrit and Newari, showing how to set up an altar. EAP790/1/1 A European scholar of Buddhism, Edward Conze, once said of Buddhist monks that "they are the only Buddhists in the true...

(From the Endangered Archives Blog: Lynda Barraclough on histories in peril)

Going on standby

Mad File Format Science - 26 januari 2020 - 1:38pm

I’ve kept this blog going for years. People are still reading it; my stats show 140 views yesterday, and that was on a Saturday! However, I’m no longer active in digital preservation, other people have taken over JHOVE, and professionally I’m now a writer rather than a software developer.

It’s better to do a few things well rather than spread myself too thin. That’s why I’m putting this blog on standby status. There could be occasional posts here if something especially interesting turns up, but they’ll be infrequent. This will help me to focus more on my writing blog and other projects, such as my novel The Magic Battery.

Thanks to everyone who’s read and commented on this blog over the years.

Using Urdu Periodicals to Uncover Women's Voices in India

Endangered Archives Blog - 20 januari 2020 - 12:25pm
In this post, Sabera Bhayat, a PhD student at the University of Warwick tells us how she has used EAP digital collections in her research on Urdu periodicals, which she has just presented at the...

(From the Endangered Archives Blog: Lynda Barraclough on histories in peril)

Preserving Yahoo Groups

Mad File Format Science - 11 december 2019 - 12:47pm

Yahoo is sending out alerts on the transformation of Yahoo Groups into a list server. The spin is ridiculous. The changes “better align with user habits,” and “we are making adjustments to ultimately serve you better.” It’s as if users had been protesting against the existence of public groups and Web-hosted discussions and Yahoo were complying with the demand.

Yahoo, in case you haven’t been keeping track (I hadn’t), now belongs to Verizon. It makes economic decisions, and one was that running public Yahoo Groups was no longer worth the cost and effort. This is the result of changing user preferences, as well as stupid policy decisions over the years that drove people away. The attempts to correct those blunders may be part of the current problem.

According to PC Magazine, Verizon is making it difficult to archive public groups. On this Saturday, December 14, public Yahoo Groups will come to an end. They’re already read-only. People can download their own content until January 31, 2020. However, anyone who wants to download all the content has few options.

Volunteer archivists used a “semi-automated” tool to capture the content of their groups for preservation. However, Verizon has blocked their accounts for violating the terms of service. A group called Archive Team (which I think is unrelated to archiveteam.org) says that its members have lost access to over 55,000 groups, including 30,000 characterized as “fandom.”

Too much “privacy”?

This might be a case where Yahoo is constrained by its own terms of service and privacy policy. It has prohibitions against content scraping and mass downloading. Perhaps the people running it think they’d be violating users’ privacy expectations by changing the terms now. However, Yahoo’s terms of service (now under the name Verizon Media) have a perfectly usable escape clause: “Unless stated differently for your country in Section 14, we may modify the Terms from time to time. Unless we indicate otherwise, modifications will be effective as of the date they are posted on this page or any successor page.” In fact, the most recent update was December 2019.

The terms say that “when you upload, share with or submit content to the Services you retain ownership of any intellectual property rights that you hold in that content and you grant to us a worldwide, royalty-free, non-exclusive, perpetual, irrevocable, transferable, sublicensable license to (a) use, host, store, reproduce, modify, prepare derivative works (such as translations, adaptations, summaries or other changes), communicate, publish, publicly perform, publicly display, and distribute this content in any manner, mode of delivery or media now known or developed in the future; and (b) permit other users to access, reproduce, distribute, publicly display, prepare derivative works of, and publicly perform your content via the Services, as may be permitted by the functionality of those Services (e.g., for users to re-blog, re-post or download your content).” That seems to give Verizon enough leeway to allow bulk downloading, or pretty much any use of the content.

It would have been less effort for Verizon to allow the archiving. There’s a lot of legal material in the terms, and I may have missed something important. Some users would doubtless prefer to have their old posts forgotten and buried. I wonder if Verizon is worried about the so-called “right to be forgotten,” which is enshrined in the EU’s GDPR.

The options are meager for preservation, but at least you can preserve your own content. If you’ve put anything on Yahoo Groups that might be worth keeping, pay attention to the email you should recently have received. You can always delete your personal archive later if you change your mind.

Additional note

Update, December 13: I came across a post on Reddit about preserving a group related to Girl Genius. The post says: “In completing the backup it was revealed to me that private information was not obscured. Information such as users email names and associated IP addresses + resolved hostnames. This revelation means I cannot in good faith share the files to anyone.” The inability to suppress private information may explain why Verizon is fighting the archivists.

When it came to the privacy of dissidents, Yahoo was happy to turn over personal information to the Chinese government. That’s one of the reasons users have fled from Yahoo for the past decade.

Nefertiti, now available as a 3D scan

Mad File Format Science - 19 november 2019 - 11:58am

Bust of Nefertiti, from 3D scan, Egyptian Museum of BerlinOne of my favorite areas in Berlin is the Museum Island. It includes the Egyptian Museum, which is part of the Neues Museum. Among its most famous possessions is a bust of Nefertiti which dates from about 1340 BCE. The museum has an entire room dedicated to Nefertiti.

More relevant to this blog, it has made a detailed 3D scan of the bust. The museum belongs to the Prussian Cultural Heritage Foundation, which is funded by the federal government and the 16 state governments. Supposedly it has an obligation to make its information public, but for reasons that aren’t clear, it held tight to that scan for a long time. It’s now available as a free download, ten years after it was made, thanks to the persistent efforts of Cosmo Wenman. He tells the story on Reason.com.

According to the accompanying text, the download button at the top of the page doesn’t work quite right. There’s another download link in the text which it recommends you use. The download is a ZIP with several files. The important one is aem_aem21300_3dsl01_mo08-03_p.mtl. It’s a Material Template Library (MTL) file, which I haven’t been able to open myself. Supposedly it will open with Photoshop, but it doesn’t open with my (very old) copy. I’d appreciate comments on how usable the scan is.

Copyright 1340 BCE?

The Egyptian Museum and Papyrus Collection claims copyright over the scan and makes it available under a Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International License. It even carved the license notice into the base of the scan. There’s an email address for requesting permission for commercial use. The legitimacy of the copyright claim has been disputed. I’m not a lawyer and definitely not a German lawyer. The museum is government-funded but not directly government-owned.

In any case, the claim doesn’t interfere with research and academic work. Researchers can work with the scan and students can examine it in detail. It’s not the same as having the actual bust in your hands, but it’s as close as anyone is going to get. Perhaps it could even be put on display as a hologram.

More to come?

Nefertiti could be just the beginning. Wenman writes:

The Louvre, for example, has 3D-scanned the Nike of Samothrace and the Venus de Milo. The Galleria dell’Accademia in Florence 3D-scanned Michelangelo’s David. The Bargello has a scan of Donatello’s David. Numerous works by Auguste Rodin, including the Gates of Hell, have been scanned by the Musée Rodin in Paris. The Baltimore Museum of Art got in on the Rodin action when it scanned The Thinker. The Metropolitan Museum of Art has scans of works by Bernini, Michelangelo, and many others. But instead of allowing them to be studied, copied, and adapted by scholars, artists, and digitally savvy art lovers, these museums have kept these scans, and countless more, under lock and key.

Do they think the scans will let anyone create plausible counterfeits? I can’t imagine how. They only show the surface of the work. The hard part of counterfeiting is getting the fake to look, feel, and weigh just like the original. Hopefully it’s just cultural inertia which is preventing the release, and practices will change soon. Then art students will be able to study these works almost as if they had them right at hand.

The scans provide some insurance in case the original is lost or damaged. Nothing makes up for losing an original work of art, but a detailed 3D scan means it’s still possible to examine it as it was. That’s a lot better than nothing. It could also reduce the need to handle the original, increasing its longevity.

Stack Exchange

Mad File Format Science - 18 november 2019 - 1:29pm

I have removed all my profiles on Stack Exchange/Stack Overflow because of the way it has treated its people.

Finale and macOS

Mad File Format Science - 1 november 2019 - 9:06pm

I’m not entirely sure where the right place to put this is. It’s a file format issue in part, since if people can’t keep using Finale after a macOS upgrade, they need to salvage all the files they’re created in its proprietary format.

The email which I got from MakeMusic, dated October 18, was alarming:

Finale v25.5 is not compatible with macOS 10.15 Catalina and will not be updated to support Catalina. It is our recommendation that users of Finale v25.5 not upgrade to macOS Catalina.

Reminder: Finale v25.5 users still qualify for technical assistance from our Support team on compatible operating systems — macOS 10.10 through 10.14 — but we cannot provide support for this version on Catalina or future Apple operating systems.

An entry on the Finale blog, dated the same day, is less apocalyptic:

While our initial testing suggested that Finale v26.1 and Catalina worked pretty well together, four issues prevented us from calling it compatible.

If you’ve never used Maestro Times or exported an .EPS file, you might consider these to be minor concerns. Nevertheless, we take compatibility very seriously and aren’t comfortable glossing over these problems, even if they’re relatively obscure. Instead, we’re working as quickly as we can to fix them and release a free update for all v26 owners.

In the meantime, we recommend that you don’t update to Catalina. Apple still supports Mojave, and delaying the move to Catalina means you’ll have a better Finale experience while we work on these fixes.

Should you find yourself running Finale v26.1 in Catalina and experiencing an issue not listed in this knowledge base article, please Submit a Request to let us know.

… While our extensive testing continues, we are committed to solving these issues ASAP. Finale v26.2 is coming soon and will be free-of-charge to all owners of Finale v26. Among other improvements, it will include full compatibility with macOS 10.15 Catalina.

So what they’re saying isn’t that Finale won’t ever be made compatible with Catalina, but that users with the latest macOS will have to get Version 26, which is a $149 upgrade. They’re still working on compatibility bugs in that version, too. One issue is that exported EPS files are broken. Fixes are expected by Thanksgiving.

Not a lot of people use EPS (Encapsulated PostScript) anymore, but music notation files are tricky, and some users may find the format gives them better results than PDF or anything else. PDF files may get transformed by the printer driver on output; EPS is just PostScript with a thin wrapper, and what you write to the file is what you get.

Bottom line: No need to panic, but if you want to upgrade to Catalina and keep using Finale, you’ll have to spend $149 on the new version. I call that a lot of money to keep using an application I already paid for.

Obligatory digital preservation note: Don’t forget to export all your Finale files before doing any serious software upgrade.

Identifying files by programming language

Mad File Format Science - 11 oktober 2019 - 5:05pm

Most of today’s programming languages look vaguely similar. They’re derived from the C syntax, with similar ways of expressing assignments, arithmetic, conditionals, nested expressions, and groups of statements. If the files have their original extension and it’s accurate, format identification software should be able to classify them correctly.

The software should do some basic checks to make sure it wasn’t handed a binary file with a false extension, which could be dangerous. A code file should be a text file. regardless of the language. (This isn’t strictly true, but non-text languages like Piet and Velato are just obscure for the sake of obscurity.) The UK National Archive recognizes XML and JSON (which is a subset of JavaScript) but doesn’t talk about programming languages as file formats. Exiftool identifies lots of formats but makes no attempt to discern programming languages.

How to tell languages apart

Identifying a file as being in a particular programming language is tricky. Some have self-identifying markers; PHP files, for example, should start with “<?php". Most languages aren't so cooperative.

One approach is to compile the code with several different compilers (or syntax checkers, in the case of interpreted languages). The problem is that source files often need to include other files to compile properly. If those files aren't available, the compiler will issue lots of error messages even if it's syntactically perfect.

Another approach would be to search the files for features which are peculiar to one language. It might take several feature checks to identify a file's language; languages share features, and a particular file might not use all its language's capabilities. For instance, a file with package and import statements ending in a semicolon and public class or public interface declarations is likely to be Java. These are just heuristics, though, and oddly written source code can make even a software engineer wonder what language it is.

A Web search turns up software in Python and Ruby that claims to identify source files by language. I don’t know how well they work, or even if it’s safe to use them. A lot depends on your standards. If you use a small list of languages and assume the file belongs to one of them — let’s say C, Python, Java, JavaScript, PHP, and Ruby — then the job shouldn’t be too hard.

However, it might get false positives if a file is written in a language which is similar to one of them. For example, Groovy is intentionally similar to Java, and a Groovy file might be mistaken for a Java file. There are large numbers of niche languages, and it would be unrealistic to include modules to identify all of them.

There don’t seem to be any tools suitable for libraries and archives that try to identify a file’s programming language. I’m not sure whether this is because of lack of demand or because it’s too hard a problem. Archiving source code seems to be a largely unexplored area. If anyone needs to do it, the best alternative for now may be to run sanity checks for a text file and hope that the extension is correct.

Addendum: Johan van der Knijff pointed me at an article by Dr. Santhilata Kuppili Venkata on some work on machine learning to identify the type of a text file.

Scraper Internet avec Chromium et puppeteer

Kevin Lagaisse - Rien à déclarer - 12 september 2018 - 8:40am
J’irai scraper chez vous

A l’heure de l’ouverture des données, du « tout API », il devient facile d’exploiter, transformer, réutiliser les données mises à dispositions. De nouveaux services émergent.

Nombreux sont ceux qui voient dans l’ouverture des données une manière d’être à la base de certaines innovations d’usages, et une manière, plus mercantile, de valoriser leurs données, « ce nouvel or noir ».

Pour d’autres, il est plus difficile de concevoir la mise à disposition de leurs données, soit parce qu’ils n’y voient pas l’intérêt, soit parce qu’ils veulent rendre captifs leurs clients en empêchant leur libération.

Le web scraping est une technique qui rend le pouvoir aux utilisateurs. Son principe consiste à extraire de l’information non structurée d’un site internet afin de la rendre structurée et exploitable par un système informatique.

On développe alors des robots dont l’objectif est d’automatiser la saisie et la collecte de résultats dans des applications (sites internet, applications métier). Dans leur version intelligente, ces robots, couplés à des systèmes de workflow, observent les actions des utilisateurs afin d’apprendre ce qu’il faut faire à un instant donné. C’est le RPA ou Robotic process automation.

Dans cet article, nous nous concentrerons sur la partie scraping. Nous répondrons à la question « Comment extraire automatiquement de l’information d’un site internet qui n’a pas ouvert ses données ? ».

Pour cela, nous allons travailler avec puppeteer et Chromium sur le site http://quotes.toscrape.com/js/

Quelques usages du web scrapping

Avant cela, posons-nous et interrogeons-nous sur les usages que nous pouvons faire de cette technique. Ainsi, parmi les usages, on notera :

  • L’opendata : il s’agit de rendre disponible auprès de tiers les données collectées pour qu’elles en fasse un usage à définir.
  • L’interopérabilité : il s’agit ici d’intégrer le site internet à une étape d’un processus pour qu’il puisse échanger des données avec un autre système sans que les deux ne se connaissent.
  • La mobilité : pendant du point précédent, il s’agit de rendre accessible une application web depuis d’autres types de terminaux. Ainsi, il est par exemple possible de faire une application mobile qui discuterait avec un système automatisant les saisies dans une application non prévue pour l’usage mobile.
  • L’archivage de sites internet : avec ce type de technique il est possible d’automatiser la navigation et l’enregistrement du site et de ses ressources afin d’en conserver une représentation. Cela peut prendre différentes formes : enregistrement des fichiers reçus lors de la navigation c’est à dire fichiers html, css, js ou prise de copies d’écrans, …
  • La surveillance de mises à jour de sites internet : il s’agit de vérifier périodiquement la publication de nouvelles informations et les modifications d’informations existantes comme par exemple les informations sur les prix d’un produit afin d’en mesurer la variation ou les comparer avec d’autres sites internet.
Les différents moyens de publier de l’information sur un site internet

Entrons maintenant dans le vif du sujet. Avant de collecter toute donnée, nous devons observer comment fonctionne le site Internet auquel nous nous attaquons et plus précisément par quels moyens sont publiées les informations qui s’y trouvent. Pour simplifier, je dirais qu’il y a deux manières d’afficher de l’information sur un site internet:

  1. de manière statique : le site internet publie de l’information dans le contenu de la page affichée.
  2. de manière dynamique : le site internet publie l’information sur sa page via un script exécuté côté client qui va collecter l’information de manière dynamique (appel API, résultat d’un calcul en fonction d’un comportement de l’utilisateur). La page principale est alors une coquille vide, au moins en partie, et elle est remplie dynamiquement par l’exécution de code.

Pour la partie mise en oeuvre, nous allons extraire les contenus du site de citations. A destination des développeurs, le site propose les deux méthodes sus-citées de génération de son contenu.

Dans mon navigateur, le site ressemble à cela :

Dans sa première version, le contenu est directement généré dans la page html côté serveur. Il est alors très facile d’extraire le contenu avec un simple wget :

wget http://quotes.toscrape.com/

Si j’ouvre le fichier téléchargé, j’obtiens le résultat suivant :

Ce n’est pas très joli, mais le résultat est satisfaisant puisque vous pouvez en lire le contenu. Il est inutile donc de charger d’autres ressources, telles que les images, les feuilles de style et le javascript. Il est possible de travailler ensuite sur le contenu pour en extraire les informations souhaitées.

Si l’on prend un contenu généré dynamiquement (via javascript) et qu’on lance la même commande :

wget http://quotes.toscrape.com/js/

Nous obtenons ceci :

Zéro contenu !? C’est tout à fait normal, puisque c’est le javascript qui génère le contenu et le place dans la page web. Notre premier outil de web scraping, wget, n’offre pas la possibilité d’exécuter le code javascript. C’est là tout l’intérêt d’une solution qui utiliserait un navigateur complet.

Ainsi, on notera que pour scraper un site internet, il convient de bien choisir ses outils.

Quelques exemples d’outils de web scraping

Parmi les outils, Chromium est en train de rebattre les cartes. De nombreux projets majeurs ont annoncé qu’ils arrêtaient de poursuivre leur développement suite à la sortie de la dernière version de Chromium incluant des fonctionnalités d’automatisation.

Chromium est à la base de Chrome, bien connu de tous comme étant un navigateur complet, supportant les fonctionnalités avancées de CSS et de javascript. Il risque de rapidement supplanter toutes les autres librairies qui n’offrent pas ce type de fonctionnalités ou fonctionnant sur des moteurs de navigation plus anciens (phantomjs par exemple).

Il est cependant possible d’utiliser d’autres outils pour scrapper des sites. Les plus basiques, ce sont wget ou curl. Ne vous attendez pas à récupérer autre chose que du html brut comme vu plus haut. Exit donc les résultats de calcul en javascript, la navigation dynamique gérée par un module javascript… Ici, vous récupérez de la donnée brute par un appel direct. Certains sites (via leur CDN) détectent ce type de comportement (via le user agent, ou via la détection de l’activation du javascript) et bloquent ce type d’initiative.

D’autres sont de très bonnes alternatives telles que :

  • phantomjs associé à casperjs : phantomjs fonctionne sur une ancienne version de WebKit. Le projet est arrêté suite à la sortie de la dernière version de Chromium.
  • Selenium associé à tous les navigateurs : très utilisé dans le domaine des tests unitaires, Selenium permet d’automatiser des tâches dans le navigateur.
  • Cheeriojs, Scrapyjs, BS4 pour python : Ces libraires extraient le contenu de la page mais ne chargent pas d’autres ressources comme un navigateur le ferait. Ils sont quoi qu’il en soit très utilisés dans de nombreux projets.
Mise en oeuvre

Comme précisé au début de l’article, nous nous efforcerons de répondre à la question « Comment extraire automatiquement de l’information d’un site internet qui n’a pas ouvert ses données ? » par la pratique.

Pour cela, nous allons travailler avec puppeteer et Chromium sur le site http://quotes.toscrape.com/js/.

Installation de nodejs

L’installation de node est détaillée à l’adresse suivante : https://nodejs.org/en/download/package-manager/

A noter que node embarque NPM, le gestionnaire de paquets node.

Pour ma part, utilisant une base de debian, j’ai exécuté les commandes suivantes :

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt-get install -y nodejs Initialisation du projet

L’initialisation du projet se fait en créant un répertoire dédié dans lequel nous allons travailler :

mkdir marionnette cd marionnette npm init

Et comme vous êtes poli, vous répondez aux questions (elles n’ont pas d’influence ici mais sont indispensables à la bonne gestion du projet).

Installation de puppeteer

Pour cet exercice, nous allons utiliser puppeteer. Puppeteer est une bibliothèque node offrant des interfaces pour Chrome et Chromium. Ces interfaces permettent de piloter en javascript le comportement du navigateur.

L’installation de puppeteer embarque une installation de Chromium. C’est parfait car cela nous évitera une configuration avancée inutile.

L’installation de puppeteer se fait via la commande :

npm i puppeteer -save

L’installation est supérieure à 100 Mo incluant Chromium.

Travaillant sur une machine sans écran, il m’a manqué de nombreuses dépendances liées aux librairies graphiques. Le lien ci-après m’a été utile :

https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#chrome-headless-doesnt-launch

et notamment la commande suivante pour savoir ce qu’il me manquait :

ldd chrome | grep not Notre Hello World

La première étape est de vérifier que tout fonctionne. Pour cela nous allons faire une copie d’écran du site toscrape.com.

Nous créons un répertoire screenshots dans le lequel se trouvera notre copie d’écran :

mkdir screenshots

Puis nous créons un fichier que l’on nommera scrape.js qui contiendra les instructions suivantes :

const puppeteer = require('puppeteer'); async function scrape() { const browser = await puppeteer.launch({headless: true}); const page = await browser.newPage(); await page.setViewport({width:1920, height:2160}); await page.goto("http://toscrape.com", {waitUntil: 'networkidle2'}); await page.screenshot({ path: 'screenshots/toscrape.png' }); browser.close(); } scrape();

Voici ce que fait le code:

  1. Importation et initialisation de puppeteer;
  2. Déclaration d’une fonction asynchrone scrape;
  3. Lancement d’une instance du navigateur sans qu’il ne s’affiche headless = true;
  4. Ouverture d’une nouvelle page du navigateur;
  5. Initialisation de la vue de la page, ici 1920 sur 2160 (écran en mode portrait);
  6. Navigation vers la page du site  http://toscrape.com et attente que tout soit bien chargé;
  7. Prise d’une copie d’écran et sauvegarde vers le chemin screenshots/toscrape.png;
  8. Fermeture de l’instance du navigateur;
  9. Enfin, appel de la fonction scrape().

Lançons le script de la manière suivante :

node scrape.js

Nous obtenons ce résultat :

TADAAA ! Nous venons de scraper notre premier site web.

Scraping du site internet de citations

Dans cette seconde partie, nous allons extraire le contenu du site de citations sous forme de données. Le site propose différentes méthodes de génération de contenu pour exercer son automate. Comme expliqué en introduction, nous allons utiliser la version dont le contenu est généré par du javascript.

Pour commencer, nous allons observer le site en question. Il s’agit d’une page contenant les citations. Chaque citation est composée d’un texte, d’un auteur et d’une série de mot-clés. Le site est paginé. On accède à la page suivante en cliquant sur le bouton « Next » et ainsi de suite.

Dans cet article, je vais laisser de côté la pagination pour me concentrer sur l’extraction de contenu.

Pour commencer, et par praticité , nous allons définir une citation comme ceci :

function Quote(text, author, tags) { this.text = text; this.author = author; this.tags = tags; }

Nous allons ensuite créer une boucle sur chaque citation affichée sur la page.

Avant de nous lancer dans l’écriture du code, nous allons inspecter la source de la page afin de déterminer comment sont structurées les citations dans le contenu de la page (clique droit sur un élément > Inspecter).

Ici, on remarque que chaque citation est contenue dans une div qui porte la classe quote. Nous allons donc lancer une requête dans le contenu de la page pour obtenir toutes les div.quote de notre document et enregistrer cela dans un tableau.

Un petit tour dans la documentation de puppeteer nous permet d’écrire :

const elements = await page.$$("div.quote"); // returns [] if nothing

Nous avons donc dans elements des ElementHandle de chacune des citations de la page.

Dans la suite, nous allons itérer sur ces élements afin d’en extraire ce qui nous interesse. Pour cela, retournons faire un tour dans la source de la page.

On remarque que le texte des citations se trouve à l’intérieur d’une balise qui porte la classe text, le nom de l’auteur à l’intérieur d’une balise portant la classe author, et les tags tags. Et c’est comme cela pour chacune des citations. Nous écrivons donc :

for (var element of elements){ // Loop through each element let text = await element.$eval('.text', s => s.textContent.trim());      let author = await element.$eval('.author', s => s.textContent.trim());  let tags = await element.$eval('.tags', ar => ar);              console.log(text +" - "+author);        }
  1. On boucle pour chaque element de elements;
  2. Dans cet élément, on sélectionne l’élément qui a la classe text. On en extrait le contenu que l’on débarrasse des éventuels espaces en trop;
  3. Dans cet élément, on sélectionne l’élément qui a la classe author. On en extrait le contenu que l’on débarrasse des éventuels espaces en trop;
  4. Dans cet élément, on sélectionne l’élément qui a la classe tags. Ici on ne fait rien. Il contient un ensemble d’éléments de classe tag. Nous allons d’ailleurs modifier cette ligne juste après;
  5. Enfin, nous loguons dans la console le texte et l’auteur de la citation.

Comme précisé précédemment, intéressons-nous aux tags. La source de la page nous indique que pour chaque citation, les tags sont dans des balises a qui portent chacune la classe tag. Une manière de faire serait de refaire une boucle sur chaque élément de la variable tags récupérée précédemment et de renseigner une tableau. Il se trouve que puppeteer propose la fonction pour le faire. Notre code devient:

let tags = await element.$$eval('.tag', ar => ar.map(a => a.text) );

Ce code sélectionne tous les élements de classe tag et les met dans un tableau. Nous avons un talbeau d’ElementHandle de type a. La partie ar => ar.map(a => a.text) extrait pour chaque élément du tableau le texte contenu dans la balise a.

Une fois ceci fait, il ne nous reste plus qu’à stocker le contenu dans un tableau. Le code complet devient :

const puppeteer = require('puppeteer'); function Quote(text, author, tags) { this.text = text; this.author = author; this.tags = tags; } async function scrape() { const browser = await puppeteer.launch({headless: true}); const page = await browser.newPage(); await page.setViewport({width:1920, height:2160}); await page.goto("http://quotes.toscrape.com/js/", {waitUntil: 'networkidle2'}); const elements = await page.$$("div.quote"); // [] if nothing var mydata = new Array(); // Create an empty array for (var element of elements){ // Loop through each element let text = await element.$eval('.text', s => s.textContent.trim()); let author = await element.$eval('.author', s => s.textContent.trim()); let tags = await element.$$eval('.tag', ar => ar.map(a => a.text) ); let item = new Quote(text, author, tags); mydata.push(item); // Push the data to our array } console.log(mydata); browser.close(); } scrape();

Vous pouvez tester le résultat avec la commande suivante :

node scrape.js

Cela donne le résultat suivant :

[ Quote { text: '“The world as we have created it is a process of our thinking. It cannot be changed without changing our thinking.”', author: 'Albert Einstein', tags: [ 'change', 'deep-thoughts', 'thinking', 'world' ] }, Quote { text: '“It is our choices, Harry, that show what we truly are, far more than our abilities.”', author: 'J.K. Rowling', tags: [ 'abilities', 'choices' ] }, Quote { text: '“There are only two ways to live your life. One is as though nothing is a miracle. The other is as though everything is a miracle.”', author: 'Albert Einstein', tags: [ 'inspirational', 'life', 'live', 'miracle', 'miracles' ] }, Quote { text: '“The person, be it gentleman or lady, who has not pleasure in a good novel, must be intolerably stupid.”', author: 'Jane Austen', tags: [ 'aliteracy', 'books', 'classic', 'humor' ] }, Quote { text: '“Imperfection is beauty, madness is genius and it\'s better to be absolutely ridiculous than absolutely boring.”', author: 'Marilyn Monroe', tags: [ 'be-yourself', 'inspirational' ] }, Quote { text: '“Try not to become a man of success. Rather become a man of value.”', author: 'Albert Einstein', tags: [ 'adulthood', 'success', 'value' ] }, Quote { text: '“It is better to be hated for what you are than to be loved for what you are not.”', author: 'André Gide', tags: [ 'life', 'love' ] }, Quote { text: '“I have not failed. I\'ve just found 10,000 ways that won\'t work.”', author: 'Thomas A. Edison', tags: [ 'edison', 'failure', 'inspirational', 'paraphrased' ] }, Quote { text: '“A woman is like a tea bag; you never know how strong it is until it\'s in hot water.”', author: 'Eleanor Roosevelt', tags: [ 'misattributed-eleanor-roosevelt' ] }, Quote { text: '“A day without sunshine is like, you know, night.”', author: 'Steve Martin', tags: [ 'humor', 'obvious', 'simile' ] } ]

Nous disposons donc des citations sous une forme structurée et pouvons les utiliser dans notre projet suivant.

Bonus Track : Mettre à disposition les données via une API Rest

Vous êtes arrivé jusqu’ici. Bravo !

Pour la suite, nous allons publier sous une forme structurée les données fraîchement collectées.

Pour cela, nous allons utiliser express.  Express est un module Nodejs. Il fournit un ensemble de fonctionnalités pour les applications Web et mobiles.

Il dispose notamment d’outils pour HTTP permettant d’accélérer la création d’API.

Depuis le terminal, installons express :

npm i express -save

Nous allons créer une série de répertoires :

mkdir routes mkdir controlers mkdir models
  1. routes : Ce répertoire contiendra tous les fichiers permettant de gérer les points d’entrée de notre application. Les routes redirigeront le traitement vers le bon contrôleur.
  2. controlers : Ce répertoire contiendra tous les fichiers permettant de gérer les traitements de notre application. Le contrôleur réalise le traitement en lisant ou écrivant les données depuis un ou plusieurs modèles.
  3. models : Ce répertoire contiendra tous les fichiers permettant de gérer les données de notre application.

Nous allons ensuite déplacer le fichier scrape.js dans le répertoire contenant les modèles :

mv scrape.js models

Nous allons modifier le fichier scrape.js et faire en sorte que la fonction scrape() retourne le tableau des résultats en ajoutant return mydata; à la fin de la fonction. Ensuite nous allons modifier la dernière ligne. Au lieu d’appeler scrape(); nous allons exporter la fonction pour qu’elle puisse être utilisée dans un autre module :
module.exports = scrape ;

const puppeteer = require('puppeteer'); function Quote(text, author, tags) { this.text = text; this.author = author; this.tags = tags; } async function scrape() { const browser = await puppeteer.launch({headless: true}); const page = await browser.newPage(); await page.setViewport({width:1920, height:2160}); await page.goto("http://quotes.toscrape.com/js/", {waitUntil: 'networkidle2'}); const elements = await page.$$("div.quote"); // [] if nothing //var mydata = new Object(); // Create an empty array/object var mydata = new Array(); // Create an empty array for (var element of elements){ // Loop through each element let text = await element.$eval('.text', s => s.textContent.trim()); let author = await element.$eval('.author', s => s.textContent.trim()); let tags = await element.$$eval('.tag', ar => ar.map(a => a.text) ); let item = new Quote(text, author, tags); mydata.push(item); // Push the data to our array } console.log(mydata); browser.close(); return mydata; } module.exports = scrape;

Dans le répertoire controlers, nous créons un fichier quoteControler.js qui contiendra :

'use strict'; var scrape = require('../models/scrape'); exports.list_all_quotes= async function(req, res) { let response = await scrape(); res.status(200).json({ results: response }); };

Nous créons ensuite un fichier quoteRoute.js dans le répertoire routes qui contiendra le code suivant :

'use strict'; module.exports = function(router) { var quoteCtl = require('../controlers/quoteControler.js'); // Routes router.route('/quotes') .get(quoteCtl.list_all_quotes); };

Le code des fichiers précédents permet de faire en sorte que quand le point d’entrée /quotes de notre API est appelé avec la méthode GET, l’application appelle la méthode list_all_quotes qui déclenche le scraping du site et retourne les résultats sous forme d’une réponse formatée json.

Enfin, pour que tout cela fonctionne, il nous faut un moyen de démarrer l’application pour qu’elle écoute les requêtes entrantes.

Nous créons donc un fichier server.js à la racine de notre projet avec le code suivant :

var express = require('express'); var app = express(); var router = express.Router(); var port = process.env.PORT || 8080; var bodyParser = require('body-parser'); app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.json()); var routes = require('./routes/quoteRoute'); //importing route routes(router); //register the route router.use(function(req, res) { res.status(404).send({url: req.originalUrl + ' not found'}) }); app.use('/', router); app.listen(port); console.log('Quotes RESTful API server started on: ' + port);

Il n’y a plus qu’à tester.

Pour cela, nous lançons notre application de la manière suivante :

node server.js

Le serveur est démarré si ceci apparaît :

Quotes RESTful API server started on: 8080

Avec notre navigateur, rendons-nous à l’adresse de notre serveur, ici en l’occurrence http://localhost:8080/quotes. Le résultat est stupéfiant :

Résultat appel API

Conclusion

Vous venez d’extraire automatiquement vos premières données structurées à partir d’informations non structurées publiées sur Internet. Maintenant que vous avez ces données, vous pouvez les retravailler et les réutiliser dans vos programmes. Vous avez aussi pu créer une API pour mettre à disposition des données qui n’étaient initialement pas structurées.

Evidemment, vous remarquerez de nombreuses pistes d’optimisation. Parmi celles-ci :

  1. La mise en cache des données : En fonction de la fréquence de collecte des données, il devient vite indispensable de mettre en place un mécanisme de cache. Cela permet de ne collecter que les nouvelles données ou de ne les rafraîchir que sous certaines conditions;
  2. La prise en compte du temps de traitement : le web scraping imite l’utilisateur qui navigue sur un site internet. Un scénario de navigation élaboré pourra nécessité du temps. Il conviendra donc de rendre asynchrone le traitement de la demande;
  3. La validation des données : les données des applications qui sollicitent l’API tout comme les données collectées des sites internet doivent être validées afin de s’assurer que les données saisies ou reçues correspondent bien aux types attendus;
  4. La gestion des erreurs : le scrapping  dépend de nombreuses variables en cela qu’il s’agit de travailler avec un site dont on ne maîtrise pas grand chose. Ainsi il est indispensable de prévoir tous les types d’erreur auquel nous pouvons être confrontés (coupure réseau, instabilité de Chromium, modification de la structure du site internet distant, changement des types des données …);
  5. et bien d’autres encore…

Avant de nous quitter, sachez que si vous cherchez à automatiser le téléchargement de fichier, il y a actuellement une limitation qui n’est pas des moindres : il est impossible de télécharger un fichier avec Chromium et puppeteer pour l’instant. Certains ont trouvé des solutions de contournement qui ne fonctionnent que dans des cas très spécifiques. La fonctionnalité est heureusement prévue. Elle est en priorité 1 et devrait arriver prochainement.

Image d’entête : EL DUDUSS DE PAPEL, Toctoc (Instagram : @bytoctoc) | photographie : Kevin Lagaisse | CC BY-NC-ND 3.0

Cet article Scraper Internet avec Chromium et puppeteer est apparu en premier sur Kevin Lagaisse.

Adoptez le CMMN, la notation du Case Management

Kevin Lagaisse - Rien à déclarer - 26 juli 2018 - 11:13am

Tenter de modéliser une activité et se rendre compte qu’il est difficile de se la représenter avec les outils classiques, c’est une chose qui a dû tous nous arriver au moins une fois.

Quand je parle d’outils classiques, je pense au BPMN (Business Process Management Notation) qui permet de modéliser les processus.

Sauf qu’aujourd’hui les activités ne sont plus si procédurées. Dans une organisation où il est demandé à tous de s’adapter, de revenir sur des choses déjà traitées, de gérer l’inattendu ou de réaliser des tâches difficilement prévisibles, il devient indispensable de disposer des bons outils pour les modéliser.

C’est là qu’intervient le Case Management, ou Gestion de Dossier. BP Trends definit le Case Management :

Le Case Management consiste en la gestion de processus collaboratifs dont la durée de vie peut être longue, qui coordonnent de la connaissance, des contenus et des ressources pour faire avancer un dossier dans un contexte métier particulier ; avec un déroulement qui peut ne pas être connu à l’avance (non prédictif) ; dans lequel une appréciation humaine est nécessaire pour déterminer dans quelle mesure le but à atteindre peut être atteint réellement ; et où l’état du dossier peut être altéré par des événements externes à l’organisation.

La Notation du Case Management ou CMMN (Case Management Modeling Notation) permet de prendre en compte cette évolution. Le sujet n’est pas nouveau et commence à être déjà très mature. Il est d’ailleurs facilement possible de trouver des logiciels de case management auprès d’éditeurs.

Chacun y va de sa vision qui correspond à sa spécialité :

  • orientée processus,
  • orientée document,
  • orientée dossier à traiter (les puristes)

Le support que je vous propose vous apprendra à débuter avec la notation du Case Management.

J’espère qu’il vous aidera à mieux appréhender les concepts du Case Management et pourquoi pas à utiliser la notation dans vos futurs dossiers.

Télechargez le support Case management Modeling notation

Et si vous voulez vous exercer à la modelisation sans dépenser un euro, visitez https://demo.bpmn.io/cmmn et commencez à modéliser votre premier dossier.

Image d’entête : Filing System | David Goehring | CC BY 2.0

Cet article Adoptez le CMMN, la notation du Case Management est apparu en premier sur Kevin Lagaisse.

Pagina's

Abonneren op Informatiebeheer  aggregator - Voortbestaan