<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Anthony Leignel</title>
    <description>The latest articles on DEV Community by Anthony Leignel (@palks_studio).</description>
    <link>https://dev.to/palks_studio</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3772766%2F42db137c-2300-4d6b-80ff-8d0acf68f56a.jpg</url>
      <title>DEV Community: Anthony Leignel</title>
      <link>https://dev.to/palks_studio</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/palks_studio"/>
    <language>en</language>
    <item>
      <title>⚙️ Designing a Factur-X EN16931 Generator: From Business Data to a Hybrid PDF</title>
      <dc:creator>Anthony Leignel</dc:creator>
      <pubDate>Mon, 16 Nov 2026 11:01:15 +0000</pubDate>
      <link>https://dev.to/palks_studio/designing-a-factur-x-en16931-generator-from-business-data-to-a-hybrid-pdf-2ec5</link>
      <guid>https://dev.to/palks_studio/designing-a-factur-x-en16931-generator-from-business-data-to-a-hybrid-pdf-2ec5</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ff8im13pdjf6u9zar05c3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ff8im13pdjf6u9zar05c3.png" alt="Free Factur-X EN16931 generator interface for French invoice issuers." width="800" height="642"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Electronic invoicing is becoming an increasingly important part of business infrastructure across Europe.&lt;/p&gt;

&lt;p&gt;In France, a national electronic invoicing reform is introducing new requirements for businesses, particularly for domestic B2B transactions. The reform is being implemented progressively and relies on structured invoice formats that can be processed automatically by different information systems.&lt;/p&gt;

&lt;p&gt;One of these formats is Factur-X, a hybrid electronic invoicing format developed through French-German cooperation and based on the European EN 16931 semantic standard.&lt;/p&gt;

&lt;p&gt;Unlike a traditional PDF invoice, a Factur-X document combines a human-readable invoice with an embedded structured XML file.&lt;/p&gt;

&lt;p&gt;However, the challenge is not simply to produce a PDF and attach an XML file.&lt;/p&gt;

&lt;p&gt;How can we ensure that the amounts displayed in the PDF match the data contained in the XML? How can applicable tax statements be determined without relying on users to enter potentially inconsistent information? How can a compliant document be generated without depending on an external platform for its production?&lt;/p&gt;

&lt;p&gt;These questions are more closely related to software architecture than to document generation.&lt;/p&gt;

&lt;p&gt;This article presents the technical approach behind a free Factur-X generator developed by Palks Studio, designed to produce hybrid invoices using the EN16931 profile.&lt;/p&gt;

&lt;p&gt;The generator is specifically intended for invoice issuers established in France. It supports invoicing scenarios involving French and foreign customers, within the scope of the tax rules implemented by the system.&lt;/p&gt;

&lt;p&gt;The objective is not to introduce a PDF or XML generation library, but to demonstrate how document compliance can be integrated directly into the design of an invoicing system.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Factur-X: One Document, Two Representations
&lt;/h2&gt;

&lt;p&gt;A Factur-X invoice is based on a simple principle: combining a human-readable representation and a structured, machine-readable representation within a single file.&lt;/p&gt;

&lt;p&gt;The final document contains:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A PDF/A-3 document
&lt;/li&gt;
&lt;li&gt;A structured XML file embedded within the PDF
&lt;/li&gt;
&lt;li&gt;Metadata identifying the document and its Factur-X profile&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The PDF preserves the traditional visual presentation of an invoice, while the XML contains the information required for automated processing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Factur-X invoice
│
├── PDF/A-3
│   ├── Seller information
│   ├── Customer information
│   ├── Invoice line items
│   ├── VAT and totals
│   └── Legal statements
│
└── Embedded XML
    ├── Party identification
    ├── Invoicing data
    ├── Structured line items
    ├── Tax information
    └── Monetary totals
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The EN16931 profile, historically referred to as Comfort in Factur-X terminology, provides the information required to represent an electronic invoice according to the European semantic model.&lt;/p&gt;

&lt;p&gt;EN 16931 defines the meaning and relationships of the core information contained in an electronic invoice. Factur-X provides a hybrid document format through which this information can be represented.&lt;/p&gt;

&lt;p&gt;The value of the format therefore lies not simply in the presence of an XML file inside a PDF.&lt;/p&gt;

&lt;p&gt;It lies in the ability of both representations to describe the same economic transaction.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Compliance Starts with the Data Model
&lt;/h2&gt;

&lt;p&gt;One possible approach would be to generate a PDF invoice first, then reconstruct the data required to create the XML.&lt;/p&gt;

&lt;p&gt;This organization immediately introduces a risk: both representations may evolve independently and eventually contain different information.&lt;/p&gt;

&lt;p&gt;A change in VAT calculations within the PDF generator, for example, might not be reflected in the XML generator.&lt;/p&gt;

&lt;p&gt;The approach adopted here places business data at the center of the process.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Invoicing data
       │
       ▼
Controlled processing
       │
       ▼
Consistent business data
       │
       ├────────────────────┐
       ▼                    ▼
PDF representation    XML representation
       │                    │
       └─────────┬──────────┘
                 ▼
          Factur-X invoice
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Seller information, customer information, invoice line items, amounts, and tax rules must be established before the document representations are constructed.&lt;/p&gt;

&lt;p&gt;The PDF and XML then become two representations of the same dataset.&lt;/p&gt;

&lt;p&gt;This separation allows the visual presentation of an invoice to evolve without changing its underlying business meaning.&lt;/p&gt;

&lt;p&gt;It also avoids treating the PDF as a data source from which structured information must subsequently be reconstructed.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Consistency Between Line Items, Amounts, and Totals
&lt;/h2&gt;

&lt;p&gt;An electronic invoice contains more than descriptive information. It represents a financial transaction whose monetary values must remain consistent.&lt;/p&gt;

&lt;p&gt;Consider a deliberately simple example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Service A

Quantity             : 2
Unit price excl. VAT : €100.00
Net amount           : €200.00
VAT rate             : 20%
VAT amount           : €40.00
Total incl. VAT      : €240.00
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These values must be represented consistently in both the PDF and the XML.&lt;/p&gt;

&lt;p&gt;A simplified representation of the underlying data model could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"currency"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"EUR"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"lines"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Service A"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"quantity"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"unit_price"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;100.00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"net_amount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;200.00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"vat_rate"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;20.00&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"totals"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"net_amount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;200.00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"vat_amount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;40.00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"gross_amount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;240.00&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example illustrates the principle of a shared data model. It does not represent the actual internal structure of the generator.&lt;/p&gt;

&lt;p&gt;The complexity increases when multiple invoice lines are subject to different VAT rates.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Service A: €200.00 excl. VAT | VAT 20%
Service B: €100.00 excl. VAT | VAT 10%

Taxable amount at 20% : €200.00
VAT at 20%            :  €40.00

Taxable amount at 10% : €100.00
VAT at 10%            :  €10.00

Total excl. VAT       : €300.00
Total VAT             :  €50.00
Total incl. VAT       : €350.00
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The system must preserve not only the amounts associated with each invoice line, but also their distribution across the applicable tax categories.&lt;/p&gt;

&lt;p&gt;In an invoicing architecture, centralizing these calculations is preferable to reproducing them independently in each document generation component.&lt;/p&gt;

&lt;p&gt;Rounding rules are another important consideration. A difference of one cent between the PDF totals and the XML totals may be enough to make the document inconsistent.&lt;/p&gt;

&lt;p&gt;The objective is therefore to establish a common monetary reference and use it to construct both representations.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Tax Statements as Business Rules
&lt;/h2&gt;

&lt;p&gt;One of the most important aspects of the generator is the determination of legally required VAT statements.&lt;/p&gt;

&lt;p&gt;In a traditional invoicing system, these statements may be entered manually by the user.&lt;/p&gt;

&lt;p&gt;This approach has several limitations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A required statement may be omitted
&lt;/li&gt;
&lt;li&gt;A statement may be incompatible with the seller's tax regime
&lt;/li&gt;
&lt;li&gt;A statement may appear correctly in the PDF but be missing from the XML
&lt;/li&gt;
&lt;li&gt;A change in the invoicing context may make a previously applicable statement incorrect&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The generator adopts a different approach.&lt;/p&gt;

&lt;p&gt;The applicable tax statement is determined automatically from the invoicing data and the rules configured within the system.&lt;/p&gt;

&lt;p&gt;The generator is specifically designed for French invoice issuers. Its tax logic therefore starts from the French tax framework rather than attempting to support every possible national invoicing regime.&lt;/p&gt;

&lt;p&gt;The decision takes into account several factors:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The seller's tax regime
&lt;/li&gt;
&lt;li&gt;The customer's location
&lt;/li&gt;
&lt;li&gt;The customer's tax status
&lt;/li&gt;
&lt;li&gt;The nature of the transaction&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The principle can be represented as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;French seller's tax regime
            │
Customer location
            │
Customer tax status
            │
Nature of the transaction
            │
            ▼
        Tax rules
            │
            ▼
 Applicable tax treatment
            │
            ├──────────────────────┐
            ▼                      ▼
Legal statement in PDF      Tax data in XML
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result of this decision is integrated into both invoice representations.&lt;/p&gt;

&lt;p&gt;The user does not need to reconstruct the tax logic manually every time an invoice is generated.&lt;/p&gt;

&lt;h3&gt;
  
  
  An Example: The French VAT Exemption Scheme
&lt;/h3&gt;

&lt;p&gt;France has a VAT exemption scheme known as &lt;em&gt;franchise en base de TVA&lt;/em&gt;, under which eligible businesses do not charge VAT on transactions covered by the scheme.&lt;/p&gt;

&lt;p&gt;For an operation that falls within this regime, an invoice may contain the following statement:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;TVA non applicable, article 293 B du CGI.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In English, this means that VAT is not applicable under Article 293 B of the French General Tax Code.&lt;/p&gt;

&lt;p&gt;The statement must be visible to the recipient in the PDF.&lt;/p&gt;

&lt;p&gt;In the XML, the corresponding tax treatment must be represented through the structured information defined by the invoicing model, including the applicable tax category and, where required, the exemption reason.&lt;/p&gt;

&lt;p&gt;Adding a sentence at the bottom of a document is therefore not sufficient.&lt;/p&gt;

&lt;p&gt;The system must correctly represent the tax treatment of the transaction in both formats.&lt;/p&gt;

&lt;p&gt;This organization also makes it possible to distinguish an exempt transaction from one that is simply subject to a 0% VAT rate. These situations are not necessarily equivalent from a tax perspective.&lt;/p&gt;

&lt;h3&gt;
  
  
  Supporting International Customers
&lt;/h3&gt;

&lt;p&gt;Although the generator is intended for French invoice issuers, the customer is not necessarily located in France.&lt;/p&gt;

&lt;p&gt;A French business may invoice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A customer established in France
&lt;/li&gt;
&lt;li&gt;A customer established in another European Union member state
&lt;/li&gt;
&lt;li&gt;A customer established outside the European Union&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These situations may require different tax treatments depending on the nature of the transaction and the status of the parties involved.&lt;/p&gt;

&lt;p&gt;The generator therefore treats customer location as part of the business context rather than as a simple address field.&lt;/p&gt;

&lt;p&gt;However, the scope remains important. The generator is not a universal international tax engine. Its rules are limited to the French issuer framework and the transactions supported by the system.&lt;/p&gt;

&lt;p&gt;Tax automation cannot replace configuration appropriate to the seller's actual business activities.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Building the XML from Business Data
&lt;/h2&gt;

&lt;p&gt;The XML embedded within a Factur-X invoice is not simply a textual copy of the PDF.&lt;/p&gt;

&lt;p&gt;It follows a standardized structure that allows different software systems to understand the same information without necessarily sharing the same internal architecture.&lt;/p&gt;

&lt;p&gt;Factur-X uses the UN/CEFACT Cross Industry Invoice syntax, commonly referred to as CII.&lt;/p&gt;

&lt;p&gt;An invoice contains information relating to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Invoice identification
&lt;/li&gt;
&lt;li&gt;The parties involved in the transaction
&lt;/li&gt;
&lt;li&gt;Invoiced products or services
&lt;/li&gt;
&lt;li&gt;Payment terms
&lt;/li&gt;
&lt;li&gt;VAT categories and amounts
&lt;/li&gt;
&lt;li&gt;Monetary totals&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Building the XML involves mapping the generator's business data to the elements defined by this structure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Business data model
         │
         ▼
Mapping to the
EN16931 semantic model
         │
         ▼
  XML construction
         │
         ▼
Structured representation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An amount, date, or identifier cannot be placed arbitrarily within the XML. Each piece of information has a specific meaning and must be represented according to the conventions of the format.&lt;/p&gt;

&lt;p&gt;This distinction is important: an XML document may be perfectly readable by a parser while remaining incorrect according to electronic invoicing business rules.&lt;/p&gt;

&lt;p&gt;Syntactic validity alone is therefore not sufficient to establish invoice compliance.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Different Levels of Validation
&lt;/h2&gt;

&lt;p&gt;Factur-X compliance involves several levels of validation, each addressing a different requirement.&lt;/p&gt;

&lt;h3&gt;
  
  
  Structural Validation
&lt;/h3&gt;

&lt;p&gt;XSD validation checks whether the XML follows the expected structure.&lt;/p&gt;

&lt;p&gt;It verifies permitted elements, their organization, data types, and certain mandatory presence requirements.&lt;/p&gt;

&lt;p&gt;A missing required element or a value incompatible with its expected type may therefore cause a validation error.&lt;/p&gt;

&lt;h3&gt;
  
  
  Business Rule Validation
&lt;/h3&gt;

&lt;p&gt;Schematron rules allow checks that go beyond the basic structure of the document.&lt;/p&gt;

&lt;p&gt;They can verify relationships between different pieces of information, monetary consistency, or the presence of data required in specific tax situations.&lt;/p&gt;

&lt;p&gt;An XML document that is structurally valid may therefore fail business rule validation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hybrid Document Compliance
&lt;/h3&gt;

&lt;p&gt;The final dimension concerns the Factur-X document itself.&lt;/p&gt;

&lt;p&gt;The PDF must comply with PDF/A-3 requirements, contain the associated XML, and include the expected metadata and embedding information.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Structured XML
      │
      ▼
Structural validation
      │
      ▼
Business rule validation
      │
      ▼
Embedding into PDF/A-3
      │
      ▼
Hybrid document validation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This diagram represents the different levels of control required by a Factur-X compliance process. It does not describe the generator's private validation pipeline.&lt;/p&gt;

&lt;p&gt;These checks must also be distinguished from consistency between the visible PDF and the XML data.&lt;/p&gt;

&lt;p&gt;Even when an XML document satisfies its schemas and business rules, this does not automatically guarantee that the information displayed in the PDF matches its contents.&lt;/p&gt;

&lt;p&gt;This is precisely why an architecture based on a shared data model is valuable.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Generating the PDF/A-3 and Embedding the XML
&lt;/h2&gt;

&lt;p&gt;PDF/A-3 is a format designed for the long-term preservation of electronic documents. Unlike earlier versions of PDF/A, it also allows different types of files to be embedded within the document.&lt;/p&gt;

&lt;p&gt;Factur-X uses this capability to combine the visual document with structured invoice data.&lt;/p&gt;

&lt;p&gt;The process can be represented as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Invoicing data
       │
       ├────────────────────┐
       ▼                    ▼
PDF generation       XML generation
       │                    │
       │                    ▼
       │              Factur-X XML
       │                    │
       └─────────┬──────────┘
                 ▼
            XML embedding
                 │
                 ▼
          PDF/A-3 document
                 │
                 ▼
          Factur-X invoice
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Embedding the XML must not be confused with attaching an arbitrary file to a conventional PDF.&lt;/p&gt;

&lt;p&gt;The hybrid document must follow Factur-X conventions concerning the embedded file, its association with the document, and the metadata identifying the format.&lt;/p&gt;

&lt;p&gt;The expected result is a single file that preserves the familiar presentation of an invoice while allowing automated processing.&lt;/p&gt;

&lt;p&gt;The recipient can open the PDF using a compatible reader, while invoice processing software can extract the structured information.&lt;/p&gt;

&lt;p&gt;This organization maintains continuity between human workflows and automated processing.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. Why Not Separate Factur-X Generation from the Invoicing System?
&lt;/h2&gt;

&lt;p&gt;One possible architecture would consist of producing a conventional invoice and then sending it to a service responsible for converting the document into Factur-X.&lt;/p&gt;

&lt;p&gt;This approach can address certain integration requirements, particularly when an existing invoicing system cannot be modified.&lt;/p&gt;

&lt;p&gt;However, it introduces an additional processing stage.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Invoicing system
       │
       ▼
   PDF invoice
       │
       ▼
Conversion service
       │
       ▼
Factur-X invoice
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the conversion service does not receive the original business data, it may need to reconstruct structured information from the visible document.&lt;/p&gt;

&lt;p&gt;This reconstruction introduces a challenge that does not exist when the data is available from the beginning.&lt;/p&gt;

&lt;p&gt;The approach adopted by the generator integrates Factur-X production directly into the invoicing process.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Invoicing system
       │
       ▼
Controlled business data
       │
       ▼
Native Factur-X generation
       │
       ▼
Hybrid document
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Compliance becomes a property of the generation system rather than a transformation applied after the document has been produced.&lt;/p&gt;

&lt;p&gt;This allows the system to retain control over the data, tax rules, and information supplied to each representation.&lt;/p&gt;

&lt;p&gt;The final format becomes the result of the business process rather than a correction applied to an existing document.&lt;/p&gt;




&lt;h2&gt;
  
  
  9. Autonomous Generation Without SaaS Dependency
&lt;/h2&gt;

&lt;p&gt;The generator has been designed without a critical external service dependency for Factur-X invoice production.&lt;/p&gt;

&lt;p&gt;The objective is not to eliminate every external library or software component. Using a library integrated into an application is not the same type of dependency as delegating every generation operation to a remote service.&lt;/p&gt;

&lt;p&gt;In an architecture based on an external conversion API, the availability of that service may directly determine whether invoices can be produced.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Invoicing data
       │
       ▼
  External API
       │
       ▼
Factur-X invoice
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A service interruption, API modification, or change in its terms of use may therefore affect the invoicing system.&lt;/p&gt;

&lt;p&gt;Controlling the generation process within one's own infrastructure reduces this dependency.&lt;/p&gt;

&lt;p&gt;This approach offers several advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Control over the generation process&lt;/li&gt;
&lt;li&gt;The ability to evolve business rules&lt;/li&gt;
&lt;li&gt;Reduced data exchanges with third-party services&lt;/li&gt;
&lt;li&gt;A clearer understanding of the components required for system operation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, this autonomy also introduces additional responsibilities.&lt;/p&gt;

&lt;p&gt;Libraries, tax rules, XML schemas, and document requirements must be maintained over time.&lt;/p&gt;

&lt;p&gt;The absence of a SaaS dependency does not eliminate the need for maintenance.&lt;/p&gt;




&lt;h2&gt;
  
  
  10. Generating a Compliant Invoice Is Not the Same as Transmitting It
&lt;/h2&gt;

&lt;p&gt;This distinction is particularly important in the context of France's electronic invoicing reform.&lt;/p&gt;

&lt;p&gt;For international readers, it is worth clarifying that Factur-X is a document format, while the French reform defines a broader regulatory framework for electronic invoicing and related reporting obligations.&lt;/p&gt;

&lt;p&gt;The European EN 16931 standard provides a common semantic foundation for electronic invoices. It does not, by itself, define every national requirement concerning invoice transmission, reporting, or tax administration.&lt;/p&gt;

&lt;p&gt;In France, the reform introduces a regulated exchange framework involving approved platforms, known as &lt;em&gt;plateformes agréées&lt;/em&gt; (PA).&lt;/p&gt;

&lt;p&gt;Generating a Factur-X invoice and transmitting it through this regulated framework are two separate responsibilities.&lt;/p&gt;

&lt;p&gt;A generator produces a structured document.&lt;/p&gt;

&lt;p&gt;A transmission system must also handle exchanges with the relevant participants, routing information, and statuses associated with the invoice lifecycle.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Factur-X generator
        │
        ▼
Electronic invoice
        │
        ▼
Transmission layer
        │
        ▼
Approved platform
        │
        ▼
Regulated exchange framework
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The production of a Factur-X document does not therefore mean that all electronic invoicing obligations have automatically been fulfilled.&lt;/p&gt;

&lt;p&gt;This distinction is also relevant to cross-border transactions, which may be subject to reporting requirements different from those applicable to domestic B2B electronic invoicing.&lt;/p&gt;

&lt;p&gt;The generator presented in this article focuses on document production. It is not presented as an approved platform or a complete solution covering every obligation under the French reform.&lt;/p&gt;

&lt;p&gt;This separation allows the generator to be designed as an autonomous component that can be integrated into broader business systems.&lt;/p&gt;

&lt;p&gt;Document generation can evolve independently of transmission mechanisms, provided that the interfaces between these layers remain consistent.&lt;/p&gt;

&lt;p&gt;This is a classic principle of separation of responsibilities applied to electronic invoicing.&lt;/p&gt;




&lt;h2&gt;
  
  
  11. A Free Generator as an Architectural Demonstration
&lt;/h2&gt;

&lt;p&gt;The generator presented in this article illustrates a concrete approach to producing Factur-X electronic invoices.&lt;/p&gt;

&lt;p&gt;Its scope covers hybrid document generation, consistency of invoicing data, and the application of the supported tax rules for French invoice issuers.&lt;/p&gt;

&lt;p&gt;It demonstrates how a generation system can be organized around a deterministic process.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Invoicing data
       │
       ▼
Business rule application
       │
       ▼
Calculations and tax data
       │
       ▼
PDF and XML generation
       │
       ▼
Factur-X invoice
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This organization makes the overall operation of the system and its responsibilities easier to understand.&lt;/p&gt;

&lt;p&gt;It also provides a foundation for broader integrations, including internal invoicing tools, specialized business systems, and automated document generation workflows.&lt;/p&gt;

&lt;p&gt;The generator does not attempt to reproduce every feature of a commercial management application.&lt;/p&gt;

&lt;p&gt;Its value lies in controlling a specific operation: transforming invoicing data into a consistent hybrid electronic document.&lt;/p&gt;

&lt;p&gt;Although the current implementation is designed for French invoice issuers, the underlying architectural principles are not limited to France.&lt;/p&gt;

&lt;p&gt;Shared business data, separation of responsibilities, deterministic tax processing, and consistency between document representations are relevant to electronic invoicing systems in many regulatory environments.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Designing a Factur-X generator involves considerably more than producing a PDF and embedding an XML file.&lt;/p&gt;

&lt;p&gt;The real challenge lies in how the system establishes business data, applies tax rules, maintains monetary consistency, and constructs the different invoice representations.&lt;/p&gt;

&lt;p&gt;An architecture based on shared data allows these requirements to be addressed before document generation.&lt;/p&gt;

&lt;p&gt;The PDF becomes the representation intended for human readers. The XML becomes the representation intended for automated processing. Both describe the same economic transaction.&lt;/p&gt;

&lt;p&gt;This approach also distinguishes document compliance from the other responsibilities of an invoicing system, including regulated transmission, payment tracking, and accounting management.&lt;/p&gt;

&lt;p&gt;In the context of France's electronic invoicing reform, this separation is particularly important. A compliant document is an essential component of the process, but it is not the entire regulatory framework.&lt;/p&gt;

&lt;p&gt;The objective is not to multiply components or dependencies, but to build a process that remains understandable, controlled, and capable of evolving.&lt;/p&gt;

&lt;p&gt;From this perspective, Factur-X is no longer simply an export format. It becomes the result of an invoicing architecture designed to produce consistent data from the outset.&lt;/p&gt;




&lt;h2&gt;
  
  
  Technical Documentation
&lt;/h2&gt;

&lt;p&gt;The GitHub repository presents the generator, its approach to Factur-X compliance, and a concrete example of a hybrid electronic invoice.&lt;/p&gt;

&lt;p&gt;The generator is intended for invoice issuers established in France, including invoicing scenarios involving domestic and international customers within the supported tax framework.&lt;/p&gt;

&lt;p&gt;The repository contains documentation and demonstration materials. It does not contain downloadable source code or production files.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Palks-Studio/free-facturx-generator" rel="noopener noreferrer"&gt;Explore the Free Factur-X Generator project on GitHub&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;a href="https://palks-studio.com" rel="noopener noreferrer"&gt;https://palks-studio.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>backend</category>
      <category>facturx</category>
      <category>invoicing</category>
    </item>
    <item>
      <title>🔎 Python Project Scanner Architecture: Static Analysis, Multi-Ecosystem Dependencies, and Technical Mapping</title>
      <dc:creator>Anthony Leignel</dc:creator>
      <pubDate>Sun, 15 Nov 2026 20:56:43 +0000</pubDate>
      <link>https://dev.to/palks_studio/python-project-scanner-architecture-static-analysis-multi-ecosystem-dependencies-and-technical-1a51</link>
      <guid>https://dev.to/palks_studio/python-project-scanner-architecture-static-analysis-multi-ecosystem-dependencies-and-technical-1a51</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fadfmll6jocwi827gdo80.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fadfmll6jocwi827gdo80.png" alt="HTML report generated by Project Inventory displaying software dependencies, subprojects, infrastructure components, and technical relationships." width="800" height="613"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Taking over an existing software project often begins with the same questions.&lt;/p&gt;

&lt;p&gt;Which technologies does it use? What libraries does it depend on? Which external services are integrated? How do its different components relate to one another?&lt;/p&gt;

&lt;p&gt;In a recent, well-documented project, the answers may be relatively easy to find. In a legacy project, a monorepo, or an application composed of multiple services, they are often scattered across configuration files, dependency manifests, Dockerfiles, and source code.&lt;/p&gt;

&lt;p&gt;Manual analysis becomes a task of its own.&lt;/p&gt;

&lt;p&gt;An alternative approach is to build a technical inventory directly from the filesystem without executing the project being analyzed.&lt;/p&gt;

&lt;p&gt;This article presents the architecture of Project Inventory, a static analysis engine built with Python 3.11+, capable of inventorying dependencies across ten ecosystems, identifying subprojects, analyzing Docker configurations, and mapping relationships between components.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Analyzing a Project Without Executing It
&lt;/h2&gt;

&lt;p&gt;The first architectural principle is to work exclusively with observable elements within the project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Software project
       │
       ▼
Filesystem exploration
       │
       ▼
Technical file detection
       │
       ▼
Manifest and configuration analysis
       │
       ▼
Source code reference analysis
       │
       ▼
Consolidation and mapping
       │
       ▼
HTML, JSON, and CSV reports
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The scanner does not need to start the application, install its dependencies, or launch its Docker containers.&lt;/p&gt;

&lt;p&gt;It builds a technical representation from the available files.&lt;/p&gt;

&lt;p&gt;This distinction is important: a static inventory describes what can be observed within a project, but does not necessarily establish its actual runtime behavior.&lt;/p&gt;

&lt;p&gt;A service may be declared in Docker Compose without running. A library may be installed without being directly imported. An environment variable may exist without being used.&lt;/p&gt;

&lt;p&gt;The report must preserve these distinctions.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. A Modular Architecture
&lt;/h2&gt;

&lt;p&gt;The engine separates responsibilities across several categories of components.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;project-inventory/
│
├── scanner/
│   ├── __init__.py
│   ├── filesystem.py
│   └── project_scanner.py
│
├── detectors/
│   ├── __init__.py
│   ├── environment.py
│   ├── infrastructure.py
│   ├── languages.py
│   ├── packages.py
│   ├── projects.py
│   └── services.py
│
├── analyzers/
│   ├── __init__.py
│   ├── dependencies.py
│   └── relationships.py
│
├── exporters/
│   ├── __init__.py
│   ├── csv_export.py
│   ├── html_export.py
│   └── json_export.py
│
├── docs/
├── output/
│   └── .gitkeep
│
├── LICENCE.md
├── LICENSE.md
└── app.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This organization corresponds to the documented project structure.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;Responsibility&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;scanner/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Exploration and orchestration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;detectors/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Information extraction&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;analyzers/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Consolidation and relationships&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;exporters/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Report generation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;output/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Result storage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;app.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Application entry point&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The separation between detection and analysis is a central aspect of this architecture.&lt;/p&gt;

&lt;p&gt;A detector can identify a package, an environment file, or a Docker service. An analyzer can then correlate these observations to establish relationships between components.&lt;/p&gt;

&lt;p&gt;This prevents data discovery from being mixed with interpretation.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Recursive Filesystem Exploration
&lt;/h2&gt;

&lt;p&gt;The first step is to traverse the selected directory and its subdirectories.&lt;/p&gt;

&lt;p&gt;However, not every file within a project is relevant to its technical inventory.&lt;/p&gt;

&lt;p&gt;Directories containing installed dependencies, generated files, or development tool data can significantly increase the volume of files to analyze.&lt;/p&gt;

&lt;p&gt;The scanner excludes directories including:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.git
.idea
.vscode
__pycache__
node_modules
vendor
.venv
venv
dist
build
coverage
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An educational example using the Python standard library could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pathlib&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;

&lt;span class="no"&gt;EXCLUDED_DIRS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;".git"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;".idea"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;".vscode"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"__pycache__"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"node_modules"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"vendor"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;".venv"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"venv"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"dist"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"build"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"coverage"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;walk_project&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;current&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;directories&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;files&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;walk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;directories&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="n"&gt;directory&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;directory&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;directories&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;directory&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="no"&gt;EXCLUDED_DIRS&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;

        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;filename&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;files&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;current&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;filename&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example illustrates recursive traversal and directory exclusions. It does not reproduce the production code of Project Inventory.&lt;/p&gt;

&lt;p&gt;Modifying the &lt;code&gt;directories&lt;/code&gt; list in place prevents &lt;code&gt;os.walk()&lt;/code&gt; from descending into excluded directories when using its default top-down traversal.&lt;/p&gt;

&lt;p&gt;This is particularly useful when a project contains a large &lt;code&gt;node_modules&lt;/code&gt; directory or Python virtual environment.&lt;/p&gt;

&lt;p&gt;The objective is not to analyze every installed file, but to identify the elements that describe the project's architecture.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Detecting Technical Files by Name and Extension
&lt;/h2&gt;

&lt;p&gt;A multi-ecosystem scanner must recognize several file formats.&lt;/p&gt;

&lt;p&gt;Some have conventional names, such as &lt;code&gt;package.json&lt;/code&gt; or &lt;code&gt;requirements.txt&lt;/code&gt;. Others are identified by their extension, such as &lt;code&gt;.csproj&lt;/code&gt; files.&lt;/p&gt;

&lt;p&gt;A simplified representation of the detection rules could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="no"&gt;KNOWN_FILES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"requirements.txt"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"python"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"pyproject.toml"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"python"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"package.json"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"node"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"composer.json"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"php"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"go.mod"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"go"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"Cargo.toml"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"rust"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"Gemfile"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"ruby"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"pom.xml"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"java"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"pubspec.yaml"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"dart"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"mix.exs"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"elixir"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;detect_ecosystem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="no"&gt;KNOWN_FILES&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="no"&gt;KNOWN_FILES&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;suffix&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;".csproj"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"dotnet"&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example is intentionally incomplete. The documented engine also supports lock files and other configuration formats.&lt;/p&gt;

&lt;p&gt;Detecting the file type makes it possible to select the appropriate processing logic.&lt;/p&gt;

&lt;p&gt;JSON, TOML, XML, and Gradle configuration files cannot necessarily be interpreted using the same parser.&lt;/p&gt;

&lt;p&gt;The scanner identifies relevant files before passing their contents to specialized detectors.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Inventorying Dependencies Across Ten Ecosystems
&lt;/h2&gt;

&lt;p&gt;Project Inventory currently supports ten ecosystems.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Ecosystem&lt;/th&gt;
&lt;th&gt;Supported manifests and files&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Python&lt;/td&gt;
&lt;td&gt;requirements.txt, pyproject.toml, poetry.lock, Pipfile, Pipfile.lock&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Node.js&lt;/td&gt;
&lt;td&gt;package.json, package-lock.json, yarn.lock, pnpm-lock.yaml&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PHP&lt;/td&gt;
&lt;td&gt;composer.json, composer.lock&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Go&lt;/td&gt;
&lt;td&gt;go.mod, go.sum&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rust&lt;/td&gt;
&lt;td&gt;Cargo.toml, Cargo.lock&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ruby&lt;/td&gt;
&lt;td&gt;Gemfile, Gemfile.lock&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Java / JVM&lt;/td&gt;
&lt;td&gt;pom.xml, build.gradle, build.gradle.kts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;.NET&lt;/td&gt;
&lt;td&gt;*.csproj&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dart / Flutter&lt;/td&gt;
&lt;td&gt;pubspec.yaml, pubspec.lock&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Elixir&lt;/td&gt;
&lt;td&gt;mix.exs, mix.lock&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This diversity requires distinguishing the format of a file from the meaning of the information it contains.&lt;/p&gt;

&lt;p&gt;A manifest generally describes the dependencies requested by a project.&lt;/p&gt;

&lt;p&gt;A lock file can specify resolved versions and include transitive dependencies.&lt;/p&gt;

&lt;p&gt;However, not every file serves exactly the same purpose. For example, &lt;code&gt;go.sum&lt;/code&gt; contains module checksums and should not be interpreted as a conventional lock file that independently represents the complete set of active dependencies.&lt;/p&gt;

&lt;p&gt;The analysis must account for the semantics of each ecosystem.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example: Node.js Manifest
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"dependencies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"express"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"^4.18.2"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;"axios"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"^1.7.0"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"devDependencies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"vite"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"^5.0.0"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This file declares version constraints.&lt;/p&gt;

&lt;p&gt;The presence of &lt;code&gt;express&lt;/code&gt; in the manifest does not necessarily mean that the installed version is exactly &lt;code&gt;4.18.2&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A lock file may provide a more precise resolved version.&lt;/p&gt;

&lt;p&gt;The inventory should preserve this distinction rather than replacing both observations with a single value.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Consolidating Dependencies Without Losing Their Sources
&lt;/h2&gt;

&lt;p&gt;The same dependency can appear in multiple technical files.&lt;/p&gt;

&lt;p&gt;In a Dart project, for example, a package may be declared in &lt;code&gt;pubspec.yaml&lt;/code&gt; and locked in &lt;code&gt;pubspec.lock&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The engine consolidates information by ecosystem and package.&lt;/p&gt;

&lt;p&gt;Example from the documentation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dio
    pubspec.lock         ==5.7.0 [locked]
    pubspec.yaml         ^5.7.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The package appears once, while its different sources remain visible.&lt;/p&gt;

&lt;p&gt;This approach avoids two problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Counting the same dependency multiple times&lt;/li&gt;
&lt;li&gt;Losing the distinction between declared and locked versions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A conceptual representation could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"ecosystem"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"dart"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"package"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"dio"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"sources"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nl"&gt;"file"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"pubspec.yaml"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"^5.7.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"declared"&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nl"&gt;"file"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"pubspec.lock"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"5.7.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"locked"&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This JSON illustrates the consolidation principle. It does not necessarily correspond to the exact schema used by the engine's exports.&lt;/p&gt;

&lt;p&gt;A dependency discovered only in a lock file also remains in the inventory.&lt;/p&gt;

&lt;p&gt;This makes it possible to identify transitive packages that are not directly declared in the main manifest.&lt;/p&gt;

&lt;h3&gt;
  
  
  Keeping Ecosystems Separate
&lt;/h3&gt;

&lt;p&gt;Two packages with the same name in different ecosystems do not necessarily represent the same library.&lt;/p&gt;

&lt;p&gt;A conceptual consolidation key could therefore be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ecosystem&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;package_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This distinction prevents a Python package and a Node.js package with identical names from being arbitrarily merged.&lt;/p&gt;

&lt;p&gt;In projects containing multiple subprojects, source files and their locations also remain important for identifying the context of each dependency.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Identifying Subprojects Within a Single Directory Tree
&lt;/h2&gt;

&lt;p&gt;A software repository may contain several independent applications or components.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;application/
│
├── backend/
│   ├── requirements.txt
│   └── app.py
│
├── frontend/
│   ├── package.json
│   └── src/
│
├── worker/
│   ├── pyproject.toml
│   └── worker.py
│
└── docker-compose.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A global dependency inventory alone is insufficient to describe this architecture accurately.&lt;/p&gt;

&lt;p&gt;The individual subprojects must also be identified.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;application
    │
    ├── backend
    │       └── Python
    │
    ├── frontend
    │       └── Node.js
    │
    └── worker
            └── Python
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Project Inventory identifies subprojects from detected manifests and configuration files.&lt;/p&gt;

&lt;p&gt;Each subproject can be associated with one or more ecosystems and the technical files that led to its identification.&lt;/p&gt;

&lt;p&gt;This step provides the context needed to associate dependencies and certain infrastructure relationships with individual components.&lt;/p&gt;

&lt;p&gt;A manifest is still an architectural indicator. Its presence alone does not always establish that a directory represents an independently deployable application.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. Analyzing Docker Compose Infrastructure
&lt;/h2&gt;

&lt;p&gt;Application dependencies represent only part of the architecture.&lt;/p&gt;

&lt;p&gt;An application may also depend on a database, a cache, a message broker, or other services.&lt;/p&gt;

&lt;p&gt;Docker Compose files provide a particularly useful source of information.&lt;/p&gt;

&lt;p&gt;The engine recognizes four conventional filenames:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker-compose.yml
docker-compose.yaml
compose.yml
compose.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For each detected service, it can extract information including its image, build configuration, ports, volumes, environment files, and dependencies between services.&lt;/p&gt;

&lt;p&gt;Consider this educational example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;backend&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;./backend&lt;/span&gt;
        &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"5000:5000"&lt;/span&gt;
        &lt;span class="na"&gt;env_file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;.env&lt;/span&gt;
        &lt;span class="na"&gt;depends_on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;database&lt;/span&gt;

    &lt;span class="na"&gt;database&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;postgres:16&lt;/span&gt;
        &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;postgres_data:/var/lib/postgresql/data&lt;/span&gt;

&lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;postgres_data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Several elements can be observed in this file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;backend
    ├── build: ./backend
    ├── port: 5000:5000
    ├── env_file: .env
    └── depends_on: database

database
    ├── image: postgres:16
    └── volume: postgres_data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This information is obtained without starting the containers.&lt;/p&gt;

&lt;p&gt;However, the declared configuration must remain distinct from the actual state of the infrastructure.&lt;/p&gt;

&lt;p&gt;The presence of a port in Docker Compose does not demonstrate that it is currently accessible. Similarly, &lt;code&gt;depends_on&lt;/code&gt; describes a declared relationship between services, but does not by itself guarantee that a dependency is ready to accept requests.&lt;/p&gt;




&lt;h2&gt;
  
  
  9. Enriching Services With Infrastructure Signatures
&lt;/h2&gt;

&lt;p&gt;A Docker image can provide additional evidence about the purpose of a service.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;postgres:16
    → PostgreSQL

redis:7
    → Redis

rabbitmq:3-management
    → RabbitMQ
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The engine includes signatures for identifying several known infrastructure components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PostgreSQL&lt;/li&gt;
&lt;li&gt;Redis&lt;/li&gt;
&lt;li&gt;MySQL&lt;/li&gt;
&lt;li&gt;MariaDB&lt;/li&gt;
&lt;li&gt;MongoDB&lt;/li&gt;
&lt;li&gt;RabbitMQ&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These signatures enrich the discovered information.&lt;/p&gt;

&lt;p&gt;They do not replace the analysis of Docker Compose files.&lt;/p&gt;

&lt;p&gt;A service using an unknown image should remain in the inventory even when it cannot be associated with a recognized infrastructure component.&lt;/p&gt;

&lt;p&gt;This distinction prevents discovery from being limited to technologies already present in a predefined catalog.&lt;/p&gt;




&lt;h2&gt;
  
  
  10. Analyzing Dockerfiles
&lt;/h2&gt;

&lt;p&gt;A Dockerfile provides additional information about how a component is built and started.&lt;/p&gt;

&lt;p&gt;The engine extracts instructions including:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Instruction&lt;/th&gt;
&lt;th&gt;Extracted information&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;FROM&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Base image&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;WORKDIR&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Working directory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;EXPOSE&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Declared port&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;CMD&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Default command&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ENTRYPOINT&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Entry point&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt; python:3.12-slim

&lt;span class="k"&gt;WORKDIR&lt;/span&gt; /app

&lt;span class="k"&gt;EXPOSE&lt;/span&gt; 5000

&lt;span class="k"&gt;CMD&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"gunicorn"&lt;/span&gt;, &lt;span class="s2"&gt;"-w"&lt;/span&gt;, &lt;span class="s2"&gt;"2"&lt;/span&gt;, &lt;span class="s2"&gt;"-b"&lt;/span&gt;, &lt;span class="s2"&gt;"0.0.0.0:5000"&lt;/span&gt;, &lt;span class="s2"&gt;"app:app"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The analysis can identify Python as the base environment and Gunicorn as the declared startup command.&lt;/p&gt;

&lt;p&gt;This information becomes particularly useful when correlated with Python dependencies.&lt;/p&gt;

&lt;p&gt;Gunicorn can be used to start an application without appearing in an &lt;code&gt;import gunicorn&lt;/code&gt; statement within the source code.&lt;/p&gt;

&lt;p&gt;Source code analysis alone could therefore miss a reference that is present in the infrastructure configuration.&lt;/p&gt;




&lt;h2&gt;
  
  
  11. Extracting Environment Variables Without Exposing Their Values
&lt;/h2&gt;

&lt;p&gt;Environment files often contain important information for understanding a project's integrations.&lt;/p&gt;

&lt;p&gt;Project Inventory analyzes files including:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.env
.env.example
.env.sample
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, these files may contain API keys, passwords, or other sensitive credentials.&lt;/p&gt;

&lt;p&gt;The engine extracts only the variable names.&lt;/p&gt;

&lt;p&gt;Example output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;OPENAI_API_KEY
ENABLE_PERSISTENCE
MEMORY_MAX_TURNS
STRICT_MODE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The values are not displayed.&lt;/p&gt;

&lt;p&gt;An educational extraction example could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;

&lt;span class="no"&gt;ENV_NAME&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;compile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="s2"&gt;"^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*="&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;extract_env_names&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;names&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;splitlines&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;match&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;ENV_NAME&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="k"&gt;match&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;names&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;match&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;group&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;names&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This function illustrates basic variable name extraction without retaining the values in its output.&lt;/p&gt;

&lt;p&gt;It is not a complete parser for every environment file format.&lt;/p&gt;

&lt;p&gt;The analysis can therefore identify the existence of a configuration without directly exposing its sensitive contents.&lt;/p&gt;

&lt;p&gt;This precaution must also apply to exports, error messages, and technical logs.&lt;/p&gt;




&lt;h2&gt;
  
  
  12. Identifying External Services From Evidence
&lt;/h2&gt;

&lt;p&gt;Dependencies and environment variables can provide evidence about the external services integrated into a project.&lt;/p&gt;

&lt;p&gt;The engine includes signatures for services such as OpenAI, Stripe, AWS, SendGrid, Twilio, and Sentry.&lt;/p&gt;

&lt;p&gt;Documented example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;OpenAI
    package    openai
    variable   OPENAI_API_KEY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two separate observations associate the project with OpenAI.&lt;/p&gt;

&lt;p&gt;A conceptual representation could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"service"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"OpenAI"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"evidence"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"package"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"openai"&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"environment_variable"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"OPENAI_API_KEY"&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result retains the evidence that led to the identification.&lt;/p&gt;

&lt;p&gt;This approach is more informative than a simple list of external services because it explains why a service appears in the report.&lt;/p&gt;

&lt;p&gt;An important limitation remains: the presence of a package and an environment variable does not prove that a connection to the service actually occurs.&lt;/p&gt;

&lt;p&gt;The service may be optional, disabled, or simply anticipated in the configuration.&lt;/p&gt;




&lt;h2&gt;
  
  
  13. Analyzing Python Imports With the AST
&lt;/h2&gt;

&lt;p&gt;Analyzing declared dependencies does not always establish which libraries are referenced in the source code.&lt;/p&gt;

&lt;p&gt;For Python, the engine uses the AST, or Abstract Syntax Tree.&lt;/p&gt;

&lt;p&gt;The AST represents the syntactic structure of a program without requiring its execution.&lt;/p&gt;

&lt;p&gt;Consider this file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;

&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;flask&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Flask&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;

&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;storage&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;save_record&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A text search might identify some imports, but it could also confuse source code with comments or strings.&lt;/p&gt;

&lt;p&gt;The AST makes it possible to identify actual import statements within the program's syntax.&lt;/p&gt;

&lt;p&gt;Educational example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ast&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;extract_imports&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;tree&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ast&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;imports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;node&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;ast&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;walk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tree&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ast&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Import&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;alias&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;names&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;imports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;alias&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ast&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ImportFrom&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;module&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;imports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;module&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;imports&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This function analyzes source text without importing or executing the modules involved.&lt;/p&gt;

&lt;p&gt;It could produce:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;datetime
flask
json
openai
os
storage
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A complete implementation must also account for relative imports, submodules, and files containing syntax errors.&lt;/p&gt;

&lt;p&gt;Project Inventory classifies Python imports into three categories:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PYTHON STANDARD LIBRARY
    os
    json
    datetime

EXTERNAL
    flask
    openai

INTERNAL
    storage
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This classification distinguishes standard library modules, external dependencies, and modules belonging to the project itself.&lt;/p&gt;




&lt;h2&gt;
  
  
  14. Declared, Locked, and Referenced Dependencies
&lt;/h2&gt;

&lt;p&gt;A dependency may be present in a manifest without appearing directly in the source code.&lt;/p&gt;

&lt;p&gt;Conversely, an import may be detected even though no corresponding dependency is explicitly declared in the analyzed manifest.&lt;/p&gt;

&lt;p&gt;Project Inventory correlates declared Python dependencies with references observed in source code and, where relevant, Docker configurations.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flask
    REFERENCED
    import flask

gunicorn
    REFERENCED
    Docker ["gunicorn", "-w", "2", ...]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These two packages are referenced in different ways.&lt;/p&gt;

&lt;p&gt;Flask appears in the source code. Gunicorn appears in a Docker command.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Status&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Declared&lt;/td&gt;
&lt;td&gt;Present in a manifest&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Locked&lt;/td&gt;
&lt;td&gt;Resolved version observed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Referenced&lt;/td&gt;
&lt;td&gt;Static reference detected&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reference not found&lt;/td&gt;
&lt;td&gt;No static reference detected&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The last status is deliberately different from "unused dependency."&lt;/p&gt;

&lt;p&gt;The absence of a static reference can have several explanations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dynamic imports&lt;/li&gt;
&lt;li&gt;Loading through a plugin system&lt;/li&gt;
&lt;li&gt;Indirect use by another library&lt;/li&gt;
&lt;li&gt;Commands executed outside Python source code&lt;/li&gt;
&lt;li&gt;Configuration outside the analyzed scope&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There is also a distinction between the name of a distributed package and the name used to import it.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Package: python-dotenv
Import:  dotenv

Package: Pillow
Import:  PIL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A naive comparison between package names and imports can therefore produce incorrect results.&lt;/p&gt;

&lt;p&gt;Dependency correlation must account for this distinction when the relationship can be established.&lt;/p&gt;

&lt;p&gt;The inventory provides evidence for further analysis, but should not be used on its own to automatically remove dependencies.&lt;/p&gt;




&lt;h2&gt;
  
  
  15. Mapping Relationships Between Components
&lt;/h2&gt;

&lt;p&gt;An inventory becomes more useful when it moves beyond a list of independent elements.&lt;/p&gt;

&lt;p&gt;A project can be represented as a collection of components and relationships.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Backend subproject
    │
    ├── declares → flask
    ├── declares → openai
    └── uses_external_service → OpenAI

Backend Docker service
    │
    ├── builds → Backend subproject
    ├── depends_on → Database service
    └── uses_env_file → .env

Database Docker service
    │
    └── mounts → postgres_data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Project Inventory represents relationships including:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Relationship&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;declares&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Dependency declared by a subproject&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;depends_on&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Dependency between Docker services&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;builds&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Build associated with a subproject&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;uses_env_file&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Use of an environment file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;mounts&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Docker volume mount&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;uses_external_service&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Detected external service association&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Each relationship retains its type, the types of its source and target components, and the evidence that led to its establishment.&lt;/p&gt;

&lt;p&gt;A conceptual representation could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"depends_on"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"source"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"docker_service"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"backend"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"target"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"docker_service"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"database"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"evidence"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nl"&gt;"file"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"docker-compose.yml"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;"declaration"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"services.backend.depends_on"&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example illustrates a structured relationship. It does not reproduce the exact internal format of the engine.&lt;/p&gt;

&lt;p&gt;The essential principle is that a relationship should only be created when it can be established from an observed element.&lt;/p&gt;

&lt;p&gt;A technical map should not invent connections between components simply because they are present in the same project.&lt;/p&gt;




&lt;h2&gt;
  
  
  16. Separating Discovery From Enrichment
&lt;/h2&gt;

&lt;p&gt;Discovery and enrichment address two different requirements.&lt;/p&gt;

&lt;p&gt;Discovery identifies the elements actually present in the files.&lt;/p&gt;

&lt;p&gt;Enrichment interprets certain elements using known signatures.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Project files
       │
       ▼
Dynamic discovery
       │
       ├── Packages
       ├── Variables
       ├── Services
       └── Imports
       │
       ▼
Enrichment
       │
       ├── External service signatures
       ├── Infrastructure signatures
       └── Observable relationships
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A scanner does not need to know every existing Python, Node.js, or Rust package in advance to inventory them.&lt;/p&gt;

&lt;p&gt;It needs to know where to look and how to interpret the files that declare them.&lt;/p&gt;

&lt;p&gt;A signature can then provide additional information.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;OPENAI_API_KEY
    → OpenAI

STRIPE_SECRET_KEY
    → Stripe

SENTRY_DSN
    → Sentry
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An unknown package remains visible in the inventory even when no signature can enrich it.&lt;/p&gt;

&lt;p&gt;This separation allows interpretation capabilities to expand progressively without restricting discovery to a predefined catalog.&lt;/p&gt;




&lt;h2&gt;
  
  
  17. Generating Multiple Representations of the Same Inventory
&lt;/h2&gt;

&lt;p&gt;The engine produces several output formats from the analysis.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Consolidated results
         │
         ├── Terminal
         │
         ├── HTML
         │
         ├── JSON
         │
         └── CSV
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each format serves a different purpose.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Format&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Terminal&lt;/td&gt;
&lt;td&gt;Immediate inspection&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HTML&lt;/td&gt;
&lt;td&gt;Structured inventory presentation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;JSON&lt;/td&gt;
&lt;td&gt;Processing by other tools&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CSV&lt;/td&gt;
&lt;td&gt;Tabular analysis and processing&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The HTML report presents the architecture and detected information in a readable format.&lt;/p&gt;

&lt;p&gt;JSON retains detailed data in a structured representation.&lt;/p&gt;

&lt;p&gt;CSV files provide specialized views of the inventory.&lt;/p&gt;

&lt;p&gt;The documented output structure is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;output/
│
├── project-inventory.json
├── project-inventory.html
│
└── csv/
    ├── dependencies.csv
    ├── dependency_usage.csv
    ├── dockerfiles.csv
    ├── environment_variables.csv
    ├── external_services.csv
    ├── imports.csv
    ├── infrastructure_components.csv
    ├── service_relationships.csv
    ├── services.csv
    ├── source_files.csv
    ├── subprojects.csv
    └── technical_files.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Separating exporters makes it possible to produce different representations without reimplementing the entire analysis for each format.&lt;/p&gt;

&lt;p&gt;When a tool processes data from external projects, report generation must also consider security.&lt;/p&gt;

&lt;p&gt;A filename or extracted value must be properly escaped before being inserted into HTML. CSV exports intended for spreadsheet applications may also require protection against cells being interpreted as formulas.&lt;/p&gt;

&lt;p&gt;These are general report generation considerations rather than a description of the engine's internal security controls.&lt;/p&gt;




&lt;h2&gt;
  
  
  18. Running Locally or on a Server
&lt;/h2&gt;

&lt;p&gt;Project Inventory requires Python 3.11 or later.&lt;/p&gt;

&lt;p&gt;Its documented entry point is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python app.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The application then requests the path of the project to analyze.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Path of the project to analyze:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The results are displayed in the terminal and automatically exported to the &lt;code&gt;output&lt;/code&gt; directory.&lt;/p&gt;

&lt;p&gt;The engine can run on Windows, Linux, or macOS, as well as on a server with direct access to the project files.&lt;/p&gt;

&lt;p&gt;The analysis relies on the filesystem accessible to the application.&lt;/p&gt;

&lt;p&gt;No source code or secrets need to be transmitted to an external service to generate the inventory.&lt;/p&gt;

&lt;p&gt;The analyzed project is neither executed nor modified.&lt;/p&gt;

&lt;p&gt;However, read-only analysis of the target project must remain distinct from report generation: the engine writes its own output files to its dedicated output directory.&lt;/p&gt;




&lt;h2&gt;
  
  
  19. The Limitations of Static Analysis
&lt;/h2&gt;

&lt;p&gt;A technical inventory is not an exhaustive representation of a software application's actual behavior.&lt;/p&gt;

&lt;p&gt;Some information may remain invisible when it depends on runtime execution.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Static observation&lt;/th&gt;
&lt;th&gt;What it does not establish&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Declared package&lt;/td&gt;
&lt;td&gt;Actual usage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Locked version&lt;/td&gt;
&lt;td&gt;Version actually installed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Detected import&lt;/td&gt;
&lt;td&gt;Execution of the code path&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Declared Docker service&lt;/td&gt;
&lt;td&gt;Service currently running&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Detected variable&lt;/td&gt;
&lt;td&gt;Active configuration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Identified external service&lt;/td&gt;
&lt;td&gt;Actual network communication&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Static analysis does not replace the observation of running processes, network traffic, or deployed environments.&lt;/p&gt;

&lt;p&gt;Nor does it constitute, on its own, a security audit or vulnerability assessment.&lt;/p&gt;

&lt;p&gt;Its purpose is to provide a structured foundation for understanding a project, identifying its components, and guiding further investigation.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Technical analysis of a software project involves more than listing the files present in a directory.&lt;/p&gt;

&lt;p&gt;It requires recognizing formats, interpreting manifests, consolidating dependencies, identifying subprojects, and correlating information from source code and infrastructure configurations.&lt;/p&gt;

&lt;p&gt;A modular Python architecture makes it possible to separate these responsibilities across scanners, detectors, analyzers, and exporters.&lt;/p&gt;

&lt;p&gt;The distinction between discovery and enrichment allows the engine to dynamically inventory observed elements, then add information when signatures or relationships can be established.&lt;/p&gt;

&lt;p&gt;But the most important principle remains the traceability of observations.&lt;/p&gt;

&lt;p&gt;A declared dependency is not necessarily used. A detected variable does not prove a connection. A configured service is not necessarily running.&lt;/p&gt;

&lt;p&gt;A reliable technical inventory must therefore distinguish what is discovered, declared, locked, referenced, or interpreted without turning a static observation into a claim about the actual runtime behavior of the software.&lt;/p&gt;




&lt;h2&gt;
  
  
  Technical Documentation
&lt;/h2&gt;

&lt;p&gt;The engine architecture, supported ecosystems, static analysis mechanisms, and export formats are documented in the GitHub repository.&lt;/p&gt;

&lt;p&gt;The repository provides technical documentation rather than downloadable source code or production files.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Palks-Studio/project-inventory" rel="noopener noreferrer"&gt;View the technical documentation on GitHub&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;a href="https://palks-studio.com" rel="noopener noreferrer"&gt;https://palks-studio.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>architecture</category>
      <category>devtools</category>
      <category>programming</category>
    </item>
    <item>
      <title>📄 PHP Invoice Payment Stamping Engine Architecture: FPDI, Batch Processing, and Original Document Preservation</title>
      <dc:creator>Anthony Leignel</dc:creator>
      <pubDate>Sun, 15 Nov 2026 20:44:02 +0000</pubDate>
      <link>https://dev.to/palks_studio/php-invoice-payment-stamping-engine-architecture-fpdi-batch-processing-and-original-document-28a5</link>
      <guid>https://dev.to/palks_studio/php-invoice-payment-stamping-engine-architecture-fpdi-batch-processing-and-original-document-28a5</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3bhuyhszems5f23a50yf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3bhuyhszems5f23a50yf.png" alt="Invoice payment stamping interface supporting individual PDF processing and batch invoice selection." width="799" height="327"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A PDF invoice generally represents a document that has already been generated, transmitted, and potentially archived.&lt;/p&gt;

&lt;p&gt;When a payment is received, it may be necessary to produce a paid version of the invoice, including a payment confirmation stamp and the corresponding payment date.&lt;/p&gt;

&lt;p&gt;One approach is to modify the existing document directly. Another is to generate a new PDF from the original and overlay the payment information.&lt;/p&gt;

&lt;p&gt;The second approach preserves the original document while producing a separate visual payment confirmation.&lt;/p&gt;

&lt;p&gt;This article presents the architecture of a PHP invoice payment stamping engine using FPDI and FPDF, with support for individual PDF files, ZIP batch processing, and optional local archiving without a database.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Separating the Original Invoice From Its Payment Confirmation
&lt;/h2&gt;

&lt;p&gt;The first architectural principle is to never modify the original file.&lt;/p&gt;

&lt;p&gt;An invoice may already be stored in an accounting system, associated with a reference, or integrated into an electronic invoicing workflow.&lt;/p&gt;

&lt;p&gt;Directly modifying that document can introduce several problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Loss of the original version&lt;/li&gt;
&lt;li&gt;Modification of an already archived document&lt;/li&gt;
&lt;li&gt;Potential alteration of signatures or metadata&lt;/li&gt;
&lt;li&gt;Loss of embedded data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The engine therefore separates the source document from the generated document.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Original invoice
       │
       ▼
PDF import
       │
       ▼
Generate a copy
       │
       ▼
Overlay payment stamp
       │
       ▼
Paid invoice
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The original file remains unchanged.&lt;/p&gt;

&lt;p&gt;The generated document contains a visual representation of the invoice, supplemented by a red payment confirmation stamp and a payment date.&lt;/p&gt;

&lt;p&gt;This separation is particularly important when a PDF contains structured data or other elements that are not visible in its graphical representation.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. General Engine Architecture
&lt;/h2&gt;

&lt;p&gt;The engine is designed to be deployed directly within the client's environment.&lt;/p&gt;

&lt;p&gt;It relies on a protected web interface, a PHP engine, and specialized PDF processing libraries.&lt;/p&gt;

&lt;p&gt;No database is required to store documents.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Browser
    │
    ▼
Protected web interface
    │
    ▼
PHP engine
    │
    ├── Authentication
    ├── File processing
    ├── ZIP extraction
    ├── PDF generation
    └── Optional archiving
    │
    ▼
Download generated result
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Documents are processed temporarily and made available for immediate download.&lt;/p&gt;

&lt;p&gt;Depending on the deployment configuration, a stamped copy can also be retained in a dedicated local archive directory.&lt;/p&gt;

&lt;p&gt;The engine was designed as an add-on to a Factur-X EN16931 batch invoicing system, but it can operate independently of the main service after installation.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Project Structure
&lt;/h2&gt;

&lt;p&gt;The documented project structure separates the web interface, internal engine, dependencies, and storage directories.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;invoice-stamper/
│
├── temp_runtime/
│   └── .htaccess
│
├── dependencies/
├── paid_archives/
├── direct_archives/
├── logs/
│
├── access.php
├── stamper-engine.php
├── .htaccess
├── LICENCE.md
│
└── docs/
    └── README_FR.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each component has a distinct responsibility.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;Responsibility&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;access.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Public web interface entry point&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;stamper-engine.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Authentication and PDF processing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;temp_runtime/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Temporary processing files&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;dependencies/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Composer libraries&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;paid_archives/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Archived invoices from batch mode&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;direct_archives/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Archived PDFs from direct mode&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;logs/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Error logs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;.htaccess&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Protection of internal resources&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This organization separates the files required to execute the engine from the documents handled during processing.&lt;/p&gt;

&lt;p&gt;It also distinguishes temporary files from documents intended for long-term retention.&lt;/p&gt;

&lt;p&gt;The public documentation describes this architecture but does not distribute the production files.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. FPDI and FPDF: Importing and Reconstructing a Document
&lt;/h2&gt;

&lt;p&gt;PDF processing relies on two complementary libraries.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Library&lt;/th&gt;
&lt;th&gt;Responsibility&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;FPDI&lt;/td&gt;
&lt;td&gt;Import pages from an existing PDF&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;FPDF&lt;/td&gt;
&lt;td&gt;Generate a new PDF document&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;FPDI allows pages from an existing PDF to be imported and used as templates within a new document.&lt;/p&gt;

&lt;p&gt;FPDF then provides the functionality required to add text, shapes, and other graphical elements.&lt;/p&gt;

&lt;p&gt;The processing principle is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Original PDF
     │
     ▼
FPDI: import pages
     │
     ▼
FPDF: create new document
     │
     ▼
Add payment confirmation
     │
     ▼
Generated PDF
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The operation is not simply a matter of opening a PDF and modifying a few bytes.&lt;/p&gt;

&lt;p&gt;The engine reconstructs a new document from the imported page content.&lt;/p&gt;

&lt;p&gt;This distinction explains why certain properties of the original PDF may not be preserved in the generated result.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Educational Example: Overlaying a Payment Stamp
&lt;/h2&gt;

&lt;p&gt;A simplified example illustrates how FPDI and FPDF can be used together.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="n"&gt;php&lt;/span&gt;

&lt;span class="k"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'vendor/autoload.php'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="n"&gt;setasign&lt;/span&gt;\&lt;span class="nc"&gt;Fpdi&lt;/span&gt;\&lt;span class="nc"&gt;Fpdi&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;$pdf&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Fpdi&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;$pageCount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$pdf&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;setSourceFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'invoice.pdf'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$page&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;$page&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="nv"&gt;$pageCount&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;$page&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$template&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$pdf&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;importPage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$page&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;$size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$pdf&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;getTemplateSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$template&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="nv"&gt;$pdf&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nc"&gt;AddPage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nv"&gt;$size&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'orientation'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$size&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'width'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$size&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'height'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="nv"&gt;$pdf&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;useTemplate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$template&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$page&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$pdf&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nc"&gt;SetFont&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Helvetica'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'B'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nv"&gt;$pdf&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nc"&gt;SetTextColor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="nv"&gt;$pdf&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nc"&gt;SetXY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nv"&gt;$pdf&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nc"&gt;Cell&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'PAID'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="nv"&gt;$pdf&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nc"&gt;SetFont&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Helvetica'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nv"&gt;$pdf&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nc"&gt;SetXY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nv"&gt;$pdf&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nc"&gt;Cell&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'Payment date: 2026-11-15'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nv"&gt;$pdf&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nc"&gt;Output&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'F'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'invoice_paid.pdf'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is an educational example. It does not reproduce the production engine, its internal paths, or the exact positioning of its payment stamp.&lt;/p&gt;

&lt;p&gt;It illustrates several important operations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Importing each page of the source document&lt;/li&gt;
&lt;li&gt;Retrieving page dimensions and orientation&lt;/li&gt;
&lt;li&gt;Reproducing the page in a new document&lt;/li&gt;
&lt;li&gt;Adding graphical information&lt;/li&gt;
&lt;li&gt;Saving the result as a separate file&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this example, the payment stamp is applied only to the first page.&lt;/p&gt;

&lt;p&gt;A real implementation must consider the document layout to avoid placing the stamp over important invoice information.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;invoice.pdf&lt;/code&gt; file is never rewritten. Only &lt;code&gt;invoice_paid.pdf&lt;/code&gt; is generated.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Preserving Page Dimensions and Orientation
&lt;/h2&gt;

&lt;p&gt;Not every PDF uses an A4 portrait layout.&lt;/p&gt;

&lt;p&gt;An invoice may contain multiple pages, different page dimensions, or landscape-oriented content.&lt;/p&gt;

&lt;p&gt;It is therefore preferable to retrieve the characteristics of each imported page.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$template&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$pdf&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;importPage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$page&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;$size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$pdf&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;getTemplateSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$template&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;$pdf&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nc"&gt;AddPage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nv"&gt;$size&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'orientation'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$size&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'width'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$size&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'height'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This approach avoids imposing an arbitrary page format on the generated document.&lt;/p&gt;

&lt;p&gt;Stamp positioning introduces another consideration.&lt;/p&gt;

&lt;p&gt;A fixed position may work well for an invoice generated by a known invoicing engine but become problematic when processing a document from another system.&lt;/p&gt;

&lt;p&gt;An engine that accepts external PDF files must consider several constraints.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Constraint&lt;/th&gt;
&lt;th&gt;Potential issue&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Page format&lt;/td&gt;
&lt;td&gt;Incorrect positioning or scaling&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Orientation&lt;/td&gt;
&lt;td&gt;Incorrect stamp placement&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Existing content&lt;/td&gt;
&lt;td&gt;Overlaying important information&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Page count&lt;/td&gt;
&lt;td&gt;Stamping an inappropriate page&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These considerations illustrate general PDF processing challenges. They do not imply that the documented engine includes an automatic free-space detection algorithm.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Two Processing Modes: Direct and Batch
&lt;/h2&gt;

&lt;p&gt;The engine provides two processing modes.&lt;/p&gt;

&lt;p&gt;The first handles an individual PDF document.&lt;/p&gt;

&lt;p&gt;The second processes a monthly ZIP archive containing multiple invoices.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Payment stamping engine
          │
          ├── Direct mode
          │       └── Individual PDF
          │
          └── Batch mode
                  ├── Monthly ZIP
                  ├── Invoice list
                  ├── Individual stamping
                  └── Group stamping
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both modes use the same PDF generation principle, but they handle documents differently.&lt;/p&gt;

&lt;h3&gt;
  
  
  Direct Mode
&lt;/h3&gt;

&lt;p&gt;The user uploads a PDF, enters a payment date, and downloads the stamped document.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Upload PDF
     │
     ▼
Enter payment date
     │
     ▼
Validation
     │
     ▼
Generate paid PDF
     │
     ▼
Download
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This mode is not limited to invoices generated by the batch invoicing system.&lt;/p&gt;

&lt;p&gt;It accepts PDFs from other systems, provided their characteristics are compatible with the PDF processing libraries.&lt;/p&gt;

&lt;h3&gt;
  
  
  Batch Mode
&lt;/h3&gt;

&lt;p&gt;Batch mode begins with the upload of a monthly ZIP archive.&lt;/p&gt;

&lt;p&gt;The engine detects the invoices and presents a list containing information such as the client, invoice reference, and billing period.&lt;/p&gt;

&lt;p&gt;The user can then stamp an individual invoice or select multiple documents.&lt;/p&gt;

&lt;p&gt;This distinction provides a simple workflow for occasional processing while supporting larger document batches.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. Processing a Monthly ZIP Archive
&lt;/h2&gt;

&lt;p&gt;Batch processing adds an orchestration layer around the PDF engine.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Monthly ZIP archive
          │
          ▼
Temporary extraction
          │
          ▼
Invoice detection
          │
          ▼
Display invoice list
          │
          ▼
Document selection
          │
          ▼
Generate paid PDFs
          │
          ▼
Build output archive
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The input archive is not necessarily identical to the output archive.&lt;/p&gt;

&lt;p&gt;The result contains the selected and stamped documents, organized by client reference.&lt;/p&gt;

&lt;p&gt;The documented output structure is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;factures_acquittees.zip
│
└── clientRef/
    ├── F-2025-001_ACQUITTEE.pdf
    └── F-2025-002_ACQUITTEE.pdf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This organization facilitates the transmission of documents to the batch invoicing system.&lt;/p&gt;

&lt;p&gt;It also preserves a readable association between each invoice and its client without requiring an additional database.&lt;/p&gt;




&lt;h2&gt;
  
  
  9. ZIP Extraction and File Security
&lt;/h2&gt;

&lt;p&gt;Extracting a user-supplied archive is a sensitive operation.&lt;/p&gt;

&lt;p&gt;An archive can contain unexpected files, relative paths, or very large amounts of compressed data.&lt;/p&gt;

&lt;p&gt;For example, a ZIP entry could contain a path such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;../../outside.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Insufficiently controlled extraction could allow a file to be written outside the intended directory. This vulnerability category is commonly known as Zip Slip.&lt;/p&gt;

&lt;p&gt;One possible strategy is to validate each entry before extraction.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;isSafeZipEntry&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;str_replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'\\'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'/'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nf"&gt;str_starts_with&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'/'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
        &lt;span class="nf"&gt;preg_match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/^[a-zA-Z]:/'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="nv"&gt;$parts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;explode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nf"&gt;in_array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'..'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$parts&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example illustrates basic path validation.&lt;/p&gt;

&lt;p&gt;It is not a complete security solution and does not reproduce the internal controls of the engine.&lt;/p&gt;

&lt;p&gt;A robust implementation must also consider entry types, symbolic links, file size limits, file counts, and total decompressed size.&lt;/p&gt;

&lt;p&gt;The documented engine uses a dedicated temporary directory for archive extraction and PDF generation, with protection against direct web access.&lt;/p&gt;




&lt;h2&gt;
  
  
  10. Individual Stamping and Multiple Selection
&lt;/h2&gt;

&lt;p&gt;Batch mode supports stamping one invoice at a time or processing several documents with a shared payment date.&lt;/p&gt;

&lt;p&gt;From an architectural perspective, individual document processing can be separated from batch orchestration.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Selected invoices
         │
         ▼
Validate payment date
         │
         ▼
For each invoice
         │
         ├── Import PDF
         ├── Generate payment stamp
         └── Create output document
         │
         ▼
Prepare result
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A conceptual selection model could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"payment_date"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2026-11-15"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"invoices"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nl"&gt;"reference"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"F-2026-001"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;"client"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"CLIENT-A"&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nl"&gt;"reference"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"F-2026-002"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;"client"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"CLIENT-A"&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This JSON is illustrative. It does not represent a public data exchange format used by the engine.&lt;/p&gt;

&lt;p&gt;The shared payment date is applied to the selected documents.&lt;/p&gt;

&lt;p&gt;In a real application, invoice references received from the browser must be validated on the server to ensure that they correspond to documents accessible within the current batch.&lt;/p&gt;

&lt;p&gt;A reference supplied by the client should not be interpreted directly as a filesystem path.&lt;/p&gt;




&lt;h2&gt;
  
  
  11. Generating ZIP Archives in the Browser
&lt;/h2&gt;

&lt;p&gt;The project also uses JSZip to generate ZIP archives on the client side.&lt;/p&gt;

&lt;p&gt;This library allows an archive to be assembled directly in the browser from files that are already available.&lt;/p&gt;

&lt;p&gt;An educational example could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;zip&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;JSZip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;clientFolder&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;zip&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;folder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"CLIENT-A"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;clientFolder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s2"&gt;"F-2026-001_ACQUITTEE.pdf"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;firstPdfBlob&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;clientFolder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s2"&gt;"F-2026-002_ACQUITTEE.pdf"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;secondPdfBlob&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;archive&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;zip&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;generateAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"blob"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The resulting archive can then be offered for download:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createObjectURL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;archive&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;link&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"a"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;link&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;href&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;link&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;download&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"factures_acquittees.zip"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;appendChild&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;link&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;link&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;click&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;link&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;remove&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nb"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="no"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;revokeObjectURL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These examples assume that the generated PDF documents are already available as &lt;code&gt;Blob&lt;/code&gt; objects.&lt;/p&gt;

&lt;p&gt;They illustrate client-side ZIP generation without reproducing the protocol used by the engine to transfer the documents.&lt;/p&gt;

&lt;p&gt;This approach separates two responsibilities:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PHP server
    └── Generate paid PDF documents

Browser
    └── Assemble ZIP archive
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Client-side archive generation does not mean that all PDF processing occurs locally in the browser. The PDF documents are processed by the PHP engine within the client's environment.&lt;/p&gt;

&lt;p&gt;JSZip is loaded from a CDN in the documented architecture. This dependency may therefore require network access unless it is hosted locally in a different deployment configuration.&lt;/p&gt;




&lt;h2&gt;
  
  
  12. Factur-X: Preserving the Original Does Not Mean Preserving XML in the Copy
&lt;/h2&gt;

&lt;p&gt;The engine was originally designed as an add-on to a Factur-X EN16931 batch invoicing system.&lt;/p&gt;

&lt;p&gt;This introduces an important technical constraint.&lt;/p&gt;

&lt;p&gt;A Factur-X invoice combines two representations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Original Factur-X invoice
          │
          ├── PDF/A-3
          │       └── Human-readable document
          │
          └── Embedded XML
                  └── Structured invoice data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When an engine imports PDF pages to generate a new document, it may reproduce their appearance without preserving every internal element of the original file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Original Factur-X invoice
          │
          ▼
Import PDF pages
          │
          ▼
Graphical reconstruction
          │
          ▼
Paid PDF
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The generated document may therefore preserve the invoice's visual appearance without preserving its embedded XML.&lt;/p&gt;

&lt;p&gt;It may also no longer satisfy the PDF/A-3 requirements of the source document.&lt;/p&gt;

&lt;p&gt;The engine does not guarantee the preservation of embedded Factur-X XML data in reprocessed PDF files.&lt;/p&gt;

&lt;p&gt;This limitation must remain explicit.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Document&lt;/th&gt;
&lt;th&gt;Role&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Original Factur-X&lt;/td&gt;
&lt;td&gt;Invoice and structured data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Generated paid PDF&lt;/td&gt;
&lt;td&gt;Visual payment confirmation&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The stamped PDF should therefore not automatically be presented as a new compliant Factur-X invoice.&lt;/p&gt;

&lt;p&gt;Producing a genuinely modified Factur-X document would require preserving or reconstructing the required components, verifying data consistency, and validating the result against the applicable specifications.&lt;/p&gt;

&lt;p&gt;That is not the objective of the payment stamping engine presented here.&lt;/p&gt;




&lt;h2&gt;
  
  
  13. Temporary Files and Local Archiving
&lt;/h2&gt;

&lt;p&gt;The engine distinguishes between two storage categories.&lt;/p&gt;

&lt;p&gt;Temporary files are required during ZIP extraction and document generation.&lt;/p&gt;

&lt;p&gt;Paid archives contain copies retained when archiving is enabled.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Local storage
     │
     ├── temp_runtime/
     │       ├── ZIP extraction
     │       └── PDF generation
     │
     ├── paid_archives/
     │       └── Batch mode documents
     │
     └── direct_archives/
             └── Direct mode documents
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Temporary files are deleted after processing.&lt;/p&gt;

&lt;p&gt;Optional archives remain separate from this working directory.&lt;/p&gt;

&lt;p&gt;This separation prevents documents required for an active operation from being confused with documents intended for long-term retention.&lt;/p&gt;

&lt;h3&gt;
  
  
  Isolating Processing Jobs
&lt;/h3&gt;

&lt;p&gt;An engine handling multiple documents can benefit from a separate working directory for each processing job.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$jobId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;bin2hex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;random_bytes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;$workDir&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;sys_get_temp_dir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="no"&gt;DIRECTORY_SEPARATOR&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="s1"&gt;'invoice-'&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nv"&gt;$jobId&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nf"&gt;mkdir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$workDir&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0700&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;RuntimeException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="s1"&gt;'Unable to create temporary directory.'&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example illustrates a generic job isolation strategy.&lt;/p&gt;

&lt;p&gt;It does not describe the exact mechanism used within &lt;code&gt;temp_runtime/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Isolation can reduce filename collisions between concurrent operations and simplify the removal of files associated with a specific job.&lt;/p&gt;

&lt;p&gt;Reliable cleanup must also account for processing errors and interrupted executions.&lt;/p&gt;




&lt;h2&gt;
  
  
  14. Operating Without a Database
&lt;/h2&gt;

&lt;p&gt;The engine does not use a database to store documents.&lt;/p&gt;

&lt;p&gt;PDF files and ZIP archives are the primary resources handled by the system.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Inputs
    ├── Individual PDF
    └── ZIP archive

Processing
    ├── Temporary files
    ├── Payment information
    └── PDF generation

Outputs
    ├── Paid PDF
    ├── Structured ZIP
    └── Optional local archive
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This architecture is suitable for a tool whose primary responsibility is transforming existing documents.&lt;/p&gt;

&lt;p&gt;It avoids introducing a relational storage layer solely to retain files.&lt;/p&gt;

&lt;p&gt;However, operating without a database does not mean operating without state.&lt;/p&gt;

&lt;p&gt;Authentication, sessions, temporary files, and active processing jobs still require appropriate management mechanisms.&lt;/p&gt;

&lt;p&gt;If the system were extended to provide comprehensive payment tracking, complex searches, or shared transaction history, its storage requirements could change.&lt;/p&gt;

&lt;p&gt;The architectural choice therefore depends on the actual responsibility of the engine.&lt;/p&gt;




&lt;h2&gt;
  
  
  15. Authentication and Internal Resource Protection
&lt;/h2&gt;

&lt;p&gt;The web interface is password-protected.&lt;/p&gt;

&lt;p&gt;The documented engine includes several security mechanisms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Protection against brute-force attempts&lt;/li&gt;
&lt;li&gt;Secure session management&lt;/li&gt;
&lt;li&gt;Protection against unauthorized file access&lt;/li&gt;
&lt;li&gt;Payment data validation&lt;/li&gt;
&lt;li&gt;Temporary file cleanup&lt;/li&gt;
&lt;li&gt;HTTP response security controls&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Separating the public entry point from the internal engine provides another architectural boundary.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Browser
    │
    ▼
access.php
    │
    ▼
Internal engine
    │
    ├── Dependencies
    ├── Temporary files
    └── Archives
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;.htaccess&lt;/code&gt; rules help prevent direct access to internal resources in a correctly configured Apache environment.&lt;/p&gt;

&lt;p&gt;Password protection alone is insufficient if processed files remain directly accessible through their URLs.&lt;/p&gt;

&lt;p&gt;Security controls must therefore apply to both the interface and the resources it handles.&lt;/p&gt;

&lt;h3&gt;
  
  
  Payment Date Validation
&lt;/h3&gt;

&lt;p&gt;A date received from a form must be validated on the server.&lt;/p&gt;

&lt;p&gt;A generic PHP example could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;validatePaymentDate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nv"&gt;$value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;DateTimeImmutable&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;createFromFormat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="s1"&gt;'!Y-m-d'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nv"&gt;$value&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$date&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
        &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nv"&gt;$date&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Y-m-d'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nv"&gt;$value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This validation checks the format and calendar validity of the date.&lt;/p&gt;

&lt;p&gt;It does not establish that a payment has actually occurred.&lt;/p&gt;

&lt;p&gt;Business rules, such as whether future payment dates are permitted, must be defined separately according to the system's requirements.&lt;/p&gt;




&lt;h2&gt;
  
  
  16. A Payment Stamp Is Not a Bank Confirmation
&lt;/h2&gt;

&lt;p&gt;The engine generates a document containing a payment confirmation stamp based on a date supplied by the user.&lt;/p&gt;

&lt;p&gt;This operation must be distinguished from automated payment verification.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Payment completed
        │
        ▼
User enters payment date
        │
        ▼
Generate visual confirmation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The engine does not independently establish the existence of a bank transaction.&lt;/p&gt;

&lt;p&gt;The stamping operation alone does not perform accounting reconciliation or provide independent confirmation that a payment has been received.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operation&lt;/th&gt;
&lt;th&gt;Responsibility&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Bank verification&lt;/td&gt;
&lt;td&gt;Establish whether payment occurred&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reconciliation&lt;/td&gt;
&lt;td&gt;Associate payment with an invoice&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Visual stamping&lt;/td&gt;
&lt;td&gt;Generate a paid document&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Archiving&lt;/td&gt;
&lt;td&gt;Retain the generated document&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This distinction defines the scope of the tool.&lt;/p&gt;

&lt;p&gt;The engine transforms a document using supplied payment information. It is not, by itself, a complete financial management system.&lt;/p&gt;




&lt;h2&gt;
  
  
  17. Dependencies and Runtime Environment
&lt;/h2&gt;

&lt;p&gt;The engine requires PHP 8.0 or later.&lt;/p&gt;

&lt;p&gt;The documented requirements include:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;PHP 8.0+&lt;/td&gt;
&lt;td&gt;Engine execution&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;zip&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;ZIP archive processing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;mbstring&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Multibyte string handling&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Composer&lt;/td&gt;
&lt;td&gt;PHP dependency management&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;FPDI&lt;/td&gt;
&lt;td&gt;PDF page import&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;FPDF&lt;/td&gt;
&lt;td&gt;PDF document generation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;JSZip&lt;/td&gt;
&lt;td&gt;Browser-side ZIP generation&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The engine is designed to be installed within the client's environment.&lt;/p&gt;

&lt;p&gt;It does not require a database or a permanent connection to the main invoicing service after installation.&lt;/p&gt;

&lt;p&gt;PHP dependencies are stored in a dedicated directory.&lt;/p&gt;

&lt;p&gt;The public documentation describes the components and operating principles without providing a public installation procedure or production files.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;An invoice payment stamping engine involves more than adding red text to a PDF.&lt;/p&gt;

&lt;p&gt;It must distinguish the original document from the generated copy, correctly import pages, process individual documents and archives, validate incoming data, and manage the lifecycle of temporary files.&lt;/p&gt;

&lt;p&gt;FPDI and FPDF provide a relatively lightweight foundation for PDF reconstruction. JSZip complements batch processing by allowing archives to be assembled in the browser.&lt;/p&gt;

&lt;p&gt;Operating without a database remains consistent with an engine specialized in document transformation and optional local archiving.&lt;/p&gt;

&lt;p&gt;The Factur-X limitation remains essential: preserving the original invoice does not mean that the stamped copy automatically retains its embedded XML or PDF/A-3 compliance.&lt;/p&gt;

&lt;p&gt;The responsibility of the engine is therefore clearly defined: generate a separate visual payment confirmation without modifying the source document.&lt;/p&gt;




&lt;h2&gt;
  
  
  Technical Documentation
&lt;/h2&gt;

&lt;p&gt;The project architecture, dependencies, processing workflows, and security considerations are documented in the GitHub repository.&lt;/p&gt;

&lt;p&gt;The repository provides technical documentation rather than downloadable source code or production files.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Palks-Studio/invoice-stamper" rel="noopener noreferrer"&gt;View the technical documentation on GitHub&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;a href="https://palks-studio.com" rel="noopener noreferrer"&gt;https://palks-studio.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>php</category>
      <category>architecture</category>
      <category>pdf</category>
      <category>automation</category>
    </item>
    <item>
      <title>🧩 Building Interactive Experiences with Vanilla JavaScript to Explain Technical Systems</title>
      <dc:creator>Anthony Leignel</dc:creator>
      <pubDate>Sun, 15 Nov 2026 20:35:51 +0000</pubDate>
      <link>https://dev.to/palks_studio/building-interactive-experiences-with-vanilla-javascript-to-explain-technical-systems-3kj7</link>
      <guid>https://dev.to/palks_studio/building-interactive-experiences-with-vanilla-javascript-to-explain-technical-systems-3kj7</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiyn3qsxehijgy71zfv8w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiyn3qsxehijgy71zfv8w.png" alt="Interactive experience interface illustrating cookies, personal data collection, and data processing mechanisms." width="800" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A user interface usually shows the result of an action, but rarely everything that happens behind it.&lt;/p&gt;

&lt;p&gt;Clicking a login button can trigger several security checks. An API request can involve validation, data transformation, and error handling. An electronic invoice can contain structured data that remains invisible in its PDF representation.&lt;/p&gt;

&lt;p&gt;Technical documentation is useful for understanding these mechanisms, but it does not always make the sequence of operations easy to follow.&lt;/p&gt;

&lt;p&gt;Another approach is to represent these processes through interactive experiences.&lt;/p&gt;

&lt;p&gt;Users trigger an action, observe the different stages, and progressively discover the underlying technical mechanisms.&lt;/p&gt;

&lt;p&gt;This article presents the architecture of a collection of six interactive experiences built with native HTML, CSS, and JavaScript, without a frontend framework.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Making Invisible Processes Visible
&lt;/h2&gt;

&lt;p&gt;Consider a simple example: authentication.&lt;/p&gt;

&lt;p&gt;From the user's perspective, the process may consist of three actions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Enter credentials
       │
       ▼
Click "Log in"
       │
       ▼
Access the application
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From the system's perspective, the same operation can involve several additional mechanisms:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Authentication request
         │
         ▼
Input validation
         │
         ▼
Credential verification
         │
         ▼
Security checks
         │
         ▼
Session creation or renewal
         │
         ▼
Response to the user
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The purpose of an interactive experience is to make these stages understandable without requiring users to study the entire architecture beforehand.&lt;/p&gt;

&lt;p&gt;The objective is not necessarily to reproduce a real system, but to represent the operations that may be involved in its execution.&lt;/p&gt;

&lt;p&gt;This distinction makes it possible to create lightweight simulations while maintaining technical accuracy.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. A Frontend Architecture Without a Framework
&lt;/h2&gt;

&lt;p&gt;The experiences rely on three native browser technologies:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Technology&lt;/th&gt;
&lt;th&gt;Responsibility&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;HTML&lt;/td&gt;
&lt;td&gt;Experience structure and content&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CSS&lt;/td&gt;
&lt;td&gt;Presentation and visual states&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;JavaScript&lt;/td&gt;
&lt;td&gt;Interactions and progression logic&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The project does not require a frontend framework.&lt;/p&gt;

&lt;p&gt;Each experience has its own interface and interactive logic while sharing a common visual foundation.&lt;/p&gt;

&lt;p&gt;The documented project structure is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;interactive-experiences/
│
├── README.md
├── LICENSE
│
├── assets/
│   └── interactive.css
│
├── fr/
│   ├── cookies.html
│   ├── automatisation.html
│   ├── securite.html
│   ├── facturx.html
│   ├── from-scratch.html
│   └── api-interactive.html
│
└── en/
    ├── cookies.html
    ├── automation.html
    ├── security.html
    ├── facturx.html
    ├── from-scratch.html
    └── api-interactive.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This organization separates experiences and languages while sharing the visual presentation layer.&lt;/p&gt;

&lt;p&gt;The public documentation describes the project architecture but does not distribute production files.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Representing an Experience as a Sequence of States
&lt;/h2&gt;

&lt;p&gt;An interactive experience can be modeled as a sequence of states.&lt;/p&gt;

&lt;p&gt;Each state represents a stage of the process being examined.&lt;/p&gt;

&lt;p&gt;For example, an API request simulation could follow this progression:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Initial state
      │
      ▼
Request sent
      │
      ▼
Data validated
      │
      ▼
Processing completed
      │
      ▼
Response received
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A simplified JavaScript representation could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;steps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"request"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Sending the request"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"The client transmits the data."&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"validation"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Validation"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"The server validates the data."&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"processing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Processing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Business logic is executed."&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"response"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Response"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"The server returns a result."&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This structure describes the stages independently of their visual representation.&lt;/p&gt;

&lt;p&gt;A function can then display the current stage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;currentStep&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;renderStep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;step&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;currentStep&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"#step-title"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
        &lt;span class="n"&gt;step&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"#step-description"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
        &lt;span class="n"&gt;step&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A button allows the user to move to the next stage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"#next"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"click"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;currentStep&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;currentStep&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nf"&gt;renderStep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nf"&gt;renderStep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is an educational example. It illustrates one way to build an interactive sequence with vanilla JavaScript without reproducing the production code of the experiences.&lt;/p&gt;

&lt;p&gt;The benefit of this approach is that explanatory content, application state, and interface rendering remain separate.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. From Scratch vs. Prebuilt: Visualizing Architectural Trade-Offs
&lt;/h2&gt;

&lt;p&gt;The first experience compares two ways of addressing the same requirement: building a system from native components or using a prebuilt solution.&lt;/p&gt;

&lt;p&gt;Both approaches can produce comparable functional results, but they distribute complexity differently.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Same requirement
       │
       ├── Custom implementation
       │       ├── Component selection
       │       ├── Rule implementation
       │       └── Direct maintenance
       │
       └── Prebuilt solution
               ├── Existing features
               ├── Configuration
               └── Adaptation to constraints
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An interactive experience makes it possible to compare these two paths while progressively revealing their implications.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Criterion&lt;/th&gt;
&lt;th&gt;Custom implementation&lt;/th&gt;
&lt;th&gt;Prebuilt solution&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Initial work&lt;/td&gt;
&lt;td&gt;Build the system&lt;/td&gt;
&lt;td&gt;Existing functionality&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Architecture&lt;/td&gt;
&lt;td&gt;Component selection&lt;/td&gt;
&lt;td&gt;Existing structure&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Evolution&lt;/td&gt;
&lt;td&gt;Direct adaptation&lt;/td&gt;
&lt;td&gt;Available extensions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Maintenance&lt;/td&gt;
&lt;td&gt;Internal ownership&lt;/td&gt;
&lt;td&gt;Dependency maintenance&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The objective is not to present one approach as universally superior to the other.&lt;/p&gt;

&lt;p&gt;A prebuilt solution can significantly reduce development time. A custom implementation can provide greater architectural freedom when requirements are specific.&lt;/p&gt;

&lt;p&gt;In both cases, complexity exists. It is simply distributed across different parts of the system.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. APIs and Integration: Following a Request Between Two Systems
&lt;/h2&gt;

&lt;p&gt;An API is often introduced through a short example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/api/example"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, these two lines can hide a much larger sequence of operations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Client
  │
  ├── Request construction
  ├── Data transmission
  │
  ▼
Server
  │
  ├── Authentication, if required
  ├── Validation
  ├── Authorization
  ├── Business logic
  │
  ▼
HTTP response
  │
  ├── Status code
  ├── Response data
  └── Error handling
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The API and integration experience allows users to follow this type of sequence and understand the operations that may occur between two systems.&lt;/p&gt;

&lt;h3&gt;
  
  
  Introducing Alternative Paths
&lt;/h3&gt;

&lt;p&gt;A technical process does not always follow a linear path.&lt;/p&gt;

&lt;p&gt;A request may be rejected, contain invalid data, or fail during processing.&lt;/p&gt;

&lt;p&gt;A simulation can represent these situations through different branches:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Request received
       │
       ▼
Valid data?
       │
       ├── No → HTTP 400
       │
       └── Yes
              │
              ▼
          Processing
              │
              ├── Failure → HTTP 500
              │
              └── Success → HTTP 200
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The HTTP status codes shown here are generic examples.&lt;/p&gt;

&lt;p&gt;Their actual use depends on the nature of the request and the error encountered.&lt;/p&gt;

&lt;p&gt;This representation demonstrates that integration is not simply about transmitting data. It also requires defining how systems behave when operations do not proceed as expected.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Automation: Breaking a Task Into Technical Operations
&lt;/h2&gt;

&lt;p&gt;An automated task may appear simple when described by its result.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Automatically generate a document
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A real implementation, however, may require several operations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Retrieve data
      │
      ▼
Validate information
      │
      ▼
Apply business rules
      │
      ▼
Generate the document
      │
      ▼
Verify the result
      │
      ▼
Store or transmit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The automation experience exposes the difference between the visible task and the process required to execute it.&lt;/p&gt;

&lt;p&gt;An interactive scenario can also demonstrate what happens when a condition is not satisfied.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;validateInput&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;reference&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;valid&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Missing reference"&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;valid&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example illustrates a basic validation rule.&lt;/p&gt;

&lt;p&gt;In a real system, the rules may be considerably more extensive and depend on the business context.&lt;/p&gt;

&lt;p&gt;The educational objective is to demonstrate that automation is not simply about replacing a manual action with a script.&lt;/p&gt;

&lt;p&gt;It requires formalizing execution conditions, validation rules, possible errors, and expected results.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Application Security: The Mechanisms Behind Authentication
&lt;/h2&gt;

&lt;p&gt;A login interface generally consists of a few input fields and a button.&lt;/p&gt;

&lt;p&gt;However, application security depends on mechanisms that are not directly visible in that interface.&lt;/p&gt;

&lt;p&gt;An interactive experience can represent several layers of security controls.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Mechanism&lt;/th&gt;
&lt;th&gt;Responsibility&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Validation&lt;/td&gt;
&lt;td&gt;Check incoming data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Authentication&lt;/td&gt;
&lt;td&gt;Verify credentials&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rate limiting&lt;/td&gt;
&lt;td&gt;Reduce abusive attempts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Session&lt;/td&gt;
&lt;td&gt;Maintain an authenticated state&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Authorization&lt;/td&gt;
&lt;td&gt;Control access to resources&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The application security experience reveals the checks that may occur behind an authentication process.&lt;/p&gt;

&lt;h3&gt;
  
  
  Authentication vs. Authorization
&lt;/h3&gt;

&lt;p&gt;These two concepts are often confused.&lt;/p&gt;

&lt;p&gt;Authentication answers the question:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Who is the user?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Authorization answers a different question:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Which operations can the user perform?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A successfully authenticated user should not necessarily have access to every application resource.&lt;/p&gt;

&lt;p&gt;An interactive representation makes this distinction visible by separating the stages.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Identity verified
        │
        ▼
Resource requested
        │
        ▼
Sufficient permissions?
        │
        ├── No → Access denied
        │
        └── Yes → Access granted
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is an educational representation.&lt;/p&gt;

&lt;p&gt;A simulation running in the browser does not replace the server-side security controls required in a real application.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. Cookies and Personal Data: Representing Invisible Exchanges
&lt;/h2&gt;

&lt;p&gt;Accepting a cookie is a simple action from the user's perspective.&lt;/p&gt;

&lt;p&gt;However, the associated mechanisms can vary considerably depending on the type of cookie, its purpose, and the services involved.&lt;/p&gt;

&lt;p&gt;A cookie can maintain a session, remember a preference, or associate multiple interactions with an identifier.&lt;/p&gt;

&lt;p&gt;The cookies and personal data experience allows users to follow what may happen after accepting cookies, particularly when data collection, analysis, or profiling mechanisms are involved.&lt;/p&gt;

&lt;p&gt;A conceptual sequence can be represented as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User action
     │
     ▼
Cookie or identifier
     │
     ▼
Association with interactions
     │
     ▼
Potential analysis
     │
     ▼
Potential profiling
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This sequence does not mean that every cookie automatically triggers these operations.&lt;/p&gt;

&lt;p&gt;The purposes, collected information, and processing activities depend on the actual implementation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Separating Storage From Processing
&lt;/h3&gt;

&lt;p&gt;A cookie does not necessarily contain a complete profile.&lt;/p&gt;

&lt;p&gt;It may contain an identifier that allows a system to retrieve information stored elsewhere.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Browser cookie
       │
       └── Identifier: example-042
                        │
                        ▼
                  Remote system
                        │
                        └── Associated data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This distinction helps explain why the size or visible content of a cookie is not sufficient to determine the extent of a data processing operation.&lt;/p&gt;

&lt;p&gt;The experience represents these mechanisms without needing to perform actual user profiling.&lt;/p&gt;




&lt;h2&gt;
  
  
  9. Factur-X: Exploring the Two Representations of an Invoice
&lt;/h2&gt;

&lt;p&gt;A Factur-X invoice provides another example of a technical mechanism that remains largely invisible to the user.&lt;/p&gt;

&lt;p&gt;The document combines a human-readable PDF/A-3 representation with an embedded XML file containing structured invoice data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Factur-X invoice
       │
       ├── PDF/A-3
       │       └── Human-readable representation
       │
       └── Embedded XML
               └── Structured invoice data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Factur-X experience allows users to explore this dual representation and understand why the information must remain consistent.&lt;/p&gt;

&lt;p&gt;Consider a simplified example.&lt;/p&gt;

&lt;p&gt;Visible representation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Quantity: 2
Unit price excluding tax: €100.00
Total excluding tax: €200.00
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Illustrative XML representation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;invoice&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;quantity&amp;gt;&lt;/span&gt;2&lt;span class="nt"&gt;&amp;lt;/quantity&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;unitPrice&amp;gt;&lt;/span&gt;100.00&lt;span class="nt"&gt;&amp;lt;/unitPrice&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;total&amp;gt;&lt;/span&gt;200.00&lt;span class="nt"&gt;&amp;lt;/total&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/invoice&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This fragment is not a valid Factur-X XML document. It only illustrates the principle of structured data associated with an invoice.&lt;/p&gt;

&lt;h3&gt;
  
  
  Visualizing an Inconsistency
&lt;/h3&gt;

&lt;p&gt;An interactive experience can demonstrate what happens when the two representations contain different values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PDF: Total excluding tax = €200.00
XML: Total excluding tax = €250.00
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both values are individually readable, but they describe the same transaction differently.&lt;/p&gt;

&lt;p&gt;Consistency between the representations is therefore a separate concern from their syntactic validity.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Validation type&lt;/th&gt;
&lt;th&gt;Objective&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;XML structure&lt;/td&gt;
&lt;td&gt;Verify the data format&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Business rules&lt;/td&gt;
&lt;td&gt;Check relationships between fields&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PDF / XML consistency&lt;/td&gt;
&lt;td&gt;Compare shared information&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Factur-X profile&lt;/td&gt;
&lt;td&gt;Meet applicable requirements&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Actual Factur-X validation requires specifications and tools appropriate to the selected profile.&lt;/p&gt;

&lt;p&gt;The interactive experience explains the underlying principle without attempting to replace a complete validation engine.&lt;/p&gt;




&lt;h2&gt;
  
  
  10. Sharing Presentation Without Standardizing Every Experience
&lt;/h2&gt;

&lt;p&gt;The six experiences cover different subjects, but they can share common visual components.&lt;/p&gt;

&lt;p&gt;An authentication stage and an invoice validation stage can be represented using a similar structure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;section&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"experience-step"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Validation&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;
        The system checks the received data.
    &lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"button"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        Next step
    &lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A shared CSS file can define reusable elements:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.experience-step&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;1.5rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1px&lt;/span&gt; &lt;span class="n"&gt;solid&lt;/span&gt; &lt;span class="mh"&gt;#d1d5db&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;8px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.experience-step&lt;/span&gt; &lt;span class="nt"&gt;h2&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;margin-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.experience-step&lt;/span&gt; &lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.75rem&lt;/span&gt; &lt;span class="mi"&gt;1rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;pointer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These examples illustrate the principle of shared presentation without reproducing the project's stylesheet.&lt;/p&gt;

&lt;p&gt;A common CSS foundation maintains visual consistency across the experiences without imposing identical JavaScript logic on every subject.&lt;/p&gt;

&lt;p&gt;One experience may follow a linear sequence, while another may offer multiple choices, comparisons, or different outcomes depending on user actions.&lt;/p&gt;




&lt;h2&gt;
  
  
  11. Designing a Bilingual Interface
&lt;/h2&gt;

&lt;p&gt;The collection provides French and English versions.&lt;/p&gt;

&lt;p&gt;The project structure separates pages by language while sharing the stylesheet.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;assets/
    └── interactive.css

fr/
    └── securite.html

en/
    └── security.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This approach allows explanations and labels to be adapted without rebuilding the entire presentation layer.&lt;/p&gt;

&lt;p&gt;For an interactive experience, translation involves more than headings.&lt;/p&gt;

&lt;p&gt;It may also include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User instructions&lt;/li&gt;
&lt;li&gt;Stage descriptions&lt;/li&gt;
&lt;li&gt;Error messages&lt;/li&gt;
&lt;li&gt;Displayed results&lt;/li&gt;
&lt;li&gt;Action labels&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both language versions should preserve the same educational logic.&lt;/p&gt;

&lt;p&gt;A translated stage should not introduce different technical behavior simply because its text has been adapted.&lt;/p&gt;




&lt;h2&gt;
  
  
  12. Educational Simulations vs. Real Systems
&lt;/h2&gt;

&lt;p&gt;One distinction must remain clear throughout the design process: an interactive experience represents a mechanism but does not necessarily execute it under real operating conditions.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Experience&lt;/th&gt;
&lt;th&gt;Corresponding real system&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Simulated API call&lt;/td&gt;
&lt;td&gt;Client-server communication&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Simulated login&lt;/td&gt;
&lt;td&gt;Authentication and session handling&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Illustrated cookie&lt;/td&gt;
&lt;td&gt;Data storage and processing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Invoice exploration&lt;/td&gt;
&lt;td&gt;Factur-X generation and validation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Automated task&lt;/td&gt;
&lt;td&gt;Business rule execution&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A simulation can display an HTTP response without contacting a server.&lt;/p&gt;

&lt;p&gt;It can represent an authentication check without handling real credentials.&lt;/p&gt;

&lt;p&gt;It can demonstrate a profiling process without collecting the user's personal data.&lt;/p&gt;

&lt;p&gt;This separation makes it possible to build lightweight experiences that are accessible directly in the browser.&lt;/p&gt;

&lt;p&gt;However, it also introduces a requirement for precision: explanations must distinguish educational representations from the constraints of a real implementation.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Interactive experiences provide a complementary approach to explaining technical architectures and mechanisms.&lt;/p&gt;

&lt;p&gt;By breaking an operation into stages, they make it possible to reveal the validations, exchanges, decisions, and errors that normally remain hidden behind an interface.&lt;/p&gt;

&lt;p&gt;Native HTML, CSS, and JavaScript are sufficient to build this type of interactive sequence without introducing a frontend framework.&lt;/p&gt;

&lt;p&gt;The main challenge is not necessarily the technology itself, but the ability to represent the underlying process accurately.&lt;/p&gt;

&lt;p&gt;A well-designed interactive experience should not only demonstrate what happens when everything works. It should also help users understand why certain stages are necessary, which conditions can change the outcome, and where the limits of the simulation lie.&lt;/p&gt;

&lt;p&gt;This distinction between visible actions and underlying mechanisms is what makes interactive experiences particularly useful for understanding technical systems.&lt;/p&gt;




&lt;h2&gt;
  
  
  Technical Documentation
&lt;/h2&gt;

&lt;p&gt;The project architecture, file structure, technologies, and an overview of the six interactive experiences are documented in the GitHub repository.&lt;/p&gt;

&lt;p&gt;The repository provides technical documentation rather than downloadable source code or production files.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Palks-Studio/interactive-experiences" rel="noopener noreferrer"&gt;View the technical documentation on GitHub&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;a href="https://palks-studio.com" rel="noopener noreferrer"&gt;https://palks-studio.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>architecture</category>
      <category>beginners</category>
    </item>
    <item>
      <title>📡 Building Public Data Monitoring Dashboards: Automated Collection, SQLite Storage, and Time-Series Analysis</title>
      <dc:creator>Anthony Leignel</dc:creator>
      <pubDate>Wed, 30 Sep 2026 17:48:18 +0000</pubDate>
      <link>https://dev.to/palks_studio/i-built-public-data-radars-to-see-what-is-actually-changing-5ceg</link>
      <guid>https://dev.to/palks_studio/i-built-public-data-radars-to-see-what-is-actually-changing-5ceg</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9flfud9eb118deeqm8t2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9flfud9eb118deeqm8t2.png" alt="Fuel Radar interface displaying fuel availability indicators and historical time-series data." width="800" height="672"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Public data is available across a growing number of platforms, APIs, and institutional sources.&lt;/p&gt;

&lt;p&gt;Electricity production, gas storage, fuel availability, cybersecurity vulnerabilities, maritime traffic, and Internet infrastructure can all be monitored using publicly accessible information.&lt;/p&gt;

&lt;p&gt;However, accessing the data is only one part of the problem.&lt;/p&gt;

&lt;p&gt;Different sources expose different formats, update at different frequencies, and describe different types of events. Historical information may be difficult to retrieve, and raw measurements do not necessarily provide a useful representation of the current situation.&lt;/p&gt;

&lt;p&gt;The public data monitoring ecosystem developed by Palks Studio addresses this problem through five independent dashboards built around automated collection, local data storage, historical analysis, and native web visualization.&lt;/p&gt;

&lt;p&gt;The technical objective is to transform heterogeneous public datasets into consistent, readable monitoring interfaces without requiring a large application framework or a centralized analytics platform.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Five Monitoring Domains, One Architectural Principle
&lt;/h2&gt;

&lt;p&gt;The ecosystem currently covers five areas:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Monitoring domain&lt;/th&gt;
&lt;th&gt;Primary data categories&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Energy&lt;/td&gt;
&lt;td&gt;Electricity, gas storage, oil stocks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fuel availability&lt;/td&gt;
&lt;td&gt;Fuel availability, prices, geographical data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cybersecurity&lt;/td&gt;
&lt;td&gt;Exploited vulnerabilities, network observations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Maritime traffic&lt;/td&gt;
&lt;td&gt;Vessel movements, strategic maritime flows&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Digital infrastructure&lt;/td&gt;
&lt;td&gt;Internet signals, cloud incidents, DNS, routing&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Each domain has its own data sources, collection requirements, and interpretation rules.&lt;/p&gt;

&lt;p&gt;An electricity measurement cannot be processed in exactly the same way as a cybersecurity vulnerability or a cloud service incident.&lt;/p&gt;

&lt;p&gt;However, the underlying architecture follows a common principle:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Public data sources
         │
         ▼
     Collection
         │
         ▼
     Validation
         │
         ▼
    Normalization
         │
         ▼
       Storage
         │
         ▼
     Aggregation
         │
         ▼
     Visualization
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The visible dashboard is the final layer of the system.&lt;/p&gt;

&lt;p&gt;Most of the technical complexity exists before the data reaches the interface.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Separating Collection From Visualization
&lt;/h2&gt;

&lt;p&gt;A monitoring dashboard should not necessarily retrieve every external dataset whenever a user opens the page.&lt;/p&gt;

&lt;p&gt;Doing so would make the interface dependent on the availability, latency, and response time of multiple external services.&lt;/p&gt;

&lt;p&gt;A more controlled architecture separates the collection process from the public interface.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Scheduled collectors
         │
         ▼
External data sources
         │
         ▼
Local data storage
         │
         ▼
PHP application layer
         │
         ▼
HTML / CSS / JavaScript / SVG
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The collectors retrieve information independently of page requests.&lt;/p&gt;

&lt;p&gt;The public interface reads the available stored data and prepares the indicators, tables, and historical series required for visualization.&lt;/p&gt;

&lt;p&gt;This separation provides several architectural advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;External API latency does not directly determine page rendering time&lt;/li&gt;
&lt;li&gt;Historical information can remain available when a source becomes temporarily inaccessible&lt;/li&gt;
&lt;li&gt;Data can be normalized before reaching the presentation layer&lt;/li&gt;
&lt;li&gt;Collection and visualization can evolve independently&lt;/li&gt;
&lt;li&gt;Different interfaces can reuse the same underlying datasets&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The ecosystem uses scheduled collection processes, SQLite storage, PHP processing, and native browser technologies.&lt;/p&gt;

&lt;p&gt;The public dashboards are not responsible for performing the complete collection pipeline on every request.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Scheduled Collection With Cron
&lt;/h2&gt;

&lt;p&gt;Different data sources do not update at the same frequency.&lt;/p&gt;

&lt;p&gt;An electricity dataset may provide daily or more frequent measurements. A vulnerability catalog may change only when a new entry is published. An Internet monitoring source may expose observations across short time windows.&lt;/p&gt;

&lt;p&gt;The collection schedule must therefore reflect the characteristics of each source.&lt;/p&gt;

&lt;p&gt;A conceptual collection workflow is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Cron
  │
  ▼
Collector execution
  │
  ├── Request source data
  ├── Validate response
  ├── Normalize records
  ├── Store new information
  └── Record execution status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A scheduled collector can run independently of user activity.&lt;/p&gt;

&lt;p&gt;For example, a generic PHP collector could be scheduled every hour using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;0 * * * * /usr/bin/php /path/to/collector.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command is an educational example of cron scheduling. It does not reproduce a production command or server path.&lt;/p&gt;

&lt;h3&gt;
  
  
  Collection Frequency Is Not Data Frequency
&lt;/h3&gt;

&lt;p&gt;Running a collector every hour does not mean that its source publishes new information every hour.&lt;/p&gt;

&lt;p&gt;Consider a source that publishes one measurement per day.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Collection time&lt;/th&gt;
&lt;th&gt;Source measurement date&lt;/th&gt;
&lt;th&gt;New observation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;08:00&lt;/td&gt;
&lt;td&gt;November 14&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;09:00&lt;/td&gt;
&lt;td&gt;November 14&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10:00&lt;/td&gt;
&lt;td&gt;November 14&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;11:00&lt;/td&gt;
&lt;td&gt;November 15&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The collection process may execute several times before a new measurement becomes available.&lt;/p&gt;

&lt;p&gt;This is why collection timestamps and source timestamps must remain distinct.&lt;/p&gt;

&lt;p&gt;Otherwise, repeated retrievals of the same information could be incorrectly interpreted as new observations.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Normalizing Heterogeneous Data
&lt;/h2&gt;

&lt;p&gt;Public datasets do not necessarily use the same structure.&lt;/p&gt;

&lt;p&gt;One source may return JSON, another may expose CSV files, and another may provide an event-oriented API.&lt;/p&gt;

&lt;p&gt;Even when two sources return JSON, their field names, timestamps, units, and identifiers may differ.&lt;/p&gt;

&lt;p&gt;A conceptual example illustrates the problem.&lt;/p&gt;

&lt;p&gt;Source A:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"date"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2026-11-14"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;72.4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"unit"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"percent"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Source B:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"timestamp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2026-11-14T00:00:00Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"measurement"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.724&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both records could represent the same percentage, but their representations are different.&lt;/p&gt;

&lt;p&gt;A normalized record could be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"source"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"example-source"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"observed_at"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2026-11-14T00:00:00Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"metric"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"storage_level"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;72.4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"unit"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"percent"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These records are illustrative and do not reproduce an actual external API response or database schema.&lt;/p&gt;

&lt;p&gt;Normalization can involve several operations:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operation&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Timestamp conversion&lt;/td&gt;
&lt;td&gt;Establish a consistent time basis&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unit conversion&lt;/td&gt;
&lt;td&gt;Preserve comparable measurements&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Field mapping&lt;/td&gt;
&lt;td&gt;Standardize source-specific names&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Type conversion&lt;/td&gt;
&lt;td&gt;Convert textual values into numbers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Identifier handling&lt;/td&gt;
&lt;td&gt;Recognize repeated observations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Source attribution&lt;/td&gt;
&lt;td&gt;Preserve the origin of information&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Normalization does not mean forcing every dataset into a single universal structure.&lt;/p&gt;

&lt;p&gt;A numerical time series and an incident record may require different storage models.&lt;/p&gt;

&lt;p&gt;The important principle is consistency within each analytical domain.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. SQLite as a Storage Layer
&lt;/h2&gt;

&lt;p&gt;The monitoring ecosystem uses SQLite to retain collected information and historical datasets.&lt;/p&gt;

&lt;p&gt;SQLite is particularly useful for applications where the storage requirements are primarily local and the workload consists of periodic writes followed by analytical reads.&lt;/p&gt;

&lt;p&gt;A monitoring database can contain several types of information:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SQLite database
    ├── Latest observations
    ├── Historical measurements
    ├── Vulnerability records
    ├── Incident records
    ├── Source metadata
    └── Collection information
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The exact organization depends on the monitoring domain.&lt;/p&gt;

&lt;p&gt;For example, gas storage measurements are naturally represented as dated numerical observations.&lt;/p&gt;

&lt;p&gt;A cloud incident requires a different structure because it may contain an identifier, title, status, start time, and subsequent updates.&lt;/p&gt;

&lt;h3&gt;
  
  
  A Time-Series Storage Example
&lt;/h3&gt;

&lt;p&gt;A simplified SQLite table for numerical observations could be defined as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;measurements&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="kt"&gt;INTEGER&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;source&lt;/span&gt; &lt;span class="kt"&gt;TEXT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;metric&lt;/span&gt; &lt;span class="kt"&gt;TEXT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;observed_at&lt;/span&gt; &lt;span class="kt"&gt;TEXT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="kt"&gt;REAL&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;unit&lt;/span&gt; &lt;span class="kt"&gt;TEXT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;

    &lt;span class="k"&gt;UNIQUE&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;metric&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;observed_at&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is an educational schema, not the production schema of the radars.&lt;/p&gt;

&lt;p&gt;The unique constraint prevents the same source, metric, and observation timestamp from being inserted multiple times.&lt;/p&gt;

&lt;p&gt;An index can support historical queries:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="n"&gt;idx_measurements_history&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;measurements&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;metric&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;observed_at&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A query can then retrieve a specific historical series without scanning unrelated measurements.&lt;/p&gt;

&lt;p&gt;SQLite provides a relatively small storage layer while still supporting indexes, constraints, transactions, and SQL aggregation.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Deduplication and Repeated Collection
&lt;/h2&gt;

&lt;p&gt;Repeated collection introduces an important problem: the same observation may be retrieved multiple times.&lt;/p&gt;

&lt;p&gt;A collector must distinguish between:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A genuinely new measurement&lt;/li&gt;
&lt;li&gt;An observation already stored&lt;/li&gt;
&lt;li&gt;An existing observation that has been corrected&lt;/li&gt;
&lt;li&gt;An existing incident whose status has changed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These cases require different handling.&lt;/p&gt;

&lt;p&gt;For numerical observations, a combination of source, metric, and timestamp can often provide a stable identity.&lt;/p&gt;

&lt;p&gt;For incidents or vulnerability records, an identifier supplied by the source may be more appropriate.&lt;/p&gt;

&lt;p&gt;A conceptual SQLite insertion could use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;measurements&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;metric&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;observed_at&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;unit&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;VALUES&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;metric&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;observed_at&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;unit&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;CONFLICT&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;metric&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;observed_at&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;DO&lt;/span&gt; &lt;span class="k"&gt;NOTHING&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This approach ignores repeated observations with the same identity.&lt;/p&gt;

&lt;p&gt;However, ignoring duplicates is not always sufficient.&lt;/p&gt;

&lt;p&gt;If a source corrects a previously published measurement, an update strategy may be required:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;CONFLICT&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;metric&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;observed_at&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;DO&lt;/span&gt; &lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="k"&gt;SET&lt;/span&gt;
    &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;excluded&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;unit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;excluded&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;unit&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The appropriate strategy depends on the meaning of the record.&lt;/p&gt;

&lt;p&gt;An immutable historical event should not necessarily be overwritten in the same way as a corrected numerical measurement.&lt;/p&gt;

&lt;p&gt;The radars include anti-duplicate mechanisms, but the SQL examples above illustrate general storage strategies rather than reproducing the implementation of every collector.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Managing Historical Data
&lt;/h2&gt;

&lt;p&gt;A current measurement provides limited context without its historical evolution.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Gas storage: 72%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The value becomes more useful when compared with earlier measurements.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;30 days ago : 81%
7 days ago  : 76%
Yesterday   : 73%
Today       : 72%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The historical series reveals a direction of change that is not visible in the latest value alone.&lt;/p&gt;

&lt;p&gt;However, retaining historical information creates another challenge: the amount of data that must be processed and displayed increases over time.&lt;/p&gt;

&lt;p&gt;A dashboard covering several years does not necessarily need to render every individual measurement.&lt;/p&gt;

&lt;p&gt;The monitoring interfaces therefore use different temporal resolutions depending on the selected period and dataset.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Time range&lt;/th&gt;
&lt;th&gt;Possible display resolution&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Short term&lt;/td&gt;
&lt;td&gt;Individual or hourly records&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;30 days&lt;/td&gt;
&lt;td&gt;Daily observations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;90 days&lt;/td&gt;
&lt;td&gt;Daily observations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;One year&lt;/td&gt;
&lt;td&gt;Daily or aggregated values&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;All time&lt;/td&gt;
&lt;td&gt;Monthly or yearly aggregates&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The exact resolution varies across the radars.&lt;/p&gt;

&lt;p&gt;The purpose of aggregation is to reduce the number of displayed points without removing the historical information from storage.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. Temporal Aggregation With SQL
&lt;/h2&gt;

&lt;p&gt;SQL can transform detailed measurements into historical summaries before the data reaches the browser.&lt;/p&gt;

&lt;p&gt;For example, a monthly average can be calculated from daily observations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="nf"&gt;substr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;observed_at&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nb"&gt;AVG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;average_value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nb"&gt;COUNT&lt;/span&gt;&lt;span class="cm"&gt;(*) AS sample_count
FROM measurements
WHERE metric = :metric
GROUP BY month
ORDER BY month;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The resulting series contains one record per month instead of one record per observation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Daily measurements
    │
    ├── November 01
    ├── November 02
    ├── November 03
    ├── ...
    └── November 30
             │
             ▼
       Monthly average
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;sample_count&lt;/code&gt; field is useful because a monthly average calculated from three observations is not equivalent in coverage to one calculated from thirty observations.&lt;/p&gt;

&lt;h3&gt;
  
  
  Aggregation Depends on the Metric
&lt;/h3&gt;

&lt;p&gt;Not every historical series should use the same aggregation function.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric type&lt;/th&gt;
&lt;th&gt;Relevant aggregation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Storage percentage&lt;/td&gt;
&lt;td&gt;Average over available observations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;New vulnerabilities&lt;/td&gt;
&lt;td&gt;Count of additions during a period&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Event records&lt;/td&gt;
&lt;td&gt;Count of distinct events or signals&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Peak measurement&lt;/td&gt;
&lt;td&gt;Maximum within a period&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Latest observation&lt;/td&gt;
&lt;td&gt;Most recent valid value&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A monthly count of newly published vulnerabilities has a different meaning from a monthly average gas storage level.&lt;/p&gt;

&lt;p&gt;The aggregation method must preserve the meaning of the underlying data.&lt;/p&gt;

&lt;p&gt;For example, a power measurement expressed in megawatts should not simply be summed to calculate energy consumption in megawatt-hours. That calculation requires accounting for the duration represented by each measurement.&lt;/p&gt;




&lt;h2&gt;
  
  
  9. Energy Radar: Combining Different Time Series
&lt;/h2&gt;

&lt;p&gt;The Energy Radar brings together information relating to electricity, gas, and oil stocks.&lt;/p&gt;

&lt;p&gt;Its datasets include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Electricity consumption and production&lt;/li&gt;
&lt;li&gt;Electricity generation mix&lt;/li&gt;
&lt;li&gt;Gas consumption&lt;/li&gt;
&lt;li&gt;Gas storage levels in France and the European Union&lt;/li&gt;
&lt;li&gt;Historical oil stocks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These datasets represent different physical quantities.&lt;/p&gt;

&lt;p&gt;Electricity production may be expressed as power, gas storage as a percentage of capacity, and oil stocks as a physical quantity.&lt;/p&gt;

&lt;p&gt;Combining them into a single numerical score would remove important distinctions.&lt;/p&gt;

&lt;p&gt;Instead, the interface presents separate indicators and historical series.&lt;/p&gt;

&lt;h3&gt;
  
  
  Gas Storage History
&lt;/h3&gt;

&lt;p&gt;Gas storage provides a useful example of temporal aggregation.&lt;/p&gt;

&lt;p&gt;Daily measurements can be retained for recent periods, while a longer historical view can use monthly averages.&lt;/p&gt;

&lt;p&gt;A simplified query illustrating the approach is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="nf"&gt;substr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;zone&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nb"&gt;AVG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;remplissage_pct&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;average_fill&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;stocks_gaz&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;zone&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;zone&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;stocks_gaz&lt;/code&gt; dataset distinguishes geographical zones, including France and the European Union.&lt;/p&gt;

&lt;p&gt;Keeping the zone in the aggregation prevents measurements from different geographical scopes from being incorrectly combined.&lt;/p&gt;

&lt;p&gt;The resulting historical view can compare the evolution of both storage series.&lt;/p&gt;

&lt;h3&gt;
  
  
  Electricity Generation Mix
&lt;/h3&gt;

&lt;p&gt;Electricity production is also presented by generation source.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Electricity generation
    ├── Nuclear
    ├── Hydro
    ├── Wind
    ├── Solar
    ├── Gas
    ├── Bioenergy
    ├── Fuel oil
    └── Coal
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This makes it possible to inspect the composition of production rather than only its total value.&lt;/p&gt;

&lt;p&gt;The distinction between total production, consumption, and generation mix is important because these indicators answer different questions about the energy system.&lt;/p&gt;

&lt;p&gt;The dashboard is designed to present measured information and historical context, not to predict future energy availability.&lt;/p&gt;




&lt;h2&gt;
  
  
  10. Fuel Radar: Geographical Coverage and Availability
&lt;/h2&gt;

&lt;p&gt;Fuel availability introduces a different analytical problem.&lt;/p&gt;

&lt;p&gt;A national indicator can remain relatively stable while difficulties develop in specific geographical areas.&lt;/p&gt;

&lt;p&gt;A monitoring interface therefore needs to distinguish between overall availability and the distribution of available observations.&lt;/p&gt;

&lt;p&gt;A conceptual model could represent fuel information as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Fuel observations
    ├── Station identifier
    ├── Geographical location
    ├── Fuel type
    ├── Availability information
    ├── Price information
    └── Observation timestamp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This model illustrates the information categories involved rather than the exact production database structure.&lt;/p&gt;

&lt;h3&gt;
  
  
  Availability Is Not the Same as Reporting Coverage
&lt;/h3&gt;

&lt;p&gt;An important limitation of public fuel data is that missing information does not automatically establish that a fuel is unavailable.&lt;/p&gt;

&lt;p&gt;Several situations may exist:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Observation state&lt;/th&gt;
&lt;th&gt;Possible interpretation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Available&lt;/td&gt;
&lt;td&gt;Fuel reported as available&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unavailable&lt;/td&gt;
&lt;td&gt;Fuel reported as unavailable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Missing&lt;/td&gt;
&lt;td&gt;No usable observation was provided&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Outdated&lt;/td&gt;
&lt;td&gt;Last observation may no longer apply&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Treating every missing record as a confirmed shortage would produce misleading results.&lt;/p&gt;

&lt;p&gt;Similarly, an old price or availability report should not automatically be treated as a current observation.&lt;/p&gt;

&lt;p&gt;The Fuel Radar combines availability indicators, price information, geographical context, and historical evolution to make changes easier to examine.&lt;/p&gt;

&lt;p&gt;The quality and freshness of the underlying source data remain essential when interpreting the results.&lt;/p&gt;




&lt;h2&gt;
  
  
  11. Cyber Radar: Vulnerabilities and Network Observations
&lt;/h2&gt;

&lt;p&gt;Cybersecurity monitoring requires a distinction between several categories of information.&lt;/p&gt;

&lt;p&gt;The existence of a vulnerability, the publication of an alert, and the observation of malicious network activity do not represent the same event.&lt;/p&gt;

&lt;p&gt;The Cyber Radar includes data from the CISA Known Exploited Vulnerabilities catalog and DShield observations.&lt;/p&gt;

&lt;p&gt;These sources provide different perspectives.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Source&lt;/th&gt;
&lt;th&gt;Information category&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;CISA KEV&lt;/td&gt;
&lt;td&gt;Vulnerabilities with known exploitation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DShield&lt;/td&gt;
&lt;td&gt;Reported network activity observations&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The CISA KEV catalog contains vulnerabilities for which exploitation in the wild has been established according to its inclusion criteria.&lt;/p&gt;

&lt;p&gt;The historical catalog begins in November 2021.&lt;/p&gt;

&lt;p&gt;A monthly history of additions can therefore be represented as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;November 2021 → Number of additions
December 2021 → Number of additions
January 2022  → Number of additions
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Catalog Additions Are Not Attack Counts
&lt;/h3&gt;

&lt;p&gt;A vulnerability added to the KEV catalog is not equivalent to a newly observed cyberattack.&lt;/p&gt;

&lt;p&gt;Several dates may be relevant:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The original vulnerability disclosure date&lt;/li&gt;
&lt;li&gt;The date exploitation was observed&lt;/li&gt;
&lt;li&gt;The date the vulnerability was added to the catalog&lt;/li&gt;
&lt;li&gt;The date the collector retrieved the updated record&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These dates must not be treated as interchangeable.&lt;/p&gt;

&lt;p&gt;A monthly KEV history describes additions to the catalog, not the total number of attacks that occurred during that month.&lt;/p&gt;

&lt;p&gt;DShield observations introduce another consideration: historical averages must be calculated from available measurements rather than assuming that missing observations represent zero activity.&lt;/p&gt;

&lt;p&gt;The Cyber Radar therefore provides selected public indicators rather than attempting to replace a professional security monitoring or threat intelligence platform.&lt;/p&gt;




&lt;h2&gt;
  
  
  12. Maritime Traffic Radar: Monitoring Strategic Flows
&lt;/h2&gt;

&lt;p&gt;Maritime traffic introduces a geographical and temporal dimension to monitoring.&lt;/p&gt;

&lt;p&gt;A vessel movement is associated with a location, a timestamp, and potentially additional information about the vessel or route.&lt;/p&gt;

&lt;p&gt;The Maritime Traffic Radar focuses on strategic maritime flows and their evolution.&lt;/p&gt;

&lt;p&gt;A conceptual processing pipeline is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Maritime observations
         │
         ▼
Geographical selection
         │
         ▼
Time-based grouping
         │
         ▼
Flow indicators
         │
         ▼
Historical comparison
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unlike a static geographical dataset, maritime observations describe movement over time.&lt;/p&gt;

&lt;p&gt;A useful monitoring interface must therefore distinguish between different types of measurements.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Measurement&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Vessel presence&lt;/td&gt;
&lt;td&gt;Vessel observed within an area&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Vessel movement&lt;/td&gt;
&lt;td&gt;Change in reported position&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Passage count&lt;/td&gt;
&lt;td&gt;Recorded passages during a period&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Historical flow&lt;/td&gt;
&lt;td&gt;Evolution of a selected indicator&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These categories illustrate general maritime data analysis considerations.&lt;/p&gt;

&lt;p&gt;The interpretation of maritime information also depends on the coverage of the underlying source.&lt;/p&gt;

&lt;p&gt;A reduction in recorded activity may reflect an actual change in traffic, but it can also be influenced by reporting gaps or incomplete observations.&lt;/p&gt;

&lt;p&gt;Monitoring strategic maritime flows requires keeping that distinction visible rather than treating every variation as a confirmed disruption.&lt;/p&gt;




&lt;h2&gt;
  
  
  13. Digital Infrastructure Radar: Combining Multiple Signal Types
&lt;/h2&gt;

&lt;p&gt;The Digital Infrastructure Radar introduces a broader monitoring architecture.&lt;/p&gt;

&lt;p&gt;It brings together several categories of Internet and cloud infrastructure information:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Internet disruption signals from IODA&lt;/li&gt;
&lt;li&gt;Cloud provider incidents and service status information&lt;/li&gt;
&lt;li&gt;Cloudflare component status and maintenance information&lt;/li&gt;
&lt;li&gt;RIPE Atlas network measurements&lt;/li&gt;
&lt;li&gt;RIPE RIS routing observations&lt;/li&gt;
&lt;li&gt;DNS measurements&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These sources do not measure the same phenomenon.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Digital infrastructure monitoring
    ├── Internet disruption signals
    ├── Cloud service incidents
    ├── Component status
    ├── Network measurements
    ├── Routing observations
    └── DNS measurements
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An Internet disruption signal may indicate a change in network visibility or reachability.&lt;/p&gt;

&lt;p&gt;A cloud provider incident may describe a confirmed service degradation.&lt;/p&gt;

&lt;p&gt;A DNS measurement may report response success or latency.&lt;/p&gt;

&lt;p&gt;A routing observation may reflect changes in the network control plane.&lt;/p&gt;

&lt;p&gt;These observations can complement one another, but they should not be collapsed into a single count of infrastructure failures.&lt;/p&gt;

&lt;h3&gt;
  
  
  Signals Are Not Confirmed Incidents
&lt;/h3&gt;

&lt;p&gt;This distinction is particularly important for IODA data.&lt;/p&gt;

&lt;p&gt;Multiple observations may relate to the same network, geographical area, or underlying disruption.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;One underlying disruption
         │
         ├── BGP-related signal
         ├── Active probing signal
         └── Additional network observation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three signals do not necessarily establish three independent incidents.&lt;/p&gt;

&lt;p&gt;The radar therefore presents source-specific observations and historical evolution while preserving the distinction between detected signals and confirmed provider incidents.&lt;/p&gt;




&lt;h2&gt;
  
  
  14. Event-Oriented Storage for Infrastructure Monitoring
&lt;/h2&gt;

&lt;p&gt;Infrastructure incidents require a different storage approach from numerical time series.&lt;/p&gt;

&lt;p&gt;An incident can evolve after its initial publication.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;10:00 → Investigating
10:25 → Identified
11:10 → Monitoring
12:00 → Resolved
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These updates may all refer to the same incident.&lt;/p&gt;

&lt;p&gt;A collector must therefore recognize the incident identity while retaining the relevant information about its evolution.&lt;/p&gt;

&lt;p&gt;A simplified event record could contain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"source"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"example-provider"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"kind"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"incident"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"external_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"incident-001"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Service degradation"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"monitoring"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"started_at"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2026-11-14T10:00:00Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"first_seen"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2026-11-14T10:05:00Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"last_seen"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2026-11-14T11:15:00Z"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example is illustrative.&lt;/p&gt;

&lt;p&gt;The infrastructure monitoring database uses source information, record types, external identifiers, status fields, event timestamps, payloads, hashes, and first-seen and last-seen timestamps.&lt;/p&gt;

&lt;p&gt;These fields serve different purposes.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Field&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Source&lt;/td&gt;
&lt;td&gt;Identify the originating provider&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Kind&lt;/td&gt;
&lt;td&gt;Distinguish record categories&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;External ID&lt;/td&gt;
&lt;td&gt;Identify the source record&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Status&lt;/td&gt;
&lt;td&gt;Represent the current documented state&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Started at&lt;/td&gt;
&lt;td&gt;Record the reported event start&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;First seen&lt;/td&gt;
&lt;td&gt;Record initial collection time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Last seen&lt;/td&gt;
&lt;td&gt;Record the latest observation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hash&lt;/td&gt;
&lt;td&gt;Help identify changes in stored data&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;An external identifier helps recognize a record that has already been collected.&lt;/p&gt;

&lt;p&gt;A payload hash can help detect whether its contents have changed.&lt;/p&gt;

&lt;p&gt;First-seen and last-seen timestamps provide collection context without replacing the original event timestamps.&lt;/p&gt;

&lt;p&gt;This is particularly useful when historical records are retrieved retrospectively.&lt;/p&gt;




&lt;h2&gt;
  
  
  15. Historical Coverage and Retrospective Collection
&lt;/h2&gt;

&lt;p&gt;A monitoring system can retrieve historical information after the original events occurred.&lt;/p&gt;

&lt;p&gt;This introduces an important distinction between when an event happened and when it was collected.&lt;/p&gt;

&lt;p&gt;Consider the following example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Event start: November 09
First seen:  November 13
Last seen:   November 14
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The event belongs to November 9 in a historical event timeline.&lt;/p&gt;

&lt;p&gt;However, it was not collected until November 13.&lt;/p&gt;

&lt;p&gt;If historical collection is incomplete, the number of stored events may increase simply because the collector begins retrieving more records.&lt;/p&gt;

&lt;p&gt;That increase does not automatically establish an increase in real-world disruptions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pagination and Collection Completeness
&lt;/h3&gt;

&lt;p&gt;External APIs may limit the number of records returned by a single request.&lt;/p&gt;

&lt;p&gt;A collector that retrieves only the first page may miss additional observations.&lt;/p&gt;

&lt;p&gt;A conceptual paginated workflow is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Request page 1
      │
      ▼
Store returned records
      │
      ▼
More records available?
      │
      ├── Yes → Request next page
      │
      └── No  → Finish collection
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pagination is especially important when collecting historical event datasets or when the number of observations increases rapidly.&lt;/p&gt;

&lt;p&gt;The infrastructure monitoring system uses paginated collection for relevant IODA requests.&lt;/p&gt;

&lt;p&gt;Nevertheless, historical completeness depends on the available source data, requested time windows, pagination behavior, and successful collection runs.&lt;/p&gt;

&lt;p&gt;A historical graph should therefore be interpreted according to the coverage of its underlying dataset.&lt;/p&gt;




&lt;h2&gt;
  
  
  16. DNS Measurements and Weighted Aggregation
&lt;/h2&gt;

&lt;p&gt;The Digital Infrastructure Radar also includes DNS measurements collected through RIPE Atlas.&lt;/p&gt;

&lt;p&gt;The measurements provide information such as response success rates and response times.&lt;/p&gt;

&lt;p&gt;The collection uses measurement windows rather than continuously observing every DNS request.&lt;/p&gt;

&lt;p&gt;Historical views can aggregate the available measurements into hourly, daily, weekly, or longer periods.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Weighted Aggregation Matters
&lt;/h3&gt;

&lt;p&gt;Consider two measurement windows:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Window&lt;/th&gt;
&lt;th&gt;Measurements&lt;/th&gt;
&lt;th&gt;Successful responses&lt;/th&gt;
&lt;th&gt;Success rate&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;100%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;B&lt;/td&gt;
&lt;td&gt;900&lt;/td&gt;
&lt;td&gt;810&lt;/td&gt;
&lt;td&gt;90%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A simple average of the two success rates would produce:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(100% + 90%) / 2 = 95%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But the combined success rate is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Successful responses = 100 + 810
Total measurements   = 100 + 900

Combined success rate = 910 / 1000 × 100

Combined success rate = 91%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The difference comes from the unequal number of measurements in each window.&lt;/p&gt;

&lt;p&gt;The DNS history uses weighted aggregation based on available sample counts where appropriate.&lt;/p&gt;

&lt;p&gt;A conceptual calculation can be represented as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nb"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;success_rate&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;sample_count&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nb"&gt;NULLIF&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sample_count&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;weighted_success_rate&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;dns_measurements&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;period&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example illustrates the weighting principle rather than reproducing the production query.&lt;/p&gt;

&lt;p&gt;Missing measurement windows should remain distinguishable from measured zero values.&lt;/p&gt;

&lt;p&gt;A gap in DNS observations is not automatically evidence that DNS resolution failed during that period.&lt;/p&gt;




&lt;h2&gt;
  
  
  17. Native SVG Visualization
&lt;/h2&gt;

&lt;p&gt;The dashboards use native SVG for chart rendering rather than relying on a large visualization framework.&lt;/p&gt;

&lt;p&gt;SVG provides a coordinate system that can represent lines, points, labels, axes, and interactive overlays.&lt;/p&gt;

&lt;p&gt;A simplified chart could be represented as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;svg&lt;/span&gt; &lt;span class="na"&gt;viewBox&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"0 0 400 180"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;line&lt;/span&gt;
        &lt;span class="na"&gt;x1&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"40"&lt;/span&gt;
        &lt;span class="na"&gt;y1&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"150"&lt;/span&gt;
        &lt;span class="na"&gt;x2&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"380"&lt;/span&gt;
        &lt;span class="na"&gt;y2&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"150"&lt;/span&gt;
        &lt;span class="na"&gt;stroke&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"currentColor"&lt;/span&gt;
    &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;line&lt;/span&gt;
        &lt;span class="na"&gt;x1&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"40"&lt;/span&gt;
        &lt;span class="na"&gt;y1&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"20"&lt;/span&gt;
        &lt;span class="na"&gt;x2&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"40"&lt;/span&gt;
        &lt;span class="na"&gt;y2&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"150"&lt;/span&gt;
        &lt;span class="na"&gt;stroke&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"currentColor"&lt;/span&gt;
    &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;polyline&lt;/span&gt;
        &lt;span class="na"&gt;points&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"40,120 120,90 200,105 280,60 380,45"&lt;/span&gt;
        &lt;span class="na"&gt;fill&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"none"&lt;/span&gt;
        &lt;span class="na"&gt;stroke&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"#2563eb"&lt;/span&gt;
        &lt;span class="na"&gt;stroke-width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"2"&lt;/span&gt;
    &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/svg&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example illustrates the native SVG mechanism, not the exact chart markup used by the radars.&lt;/p&gt;

&lt;p&gt;The browser renders the graphical elements directly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Converting Data Into Coordinates
&lt;/h3&gt;

&lt;p&gt;A time-series chart requires mapping numerical values into SVG coordinates.&lt;/p&gt;

&lt;p&gt;For a chart with a defined minimum, maximum, and drawing height, the vertical coordinate can be calculated as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;scaleY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;min&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;top&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="n"&gt;min&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;top&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;top&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt;
        &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;min&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;min&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The subtraction is necessary because SVG coordinates increase downward.&lt;/p&gt;

&lt;p&gt;A corresponding horizontal calculation can map observation indexes or timestamps into the available drawing width.&lt;/p&gt;

&lt;p&gt;The exact horizontal scale depends on whether the chart represents evenly spaced periods or irregular observation times.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hover Zones and Tooltips
&lt;/h3&gt;

&lt;p&gt;The dashboards also use interactive hover behavior to expose additional information without permanently displaying every value.&lt;/p&gt;

&lt;p&gt;A conceptual interaction is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Pointer movement
       │
       ▼
Determine nearest observation
       │
       ▼
Update crosshair
       │
       ▼
Display date and metric values
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The interaction can be implemented using JavaScript event listeners and SVG elements.&lt;/p&gt;

&lt;p&gt;This allows the chart to remain visually compact while providing detailed information when the user inspects a particular point.&lt;/p&gt;




&lt;h2&gt;
  
  
  18. Period Selection and Missing Data
&lt;/h2&gt;

&lt;p&gt;Historical interfaces must balance readability with data completeness.&lt;/p&gt;

&lt;p&gt;Displaying every observation across several years can produce unnecessary rendering complexity.&lt;/p&gt;

&lt;p&gt;Conversely, reducing every dataset to yearly averages may hide meaningful short-term changes.&lt;/p&gt;

&lt;p&gt;The radars use period controls and dataset-specific aggregation to manage this trade-off.&lt;/p&gt;

&lt;p&gt;A conceptual request could be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Selected period: 90 days
         │
         ▼
Retrieve relevant historical data
         │
         ▼
Prepare appropriate time resolution
         │
         ▼
Render updated chart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The underlying storage does not need to change when the display period changes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Missing Values
&lt;/h3&gt;

&lt;p&gt;Missing data requires particular care in time-series visualization.&lt;/p&gt;

&lt;p&gt;Consider:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;values&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="mf"&gt;72.4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="mf"&gt;72.1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="mf"&gt;71.8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="mf"&gt;71.5&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;null&lt;/code&gt; value represents an unavailable observation.&lt;/p&gt;

&lt;p&gt;Replacing it with zero would introduce an artificial collapse in the series.&lt;/p&gt;

&lt;p&gt;Connecting the surrounding points without indicating the gap could also suggest that measurements existed during the missing interval.&lt;/p&gt;

&lt;p&gt;Depending on the chart, the interface can leave a visible gap or otherwise distinguish unavailable observations from measured values.&lt;/p&gt;

&lt;p&gt;The appropriate behavior depends on the meaning of the dataset.&lt;/p&gt;




&lt;h2&gt;
  
  
  19. Bilingual Interfaces With Shared Data
&lt;/h2&gt;

&lt;p&gt;The monitoring ecosystem provides French and English interfaces.&lt;/p&gt;

&lt;p&gt;The underlying data does not need to be collected separately for each language.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Public sources
      │
      ▼
Shared collection and storage
      │
      ├── French interface
      │
      └── English interface
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The localized interfaces can use the same numerical observations, timestamps, incident records, and historical series.&lt;/p&gt;

&lt;p&gt;Only the presentation needs to change.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;French label&lt;/th&gt;
&lt;th&gt;English label&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Remplissage&lt;/td&gt;
&lt;td&gt;Storage level&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Consommation&lt;/td&gt;
&lt;td&gt;Consumption&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Vulnérabilités&lt;/td&gt;
&lt;td&gt;Vulnerabilities&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dernière observation&lt;/td&gt;
&lt;td&gt;Latest observation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Données disponibles&lt;/td&gt;
&lt;td&gt;Available data&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;JavaScript can also format numerical values according to the interface language.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;72.4&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;french&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Intl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;NumberFormat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"fr-FR"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;maximumFractionDigits&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;english&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Intl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;NumberFormat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"en-US"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;maximumFractionDigits&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same stored value produces different textual representations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;French  → 72,4
English → 72.4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Localization should not change the underlying measurement.&lt;/p&gt;

&lt;p&gt;Keeping the data independent of the presentation language avoids duplicated collection processes and helps maintain consistency between the two interfaces.&lt;/p&gt;




&lt;h2&gt;
  
  
  20. Internal Usage Analytics
&lt;/h2&gt;

&lt;p&gt;The monitoring ecosystem also includes a small internal analytics system.&lt;/p&gt;

&lt;p&gt;Its purpose is to understand how the public resources are being used without introducing a third-party analytics platform.&lt;/p&gt;

&lt;p&gt;The architecture follows a separate processing pipeline:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Public radar visits
         │
         ▼
Minimal visit logs
         │
         ▼
Analytics collector
         │
         ├── Known bot filtering
         ├── Page view calculation
         └── Unique visitor estimation
         │
         ▼
Daily SQLite statistics
         │
         ▼
Private analytics dashboard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The usage analytics system is separate from the public monitoring datasets.&lt;/p&gt;

&lt;p&gt;It records information about resource usage rather than electricity, fuel, vulnerabilities, maritime traffic, or infrastructure conditions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Interpreting Visitor Metrics
&lt;/h3&gt;

&lt;p&gt;Page views and unique visitors describe different measurements.&lt;/p&gt;

&lt;p&gt;A single visitor may open several radars or return to the same resource multiple times.&lt;/p&gt;

&lt;p&gt;Bot filtering also has limitations. A system can exclude known automated traffic without guaranteeing that every remaining request represents a human visitor.&lt;/p&gt;

&lt;p&gt;Similarly, unique visitor counts depend on the identification and aggregation method used by the analytics system.&lt;/p&gt;

&lt;p&gt;The objective is therefore to provide useful internal usage indicators rather than claim perfectly accurate identification of every visitor.&lt;/p&gt;




&lt;h2&gt;
  
  
  21. Reliability and Failure Isolation
&lt;/h2&gt;

&lt;p&gt;A public monitoring system depends on external sources that may occasionally become unavailable.&lt;/p&gt;

&lt;p&gt;Possible failures include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Network timeouts&lt;/li&gt;
&lt;li&gt;API rate limits&lt;/li&gt;
&lt;li&gt;Unexpected response formats&lt;/li&gt;
&lt;li&gt;Missing observations&lt;/li&gt;
&lt;li&gt;Incomplete historical retrieval&lt;/li&gt;
&lt;li&gt;Changes to source schemas&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A collection failure should not necessarily make the public interface unavailable.&lt;/p&gt;

&lt;p&gt;Separating collection from rendering makes it possible to retain previously collected information while investigating the failure.&lt;/p&gt;

&lt;p&gt;A conceptual failure-handling workflow is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Collection attempt
        │
        ├── Success
        │      └── Store valid observations
        │
        └── Failure
               ├── Record collection error
               ├── Preserve existing data
               └── Retry on a later execution
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The interface must still communicate the freshness of the information.&lt;/p&gt;

&lt;p&gt;Displaying an old measurement without its observation date can create the impression that it represents the current situation.&lt;/p&gt;

&lt;p&gt;This is particularly important for infrastructure monitoring, where the status of an incident can change rapidly.&lt;/p&gt;

&lt;p&gt;The latest available observation and the latest successful collection are related but distinct indicators.&lt;/p&gt;




&lt;h2&gt;
  
  
  22. Storage Growth and Database Maintenance
&lt;/h2&gt;

&lt;p&gt;A long-running monitoring system accumulates information continuously.&lt;/p&gt;

&lt;p&gt;Even with effective deduplication, historical datasets can grow as new observations and events are collected.&lt;/p&gt;

&lt;p&gt;The storage architecture must therefore account for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The frequency of new measurements&lt;/li&gt;
&lt;li&gt;The number of monitored sources&lt;/li&gt;
&lt;li&gt;The size of retained event payloads&lt;/li&gt;
&lt;li&gt;Historical retention requirements&lt;/li&gt;
&lt;li&gt;Index maintenance&lt;/li&gt;
&lt;li&gt;Database file growth&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;SQLite provides tools for inspecting database size and reclaiming unused storage.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="no"&gt;PRAGMA&lt;/span&gt; &lt;span class="n"&gt;page_count&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;PRAGMA&lt;/span&gt; &lt;span class="n"&gt;page_size&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;PRAGMA&lt;/span&gt; &lt;span class="n"&gt;freelist_count&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These values provide information about the database's allocated pages and unused space.&lt;/p&gt;

&lt;p&gt;SQLite also provides:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;VACUUM&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This operation rebuilds the database and can reclaim unused space.&lt;/p&gt;

&lt;p&gt;However, &lt;code&gt;VACUUM&lt;/code&gt; does not replace deduplication, remove unnecessary historical records, or establish a retention policy.&lt;/p&gt;

&lt;p&gt;It also requires appropriate operational planning because it rebuilds the database and may need additional temporary disk space.&lt;/p&gt;

&lt;p&gt;The distinction between storage maintenance and data deletion is important for monitoring systems.&lt;/p&gt;

&lt;p&gt;Historical records may be essential to understanding long-term changes. Removing them simply to reduce database size could eliminate the analytical value of the system.&lt;/p&gt;




&lt;h2&gt;
  
  
  23. Security Boundaries in a Public Monitoring Architecture
&lt;/h2&gt;

&lt;p&gt;A public dashboard does not need to expose its collectors, configuration files, or database files directly.&lt;/p&gt;

&lt;p&gt;A conceptual separation is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Private processing environment
    ├── Collector scripts
    ├── Source configuration
    ├── API credentials
    ├── SQLite databases
    └── Technical logs

Public web interface
    ├── Prepared indicators
    ├── Historical series
    ├── Charts
    └── Public data exports
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This diagram illustrates the intended architectural separation rather than exposing the production server structure.&lt;/p&gt;

&lt;p&gt;The public interface should receive only the information required for its presentation.&lt;/p&gt;

&lt;p&gt;External API credentials, internal logs, and private configuration remain outside that responsibility.&lt;/p&gt;

&lt;p&gt;Imported data must also be treated as untrusted input.&lt;/p&gt;

&lt;p&gt;A provider-supplied incident title, for example, is text that should be displayed safely rather than interpreted as HTML.&lt;/p&gt;

&lt;p&gt;In PHP, a general output-escaping example is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="nf"&gt;htmlspecialchars&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nv"&gt;$incidentTitle&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="no"&gt;ENT_QUOTES&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="no"&gt;ENT_SUBSTITUTE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'UTF-8'&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example illustrates a standard output-escaping practice.&lt;/p&gt;

&lt;p&gt;Similarly, SQL queries should use bound parameters when incorporating external or user-controlled values.&lt;/p&gt;

&lt;p&gt;These are general security considerations for public monitoring applications, not a reproduction of every security mechanism used by the ecosystem.&lt;/p&gt;




&lt;h2&gt;
  
  
  24. What the Architecture Does Not Establish
&lt;/h2&gt;

&lt;p&gt;A monitoring interface provides a representation of available data.&lt;/p&gt;

&lt;p&gt;It does not automatically establish the cause of every observed change.&lt;/p&gt;

&lt;p&gt;Several distinctions remain essential:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Observation&lt;/th&gt;
&lt;th&gt;Does not automatically establish&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Increasing fuel unavailability&lt;/td&gt;
&lt;td&gt;A nationwide fuel shortage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Falling gas storage&lt;/td&gt;
&lt;td&gt;An imminent energy supply failure&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;More KEV additions&lt;/td&gt;
&lt;td&gt;A corresponding increase in attacks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;More IODA signals&lt;/td&gt;
&lt;td&gt;The same number of distinct outages&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lower recorded maritime flow&lt;/td&gt;
&lt;td&gt;A confirmed physical traffic blockage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Missing DNS measurements&lt;/td&gt;
&lt;td&gt;A confirmed DNS service failure&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The same principle applies to historical comparisons.&lt;/p&gt;

&lt;p&gt;A rise in collected observations may reflect a real change, improved collection coverage, a source update, or a combination of these factors.&lt;/p&gt;

&lt;p&gt;The purpose of the monitoring architecture is to make the information available, structured, and comparable while preserving these limitations.&lt;/p&gt;

&lt;p&gt;A useful dashboard identifies what has changed. Establishing why it changed may require additional evidence.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Building a public data monitoring ecosystem involves substantially more than displaying charts.&lt;/p&gt;

&lt;p&gt;The architecture must retrieve heterogeneous information, validate source responses, normalize records, prevent duplicate observations, preserve historical context, and select appropriate aggregation methods.&lt;/p&gt;

&lt;p&gt;SQLite provides a compact storage layer for both numerical measurements and event-oriented datasets.&lt;/p&gt;

&lt;p&gt;PHP, JavaScript, and native SVG provide the processing and visualization layers without requiring a large application framework.&lt;/p&gt;

&lt;p&gt;The five monitoring domains demonstrate why a common architectural principle does not require identical data models or analytical rules.&lt;/p&gt;

&lt;p&gt;Energy measurements, fuel availability, cybersecurity indicators, maritime observations, and digital infrastructure signals each have their own meaning and limitations.&lt;/p&gt;

&lt;p&gt;The most important design decision is to preserve those distinctions throughout the pipeline.&lt;/p&gt;

&lt;p&gt;A monitoring dashboard becomes useful when it can transform changing public information into readable historical context without presenting incomplete observations as established conclusions.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://palks-studio.com" rel="noopener noreferrer"&gt;https://palks-studio.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>data</category>
      <category>php</category>
      <category>webdev</category>
    </item>
    <item>
      <title>🔗 Interoperability Between Electronic Invoicing, Digital Identity, and Payment Systems: A Data Architecture Perspective</title>
      <dc:creator>Anthony Leignel</dc:creator>
      <pubDate>Fri, 04 Sep 2026 15:12:27 +0000</pubDate>
      <link>https://dev.to/palks_studio/what-happens-when-electronic-invoicing-digital-identity-and-payments-become-interconnected-h5j</link>
      <guid>https://dev.to/palks_studio/what-happens-when-electronic-invoicing-digital-identity-and-payments-become-interconnected-h5j</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0pkn0zum7jgkv62ib8jx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0pkn0zum7jgkv62ib8jx.png" alt="Data architecture illustration connecting electronic invoicing, product information, digital identity, environmental data, and payment infrastructures." width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Electronic invoicing is usually presented as an accounting and tax reform. From a technical perspective, however, it also represents a transition toward structured, standardized transaction data.&lt;/p&gt;

&lt;p&gt;At the same time, other European digital infrastructures are developing around product identification, environmental information, electronic credentials, and payments.&lt;/p&gt;

&lt;p&gt;Each infrastructure has its own purpose, architecture, legal framework, and implementation timeline.&lt;/p&gt;

&lt;p&gt;The technical question is how these systems can exchange information, what interfaces already exist or are being developed, and where the documented evidence stops.&lt;/p&gt;

&lt;p&gt;This article examines these infrastructures from a data architecture perspective, distinguishing documented interoperability from technically possible but unestablished integrations.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Electronic Invoicing as Structured Transaction Data
&lt;/h2&gt;

&lt;p&gt;A conventional invoice is primarily a document intended to communicate commercial and accounting information.&lt;/p&gt;

&lt;p&gt;An electronic invoice adds another dimension: its contents can be represented as structured data that software can process.&lt;/p&gt;

&lt;p&gt;Depending on the applicable standard and document structure, this information can include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Supplier and customer identifiers&lt;/li&gt;
&lt;li&gt;Invoice references and dates&lt;/li&gt;
&lt;li&gt;Product or service descriptions&lt;/li&gt;
&lt;li&gt;Quantities and unit prices&lt;/li&gt;
&lt;li&gt;Tax information&lt;/li&gt;
&lt;li&gt;Payment amounts and terms&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The distinction between visual presentation and structured information is particularly important.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Invoice
   │
   ├── Human-readable representation
   │       └── PDF document
   │
   └── Machine-readable representation
           └── Structured invoice data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A structured invoice does not necessarily require a separate PDF. Some electronic invoicing formats use structured XML, while hybrid formats combine a human-readable document with embedded structured data.&lt;/p&gt;

&lt;p&gt;The central architectural change is that invoice information becomes directly accessible to software without requiring manual transcription or interpretation of a visual document.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. From Documents to Interoperable Data
&lt;/h2&gt;

&lt;p&gt;Once information is structured, it can be processed by different systems.&lt;/p&gt;

&lt;p&gt;Consider a simplified transaction record:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"invoice_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"INV-2026-001"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"seller_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"SELLER-001"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"buyer_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"BUYER-001"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"items"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nl"&gt;"product_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"PRODUCT-042"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;"quantity"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;"unit_price"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;100.00&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"currency"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"EUR"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"total"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;200.00&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is an illustrative JSON representation, not an official electronic invoicing format.&lt;/p&gt;

&lt;p&gt;The important element is that each value has an identifiable role.&lt;/p&gt;

&lt;p&gt;A software system can distinguish an invoice identifier from a product identifier, a quantity from a price, or a buyer identifier from a seller identifier.&lt;/p&gt;

&lt;p&gt;Structured data makes automated processing possible, but interoperability requires more than the ability to read a file.&lt;/p&gt;

&lt;p&gt;Several conditions must be met:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Requirement&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Shared identifiers&lt;/td&gt;
&lt;td&gt;Identify corresponding entities&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Compatible formats&lt;/td&gt;
&lt;td&gt;Exchange information between systems&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Semantic consistency&lt;/td&gt;
&lt;td&gt;Preserve the meaning of data fields&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Accessible interfaces&lt;/td&gt;
&lt;td&gt;Enable authorized data exchange&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Access rules&lt;/td&gt;
&lt;td&gt;Define who can retrieve information&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two systems may both use XML or JSON without being interoperable.&lt;/p&gt;

&lt;p&gt;They must also agree on the meaning of the exchanged information, the identifiers used to reference entities, and the conditions under which access is permitted.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Product Identification and Digital Product Passports
&lt;/h2&gt;

&lt;p&gt;Electronic invoicing is not the only infrastructure developing around structured commercial information.&lt;/p&gt;

&lt;p&gt;Digital Product Passports introduce a separate approach to organizing information associated with products.&lt;/p&gt;

&lt;p&gt;Depending on the product category and applicable requirements, a passport may provide information relating to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Product identification&lt;/li&gt;
&lt;li&gt;Materials and composition&lt;/li&gt;
&lt;li&gt;Repairability or durability&lt;/li&gt;
&lt;li&gt;Environmental characteristics&lt;/li&gt;
&lt;li&gt;Other product-specific information&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The connection with electronic invoicing can be examined through product identification.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Electronic invoice
        │
        ▼
Transaction data
        │
        ▼
Product identification
        │
        ▼
Digital Product Passport
        │
        ▼
Product characteristics
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This diagram represents a potential data relationship, not a universally deployed processing pipeline.&lt;/p&gt;

&lt;p&gt;An invoice may contain an identifier associated with a product. A product passport may contain information associated with that same product.&lt;/p&gt;

&lt;p&gt;If the identifiers can be resolved across the two systems, a relationship between transaction information and product information becomes technically possible.&lt;/p&gt;

&lt;p&gt;However, an invoice containing a product description does not automatically establish a connection with a Digital Product Passport.&lt;/p&gt;

&lt;p&gt;The identifier, its scope, and the mechanism used to resolve it all matter.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Shared Identifiers as an Architectural Bridge
&lt;/h2&gt;

&lt;p&gt;A common identifier can provide a connection between otherwise independent datasets.&lt;/p&gt;

&lt;p&gt;Consider two simplified records.&lt;/p&gt;

&lt;p&gt;Transaction data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"transaction_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"TX-001"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"product_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"PRODUCT-042"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"quantity"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Product data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"product_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"PRODUCT-042"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"category"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Example product category"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"environmental_information"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"reference"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"ENV-042"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both records contain the same product identifier.&lt;/p&gt;

&lt;p&gt;A conceptual relationship can therefore be represented as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Transaction record
        │
        │ product_id
        ▼
Product record
        │
        ▼
Environmental information
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In software architecture, this resembles a relationship between records that can be resolved through a shared key.&lt;/p&gt;

&lt;p&gt;However, several practical questions remain.&lt;/p&gt;

&lt;p&gt;Does the invoice use the same identifier as the passport?&lt;/p&gt;

&lt;p&gt;Does the identifier refer to a product model, a batch, or an individual item?&lt;/p&gt;

&lt;p&gt;Can the corresponding product information be retrieved?&lt;/p&gt;

&lt;p&gt;Which fields are accessible, and under what conditions?&lt;/p&gt;

&lt;p&gt;These questions determine whether a theoretical relationship can become an operational integration.&lt;/p&gt;

&lt;p&gt;The example illustrates the architectural principle of identifier-based interoperability. It does not establish that a specific European invoicing system currently performs this lookup.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Environmental Data and Transaction Context
&lt;/h2&gt;

&lt;p&gt;Product information and transaction information describe different entities.&lt;/p&gt;

&lt;p&gt;A product passport may describe the characteristics of a product.&lt;/p&gt;

&lt;p&gt;An invoice describes a commercial transaction involving one or more products or services.&lt;/p&gt;

&lt;p&gt;Connecting these datasets could provide additional context about the items involved in a transaction.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Transaction
    ├── Product identifier
    ├── Quantity
    └── Commercial information

Product passport
    ├── Product identifier
    ├── Product characteristics
    └── Environmental information
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the identifiers and interfaces are compatible, the two records could potentially be associated.&lt;/p&gt;

&lt;p&gt;That association would not automatically produce an environmental assessment of the buyer.&lt;/p&gt;

&lt;p&gt;Additional processing would be required to establish such an assessment, including rules for aggregation, attribution, and interpretation.&lt;/p&gt;

&lt;p&gt;The distinction is important:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Data category&lt;/th&gt;
&lt;th&gt;What it describes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Transaction data&lt;/td&gt;
&lt;td&gt;A commercial transaction&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Product data&lt;/td&gt;
&lt;td&gt;An identified product&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Environmental data&lt;/td&gt;
&lt;td&gt;Characteristics or impacts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Individual profile&lt;/td&gt;
&lt;td&gt;Information attributed to a person&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Moving from product characteristics to an individual profile is a separate processing operation.&lt;/p&gt;

&lt;p&gt;It cannot be inferred simply from the existence of structured invoices or Digital Product Passports.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Digital Identity and Electronic Credentials
&lt;/h2&gt;

&lt;p&gt;European digital identity infrastructure introduces another category of structured information.&lt;/p&gt;

&lt;p&gt;Digital wallets can carry electronic credentials that allow information or attributes to be presented and verified.&lt;/p&gt;

&lt;p&gt;From an architectural perspective, a credential exchange involves several distinct roles.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Credential issuer
        │
        ▼
Electronic credential
        │
        ▼
Digital wallet
        │
        ▼
Credential presentation
        │
        ▼
Verification
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An electronic credential may represent an identity attribute, a qualification, an authorization, or another verifiable statement.&lt;/p&gt;

&lt;p&gt;The wallet provides a mechanism for managing and presenting credentials.&lt;/p&gt;

&lt;p&gt;The verification process determines whether the presented information satisfies the requirements of a particular interaction.&lt;/p&gt;

&lt;p&gt;This does not mean that every digital wallet contains a complete personal profile or that every interaction exposes all available identity information.&lt;/p&gt;

&lt;p&gt;The data exchanged depends on the credential, the protocol, the requested attributes, and the applicable access rules.&lt;/p&gt;

&lt;h3&gt;
  
  
  Identity Is Not the Same as Authorization
&lt;/h3&gt;

&lt;p&gt;An identity attribute may establish who a person is.&lt;/p&gt;

&lt;p&gt;An authorization may establish whether a person is permitted to perform a specific action.&lt;/p&gt;

&lt;p&gt;These are different operations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Identity verification
        │
        ▼
Attribute verification
        │
        ▼
Authorization decision
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A system capable of verifying an electronic credential does not automatically have the authority to impose a restriction on a financial transaction.&lt;/p&gt;

&lt;p&gt;That requires a separate authorization mechanism and an applicable legal basis.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Payment Systems and External Conditions
&lt;/h2&gt;

&lt;p&gt;Payment infrastructure represents another layer in the broader architecture.&lt;/p&gt;

&lt;p&gt;A payment system processes the transfer of value between parties.&lt;/p&gt;

&lt;p&gt;A conditional payment introduces a relationship between the execution of a payment and a predefined condition.&lt;/p&gt;

&lt;p&gt;A simplified example is a payment executed after a delivery has been confirmed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Delivery confirmation
          │
          ▼
Condition evaluation
          │
          ▼
Payment execution
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The condition exists outside the monetary value itself.&lt;/p&gt;

&lt;p&gt;An external system may provide information indicating whether the condition has been satisfied.&lt;/p&gt;

&lt;p&gt;The payment can then be executed according to the applicable arrangement.&lt;/p&gt;

&lt;p&gt;A conceptual representation might look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"payment_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"PAY-001"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"amount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;200.00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"currency"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"EUR"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"condition"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"delivery_confirmation"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"pending"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example illustrates conditional payment logic. It is not an official digital euro message format or a documented implementation of a particular payment platform.&lt;/p&gt;

&lt;p&gt;The important architectural distinction is between the payment instruction, the condition evaluation mechanism, and the monetary instrument used to execute the payment.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. Conditional Payments vs. Programmable Money
&lt;/h2&gt;

&lt;p&gt;The digital euro is relevant to this discussion because European documentation explicitly distinguishes conditional payments from programmable money.&lt;/p&gt;

&lt;p&gt;These concepts should not be treated as equivalent.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Concept&lt;/th&gt;
&lt;th&gt;Architectural distinction&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Conditional payment&lt;/td&gt;
&lt;td&gt;Execution depends on defined conditions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Programmable money&lt;/td&gt;
&lt;td&gt;Restrictions are attached to the money&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;External service&lt;/td&gt;
&lt;td&gt;Provides information or triggers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Payment execution&lt;/td&gt;
&lt;td&gt;Transfers monetary value&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A conditional payment can be linked to an event or contractual condition without changing the general usability of the currency.&lt;/p&gt;

&lt;p&gt;Programmable money, by contrast, would involve restrictions attached to monetary units themselves, potentially limiting how or where they can be used.&lt;/p&gt;

&lt;p&gt;The proposed digital euro framework distinguishes between these concepts and excludes programmable money.&lt;/p&gt;

&lt;p&gt;That distinction must remain visible when examining technical interoperability between payment systems and external services.&lt;/p&gt;

&lt;p&gt;The existence of conditional payment functionality does not establish that public authorities can impose arbitrary spending restrictions.&lt;/p&gt;

&lt;p&gt;Technical capability, contractual authorization, and legal authority remain separate questions.&lt;/p&gt;




&lt;h2&gt;
  
  
  9. Interfaces Between Independent Infrastructures
&lt;/h2&gt;

&lt;p&gt;The infrastructures examined so far can be represented as separate domains.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Transaction domain
    └── Electronic invoicing

Product domain
    └── Digital Product Passports

Identity domain
    └── Digital wallets and credentials

Payment domain
    └── Payment instructions and execution
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each domain can have its own data models, interfaces, access rules, and operational responsibilities.&lt;/p&gt;

&lt;p&gt;Interoperability becomes possible when a relationship can be established between information in different domains.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Transaction
    │
    ├── Product identifier
    │       └── Product information
    │
    ├── Party identifier
    │       └── Identity-related information
    │
    └── Payment reference
            └── Payment information
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a conceptual architecture showing possible relationships between data categories.&lt;/p&gt;

&lt;p&gt;It is not a representation of an existing centralized European platform.&lt;/p&gt;

&lt;p&gt;The investigation underlying this article identifies technical bridges that are documented, standardized, planned, or have been examined through experiments.&lt;/p&gt;

&lt;p&gt;These categories are not interchangeable.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Evidence category&lt;/th&gt;
&lt;th&gt;What it establishes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Documented&lt;/td&gt;
&lt;td&gt;A connection is described&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Standardized&lt;/td&gt;
&lt;td&gt;An interface or format is specified&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Planned&lt;/td&gt;
&lt;td&gt;An implementation is intended&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Experimented&lt;/td&gt;
&lt;td&gt;A capability has been tested&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Operational&lt;/td&gt;
&lt;td&gt;A connection is deployed and in use&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A standardized interface does not prove that every relevant system implements it.&lt;/p&gt;

&lt;p&gt;An experiment does not prove widespread deployment.&lt;/p&gt;

&lt;p&gt;A planned integration does not establish current operational use.&lt;/p&gt;

&lt;p&gt;The maturity of each connection must therefore be evaluated independently.&lt;/p&gt;




&lt;h2&gt;
  
  
  10. Interoperability Does Not Require a Centralized Database
&lt;/h2&gt;

&lt;p&gt;One architectural misconception is that interconnected infrastructures necessarily require a single database containing all available information.&lt;/p&gt;

&lt;p&gt;Different systems can remain independently operated while exchanging selected information through interfaces.&lt;/p&gt;

&lt;p&gt;A conceptual distributed architecture could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Invoice system
      │
      ├── Authorized product lookup
      │           └── Product system
      │
      ├── Authorized credential check
      │           └── Identity system
      │
      └── Payment instruction
                  └── Payment system
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The original records can remain within their respective systems.&lt;/p&gt;

&lt;p&gt;Only the information required for a specific operation may need to be exchanged.&lt;/p&gt;

&lt;p&gt;However, distributed storage does not automatically eliminate privacy risks.&lt;/p&gt;

&lt;p&gt;If a system can repeatedly retrieve and correlate information from multiple sources, it may still create a detailed representation of transactions or entities.&lt;/p&gt;

&lt;p&gt;The relevant questions therefore include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which identifiers are shared across systems?&lt;/li&gt;
&lt;li&gt;Which information can be retrieved?&lt;/li&gt;
&lt;li&gt;Who is authorized to retrieve it?&lt;/li&gt;
&lt;li&gt;Can information be retained or combined?&lt;/li&gt;
&lt;li&gt;Are exchanges limited to a specific purpose?&lt;/li&gt;
&lt;li&gt;Can access be audited or revoked?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are architectural and governance questions rather than evidence that a particular centralized system already exists.&lt;/p&gt;




&lt;h2&gt;
  
  
  11. Separating Technical Capability From Operational Use
&lt;/h2&gt;

&lt;p&gt;A documented interface establishes that certain information can be exchanged under defined conditions.&lt;/p&gt;

&lt;p&gt;It does not establish every possible use of that information.&lt;/p&gt;

&lt;p&gt;Consider the following conceptual sequence:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Structured transaction data
          │
          ▼
Product identification
          │
          ▼
Environmental information
          │
          ▼
Individual profile
          │
          ▼
Imposed rule
          │
          ▼
Economic restriction
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first part of the sequence concerns relationships between transaction data, product identifiers, and product information.&lt;/p&gt;

&lt;p&gt;The later stages introduce additional operations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Attributing transaction information to an individual&lt;/li&gt;
&lt;li&gt;Creating and maintaining an individual profile&lt;/li&gt;
&lt;li&gt;Defining a rule based on that profile&lt;/li&gt;
&lt;li&gt;Applying the rule to an economic or monetary decision&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each operation would require its own technical implementation, data access arrangements, and legal authorization.&lt;/p&gt;

&lt;p&gt;The investigation does not establish the existence of this complete operational chain.&lt;/p&gt;

&lt;p&gt;In particular, it does not establish that an environmental score is currently used to restrict individual payments, that a centralized consumption-control system exists, or that the infrastructures were designed for a single coordinated purpose.&lt;/p&gt;

&lt;p&gt;This boundary is essential.&lt;/p&gt;

&lt;p&gt;A technically possible integration should not be presented as an existing system.&lt;/p&gt;




&lt;h2&gt;
  
  
  12. An Evidence-Based Method for Architecture Analysis
&lt;/h2&gt;

&lt;p&gt;Studying interconnected infrastructures requires a method that distinguishes what documentation establishes from what can only be inferred.&lt;/p&gt;

&lt;p&gt;The investigation uses four levels of evidence.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Evidence level&lt;/th&gt;
&lt;th&gt;Interpretation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Established&lt;/td&gt;
&lt;td&gt;Supported by documented evidence&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Technically deducible&lt;/td&gt;
&lt;td&gt;Follows from documented capabilities&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hypothesis&lt;/td&gt;
&lt;td&gt;A possible but unconfirmed scenario&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;To be established&lt;/td&gt;
&lt;td&gt;Requires additional supporting evidence&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These levels can be applied to individual interfaces, data relationships, or proposed processing chains.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Documented interface
          │
          ▼
Established capability
          │
          ▼
Potential integration
          │
          ▼
Technically deducible
          │
          ▼
Specific operational use
          │
          ▼
Requires separate evidence
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A technically deducible capability may be useful for evaluating architectural risks or future integration scenarios.&lt;/p&gt;

&lt;p&gt;However, it does not carry the same evidentiary weight as a documented operational deployment.&lt;/p&gt;

&lt;p&gt;The methodology prevents the analysis from moving directly from the existence of an interface to conclusions about how institutions or organizations are using it.&lt;/p&gt;




&lt;h2&gt;
  
  
  13. Security and Privacy Across System Boundaries
&lt;/h2&gt;

&lt;p&gt;Interoperability creates additional security considerations because information may move between systems with different trust boundaries.&lt;/p&gt;

&lt;p&gt;An architecture that exchanges transaction, product, identity, or payment information must address several questions.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Security consideration&lt;/th&gt;
&lt;th&gt;Architectural objective&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Authentication&lt;/td&gt;
&lt;td&gt;Verify the requesting entity&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Authorization&lt;/td&gt;
&lt;td&gt;Restrict access to permitted operations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data minimization&lt;/td&gt;
&lt;td&gt;Exchange only necessary information&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Purpose limitation&lt;/td&gt;
&lt;td&gt;Restrict processing to defined purposes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Auditability&lt;/td&gt;
&lt;td&gt;Record relevant access and exchanges&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data integrity&lt;/td&gt;
&lt;td&gt;Preserve the accuracy of exchanged data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Retention controls&lt;/td&gt;
&lt;td&gt;Limit unnecessary data storage&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These are general architectural requirements, not claims that every infrastructure discussed implements identical controls.&lt;/p&gt;

&lt;p&gt;For example, verifying a credential does not necessarily require access to all identity information.&lt;/p&gt;

&lt;p&gt;Retrieving product characteristics does not necessarily require access to the identity of the purchaser.&lt;/p&gt;

&lt;p&gt;Executing a payment does not necessarily require disclosure of every product included in an invoice.&lt;/p&gt;

&lt;p&gt;The design of the interfaces determines how much information must cross each boundary.&lt;/p&gt;

&lt;p&gt;A useful security principle is to separate the information required for an operation from information that is merely available elsewhere in the architecture.&lt;/p&gt;




&lt;h2&gt;
  
  
  14. What an Interoperability Assessment Should Examine
&lt;/h2&gt;

&lt;p&gt;Evaluating the relationship between these infrastructures requires more than listing the projects involved.&lt;/p&gt;

&lt;p&gt;A technical assessment should examine the actual connections.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;System A
    │
    ├── Data model
    ├── Identifiers
    ├── Access permissions
    └── Interface
            │
            ▼
System B
    │
    ├── Received information
    ├── Processing purpose
    ├── Retention rules
    └── Possible downstream exchanges
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For each connection, the analysis should establish:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Whether the interface is documented&lt;/li&gt;
&lt;li&gt;Whether compatible identifiers exist&lt;/li&gt;
&lt;li&gt;Whether the exchange is technically supported&lt;/li&gt;
&lt;li&gt;Whether it has been tested or deployed&lt;/li&gt;
&lt;li&gt;Which parties can initiate the exchange&lt;/li&gt;
&lt;li&gt;Which data can be accessed or retained&lt;/li&gt;
&lt;li&gt;Which legal framework governs its use&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This approach makes it possible to examine interoperability without assuming that every technically conceivable connection is operational.&lt;/p&gt;

&lt;p&gt;It also avoids the opposite mistake of treating independently developed systems as necessarily isolated.&lt;/p&gt;

&lt;p&gt;The relevant unit of analysis is the documented relationship between systems, including its technical capabilities and its constraints.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Electronic invoicing, Digital Product Passports, digital identity infrastructure, and payment systems represent distinct domains of digital architecture.&lt;/p&gt;

&lt;p&gt;Their development introduces structured data, standardized formats, identifiers, credentials, and interfaces that can support information exchange.&lt;/p&gt;

&lt;p&gt;Several technical bridges between these domains are documented, standardized, planned, or have been examined through experiments. Their maturity and operational scope must be assessed individually.&lt;/p&gt;

&lt;p&gt;The existence of these bridges does not establish a unified infrastructure controlling individual consumption or payments.&lt;/p&gt;

&lt;p&gt;Nor does the independence of the projects establish that information cannot move between them.&lt;/p&gt;

&lt;p&gt;The central architectural question is how interoperability changes the relationships between data, systems, and authorized operations.&lt;/p&gt;

&lt;p&gt;Answering that question requires a clear distinction between documented capabilities, technical deductions, hypothetical integrations, operational deployment, and legal authorization.&lt;/p&gt;




&lt;h2&gt;
  
  
  Research Documentation
&lt;/h2&gt;

&lt;p&gt;The complete investigation, its seven chapters, evidence classification methodology, and source register are available in the public documentation repository.&lt;/p&gt;

&lt;p&gt;The documentation provides the underlying material for examining the individual infrastructures and their documented technical relationships.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Palks-Studio/facturation-electronique-enquete" rel="noopener noreferrer"&gt;View the investigation and source register on GitHub&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;a href="https://palks-studio.com" rel="noopener noreferrer"&gt;https://palks-studio.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>security</category>
      <category>privacy</category>
      <category>data</category>
    </item>
    <item>
      <title>📊 Client-Side SEO Data Analysis in JavaScript: Processing Google Search Console ZIP Exports</title>
      <dc:creator>Anthony Leignel</dc:creator>
      <pubDate>Wed, 02 Sep 2026 00:44:12 +0000</pubDate>
      <link>https://dev.to/palks_studio/turning-google-search-console-exports-into-actionable-seo-data-44</link>
      <guid>https://dev.to/palks_studio/turning-google-search-console-exports-into-actionable-seo-data-44</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1rwtiev0t9hyzj2y1d24.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1rwtiev0t9hyzj2y1d24.png" alt="SEO Lens interface displaying structured Google Search Console performance data, ranking distribution, and SEO analysis." width="800" height="657"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Google Search Console provides a significant amount of information about how a website performs in search.&lt;/p&gt;

&lt;p&gt;Clicks, impressions, click-through rates, average positions, queries, pages, countries, and devices are all available through its performance reports.&lt;/p&gt;

&lt;p&gt;However, exporting this information often produces several CSV files containing hundreds or thousands of rows.&lt;/p&gt;

&lt;p&gt;The challenge is no longer accessing the data. It is transforming separate datasets into a structured representation that makes patterns, changes, and potential opportunities easier to identify.&lt;/p&gt;

&lt;p&gt;SEO Lens is a browser-based JavaScript utility developed by Palks Studio to process Google Search Console ZIP exports and generate structured analytical reports.&lt;/p&gt;

&lt;p&gt;Its architecture relies on local file processing, dataset normalization, deterministic analysis, and client-side rendering.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. General Architecture
&lt;/h2&gt;

&lt;p&gt;The application operates entirely within the browser for its data processing and analysis.&lt;/p&gt;

&lt;p&gt;The input is a ZIP archive exported from Google Search Console. The output is a visual report containing several analytical views.&lt;/p&gt;

&lt;p&gt;The processing pipeline is organized as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Google Search Console
          │
          ▼
      ZIP export
          │
          ▼
        Import
          │
          ▼
        Parser
          │
          ▼
     Normalization
          │
          ▼
        Analysis
          │
          ▼
Insights / Prioritization
          │
          ▼
       Rendering
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each stage has a distinct responsibility.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Responsibility&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Import&lt;/td&gt;
&lt;td&gt;Read the selected ZIP archive&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Parser&lt;/td&gt;
&lt;td&gt;Identify and parse CSV datasets&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Normalization&lt;/td&gt;
&lt;td&gt;Standardize filenames and columns&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Analysis&lt;/td&gt;
&lt;td&gt;Calculate metrics and identify signals&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Prioritization&lt;/td&gt;
&lt;td&gt;Organize findings for further review&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rendering&lt;/td&gt;
&lt;td&gt;Display the structured report&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The separation between these stages prevents the analytical logic from depending directly on the original structure or language of the exported files.&lt;/p&gt;

&lt;p&gt;No backend is required to process the archive or generate the report.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Reading a ZIP Archive in the Browser
&lt;/h2&gt;

&lt;p&gt;Google Search Console can export performance data as a ZIP archive containing several CSV files.&lt;/p&gt;

&lt;p&gt;A French export, for example, can contain the following files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;search-console-export.zip
├── Graphique.csv
├── Requêtes.csv
├── Pages.csv
├── Pays.csv
├── Appareils.csv
└── Filtres.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each file represents a different aspect of search performance.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dataset&lt;/th&gt;
&lt;th&gt;Information&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Graphique&lt;/td&gt;
&lt;td&gt;Performance over time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Requêtes&lt;/td&gt;
&lt;td&gt;Search queries and metrics&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pages&lt;/td&gt;
&lt;td&gt;Performance by page&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pays&lt;/td&gt;
&lt;td&gt;Performance by country&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Appareils&lt;/td&gt;
&lt;td&gt;Performance by device&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Filtres&lt;/td&gt;
&lt;td&gt;Export filters and report scope&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The archive is opened directly in the browser, and its CSV files are identified before being passed to the parsing stage.&lt;/p&gt;

&lt;h3&gt;
  
  
  Browser File Access
&lt;/h3&gt;

&lt;p&gt;JavaScript can access a file explicitly selected by the user through the browser's File API.&lt;/p&gt;

&lt;p&gt;The following educational example illustrates how a selected file can be read into memory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt;
    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"file"&lt;/span&gt;
    &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"export-file"&lt;/span&gt;
    &lt;span class="na"&gt;accept&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;".zip"&lt;/span&gt;
&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;input&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"export-file"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"change"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;files&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;buffer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;arrayBuffer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"File size:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;buffer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;byteLength&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example reads the selected file as binary data without transmitting it to a server.&lt;/p&gt;

&lt;p&gt;It illustrates the browser file access mechanism rather than the exact implementation used by SEO Lens.&lt;/p&gt;

&lt;p&gt;Reading the archive is only the first step. Its contents must then be extracted and interpreted before analysis can begin.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Parsing Multiple CSV Datasets
&lt;/h2&gt;

&lt;p&gt;A ZIP export contains several datasets rather than a single table.&lt;/p&gt;

&lt;p&gt;For example, a query dataset may contain rows such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Query,Clicks,Impressions,CTR,Position
python pdf comparison,25,1200,2.08%,8.4
javascript csv parser,12,850,1.41%,11.2
local data analysis,8,640,1.25%,6.8
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A page dataset may instead contain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Page,Clicks,Impressions,CTR,Position
https://example.com/article-a,35,1800,1.94%,7.5
https://example.com/article-b,18,950,1.89%,10.2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These examples use fictional data to illustrate the different dataset structures.&lt;/p&gt;

&lt;p&gt;The parser must identify which dataset is being processed and extract the corresponding fields.&lt;/p&gt;

&lt;h3&gt;
  
  
  CSV Parsing Considerations
&lt;/h3&gt;

&lt;p&gt;CSV parsing involves more than splitting a line at every comma.&lt;/p&gt;

&lt;p&gt;Consider the following example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Query,Clicks,Impressions
"python, javascript and data analysis",12,850
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first field contains a comma as part of its value.&lt;/p&gt;

&lt;p&gt;A simple implementation such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;columns&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;","&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;would incorrectly divide that query into multiple fields.&lt;/p&gt;

&lt;p&gt;A CSV parser must account for quoted values, delimiters, and escaped characters.&lt;/p&gt;

&lt;p&gt;Depending on the input format, it may also need to handle different line endings, encodings, or empty fields.&lt;/p&gt;

&lt;p&gt;These are general requirements of reliable CSV processing. The exact parser implementation used by SEO Lens is not reproduced here.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Normalizing Localized Exports
&lt;/h2&gt;

&lt;p&gt;One of the important implementation details is that Search Console exports can differ according to the interface language.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;English filename&lt;/th&gt;
&lt;th&gt;French filename&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Chart.csv&lt;/td&gt;
&lt;td&gt;Graphique.csv&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Queries.csv&lt;/td&gt;
&lt;td&gt;Requêtes.csv&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pages.csv&lt;/td&gt;
&lt;td&gt;Pages.csv&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Countries.csv&lt;/td&gt;
&lt;td&gt;Pays.csv&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Devices.csv&lt;/td&gt;
&lt;td&gt;Appareils.csv&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Filters.csv&lt;/td&gt;
&lt;td&gt;Filtres.csv&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If the analysis layer depends directly on these filenames, supporting multiple languages can introduce duplicated processing logic.&lt;/p&gt;

&lt;p&gt;SEO Lens uses aliases to identify equivalent datasets.&lt;/p&gt;

&lt;p&gt;The normalization layer separates the original filenames and column labels from the internal analytical structure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Queries.csv  ──┐
               ├──► Query dataset
Requêtes.csv ──┘

Countries.csv ─┐
               ├──► Country dataset
Pays.csv      ─┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Dataset Aliases
&lt;/h3&gt;

&lt;p&gt;An educational example of an alias-based approach could be represented as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;datasetAliases&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"chart.csv"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"performance"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"graphique.csv"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"performance"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;

    &lt;span class="s2"&gt;"queries.csv"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"queries"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"requêtes.csv"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"queries"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;

    &lt;span class="s2"&gt;"pages.csv"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"pages"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;

    &lt;span class="s2"&gt;"countries.csv"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"countries"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"pays.csv"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"countries"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;

    &lt;span class="s2"&gt;"devices.csv"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"devices"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"appareils.csv"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"devices"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;

    &lt;span class="s2"&gt;"filters.csv"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"filters"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"filtres.csv"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"filters"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;identifyDataset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;datasetAliases&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;identifyDataset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Requêtes.csv"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// "queries"&lt;/span&gt;

&lt;span class="nf"&gt;identifyDataset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Queries.csv"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// "queries"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both filenames resolve to the same internal dataset identifier.&lt;/p&gt;

&lt;p&gt;This example illustrates the alias principle described in the application's architecture. It does not reproduce the exact source code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Column Normalization
&lt;/h3&gt;

&lt;p&gt;The same approach can be applied to CSV column names.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;French label&lt;/th&gt;
&lt;th&gt;English label&lt;/th&gt;
&lt;th&gt;Internal field&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Requêtes&lt;/td&gt;
&lt;td&gt;Queries&lt;/td&gt;
&lt;td&gt;query&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Clics&lt;/td&gt;
&lt;td&gt;Clicks&lt;/td&gt;
&lt;td&gt;clicks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Impressions&lt;/td&gt;
&lt;td&gt;Impressions&lt;/td&gt;
&lt;td&gt;impressions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CTR&lt;/td&gt;
&lt;td&gt;CTR&lt;/td&gt;
&lt;td&gt;ctr&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Position&lt;/td&gt;
&lt;td&gt;Position&lt;/td&gt;
&lt;td&gt;position&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Once normalized, a query record can be represented independently of the original language.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"query"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"python pdf comparison"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"clicks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"impressions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"ctr"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;2.08&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"position"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;8.4&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This JSON object represents a conceptual normalized record rather than the exact internal schema used by SEO Lens.&lt;/p&gt;

&lt;p&gt;The analytical layer can then work with consistent field names regardless of whether the original export was generated in French or English.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Normalizing Metric Values
&lt;/h2&gt;

&lt;p&gt;Column names are not the only values that may require normalization.&lt;/p&gt;

&lt;p&gt;Numeric representations can also differ between languages.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Representation A&lt;/th&gt;
&lt;th&gt;Representation B&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Average position&lt;/td&gt;
&lt;td&gt;8.4&lt;/td&gt;
&lt;td&gt;8,4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CTR&lt;/td&gt;
&lt;td&gt;2.08%&lt;/td&gt;
&lt;td&gt;2,08%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Impressions&lt;/td&gt;
&lt;td&gt;1200&lt;/td&gt;
&lt;td&gt;1200&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These values must be interpreted correctly before being used in calculations.&lt;/p&gt;

&lt;p&gt;In JavaScript, a value read from a CSV file is initially textual.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;rawValue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"8.4"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;position&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rawValue&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;position&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// 8.4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"8,4"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// NaN&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A normalization layer must therefore account for the expected representation of numeric fields.&lt;/p&gt;

&lt;p&gt;It must also distinguish between missing values and actual zero values.&lt;/p&gt;

&lt;p&gt;For example, an empty CTR field should not automatically be interpreted as a measured CTR of zero.&lt;/p&gt;

&lt;p&gt;These examples illustrate why normalization is an important stage between parsing and analysis. They do not establish the exact numeric conversion rules implemented by the utility.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Building a Performance Overview
&lt;/h2&gt;

&lt;p&gt;The performance overview organizes the primary metrics available in a Search Console export.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Clicks&lt;/td&gt;
&lt;td&gt;Recorded clicks from search&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Impressions&lt;/td&gt;
&lt;td&gt;Recorded search visibility&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CTR&lt;/td&gt;
&lt;td&gt;Clicks relative to impressions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Average position&lt;/td&gt;
&lt;td&gt;Average recorded search position&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These metrics are related, but they do not describe the same aspect of performance.&lt;/p&gt;

&lt;p&gt;A website may receive many impressions while generating relatively few clicks.&lt;/p&gt;

&lt;p&gt;Another website may receive fewer impressions but achieve a higher click-through rate.&lt;/p&gt;

&lt;h3&gt;
  
  
  Calculating CTR
&lt;/h3&gt;

&lt;p&gt;The click-through rate is calculated as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CTR (%) = Clicks / Impressions × 100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Clicks      : 125
Impressions : 10,000

CTR = 125 / 10,000 × 100

CTR = 1.25%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A simple educational JavaScript implementation is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;calculateCTR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;clicks&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;impressions&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;impressions&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;clicks&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;impressions&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The function returns &lt;code&gt;null&lt;/code&gt; when no impressions are available, avoiding division by zero and distinguishing an undefined rate from an actual zero percent CTR.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Aggregation Matters
&lt;/h3&gt;

&lt;p&gt;When several rows are combined, their CTR values should not necessarily be averaged directly.&lt;/p&gt;

&lt;p&gt;Consider two queries:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Query&lt;/th&gt;
&lt;th&gt;Clicks&lt;/th&gt;
&lt;th&gt;Impressions&lt;/th&gt;
&lt;th&gt;CTR&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Query A&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;10.00%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Query B&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;1000&lt;/td&gt;
&lt;td&gt;1.00%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Total&lt;/td&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;td&gt;1100&lt;/td&gt;
&lt;td&gt;1.82%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A simple average of the two CTR values would produce:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(10% + 1%) / 2 = 5.5%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, the combined CTR is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;20 / 1100 × 100 = 1.82%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The difference comes from the unequal number of impressions.&lt;/p&gt;

&lt;p&gt;This is an important consideration when building analytical views from Search Console data.&lt;/p&gt;

&lt;p&gt;The same principle also requires care when aggregating average positions. An unweighted average of row-level positions may not reproduce the position reported by Search Console.&lt;/p&gt;

&lt;p&gt;These examples explain the analytical considerations involved in processing the data, rather than documenting the exact aggregation formulas used by SEO Lens.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Analyzing Performance Over Time
&lt;/h2&gt;

&lt;p&gt;The chart dataset contains performance information across the selected reporting period.&lt;/p&gt;

&lt;p&gt;This makes it possible to examine how clicks, impressions, CTR, and average position evolve.&lt;/p&gt;

&lt;p&gt;A simplified dataset could look like this:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Date&lt;/th&gt;
&lt;th&gt;Clicks&lt;/th&gt;
&lt;th&gt;Impressions&lt;/th&gt;
&lt;th&gt;Position&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;2026-08-01&lt;/td&gt;
&lt;td&gt;12&lt;/td&gt;
&lt;td&gt;850&lt;/td&gt;
&lt;td&gt;9.4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2026-08-02&lt;/td&gt;
&lt;td&gt;15&lt;/td&gt;
&lt;td&gt;920&lt;/td&gt;
&lt;td&gt;9.1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2026-08-03&lt;/td&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;780&lt;/td&gt;
&lt;td&gt;9.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2026-08-04&lt;/td&gt;
&lt;td&gt;21&lt;/td&gt;
&lt;td&gt;1200&lt;/td&gt;
&lt;td&gt;8.7&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The time-based view can help identify periods of increasing visibility, declining clicks, or changing average positions.&lt;/p&gt;

&lt;p&gt;However, a change in one metric does not necessarily explain a change in another.&lt;/p&gt;

&lt;p&gt;For example, impressions may increase because a website begins appearing for additional queries. If those queries rank lower or attract fewer clicks, the overall CTR may decrease.&lt;/p&gt;

&lt;p&gt;This does not automatically indicate that the website's performance has deteriorated.&lt;/p&gt;

&lt;p&gt;A useful report must therefore keep the underlying metrics visible rather than reducing every change to a positive or negative score.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. Ranking Distribution
&lt;/h2&gt;

&lt;p&gt;Average position provides a summary of search visibility, but it does not reveal how individual queries are distributed across ranking ranges.&lt;/p&gt;

&lt;p&gt;Consider two datasets with similar average positions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Dataset A:

Query 1 → Position 8
Query 2 → Position 9
Query 3 → Position 10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Dataset B:

Query 1 → Position 2
Query 2 → Position 9
Query 3 → Position 16
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both datasets have an arithmetic mean position of 9, but their distributions are different.&lt;/p&gt;

&lt;p&gt;A ranking distribution view makes these differences easier to examine.&lt;/p&gt;

&lt;p&gt;An illustrative grouping could be:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Position range&lt;/th&gt;
&lt;th&gt;Interpretation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1–3&lt;/td&gt;
&lt;td&gt;Highest ranking positions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4–10&lt;/td&gt;
&lt;td&gt;Other top-ten positions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;11–20&lt;/td&gt;
&lt;td&gt;Positions outside top ten&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;21+&lt;/td&gt;
&lt;td&gt;Lower ranking positions&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These ranges are examples of how ranking data can be grouped. They are not presented as the exact thresholds implemented by SEO Lens.&lt;/p&gt;

&lt;p&gt;The distribution can help identify whether visibility is concentrated among a small number of highly ranked queries or spread across a larger number of lower-ranked queries.&lt;/p&gt;

&lt;p&gt;It also provides context for the opportunity analysis.&lt;/p&gt;

&lt;p&gt;Importantly, Search Console reports average positions. A query with an average position of 8 does not necessarily appear at position 8 for every search.&lt;/p&gt;




&lt;h2&gt;
  
  
  9. Identifying SEO Opportunities
&lt;/h2&gt;

&lt;p&gt;SEO Lens uses deterministic analysis to identify situations that may deserve further investigation.&lt;/p&gt;

&lt;p&gt;One example is a query receiving significant impressions but relatively few clicks.&lt;/p&gt;

&lt;p&gt;Another is a query already ranking within a range where additional investigation may be useful.&lt;/p&gt;

&lt;p&gt;Consider the following fictional dataset:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Query&lt;/th&gt;
&lt;th&gt;Clicks&lt;/th&gt;
&lt;th&gt;Impressions&lt;/th&gt;
&lt;th&gt;CTR&lt;/th&gt;
&lt;th&gt;Position&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Query A&lt;/td&gt;
&lt;td&gt;15&lt;/td&gt;
&lt;td&gt;2000&lt;/td&gt;
&lt;td&gt;0.75%&lt;/td&gt;
&lt;td&gt;6.4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Query B&lt;/td&gt;
&lt;td&gt;48&lt;/td&gt;
&lt;td&gt;800&lt;/td&gt;
&lt;td&gt;6.00%&lt;/td&gt;
&lt;td&gt;3.2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Query C&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;1100&lt;/td&gt;
&lt;td&gt;0.36%&lt;/td&gt;
&lt;td&gt;12.8&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These rows suggest different questions.&lt;/p&gt;

&lt;p&gt;Query A receives substantial visibility and ranks relatively well, but its CTR is low.&lt;/p&gt;

&lt;p&gt;Query B generates more clicks from fewer impressions.&lt;/p&gt;

&lt;p&gt;Query C receives impressions despite ranking outside the top ten on average.&lt;/p&gt;

&lt;p&gt;A deterministic analysis can organize these situations into signals for review.&lt;/p&gt;

&lt;h3&gt;
  
  
  Rule-Based Analysis
&lt;/h3&gt;

&lt;p&gt;A conceptual rule can be expressed as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;IF impressions exceed a defined threshold
AND CTR is below a defined threshold
THEN identify the query for further review
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important distinction is that the rule identifies a pattern in the available data.&lt;/p&gt;

&lt;p&gt;It does not explain why that pattern exists.&lt;/p&gt;

&lt;p&gt;A low CTR may be influenced by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Search intent&lt;/li&gt;
&lt;li&gt;The page title or search snippet&lt;/li&gt;
&lt;li&gt;Competition&lt;/li&gt;
&lt;li&gt;Search result features&lt;/li&gt;
&lt;li&gt;The query's actual ranking distribution&lt;/li&gt;
&lt;li&gt;Differences between devices or countries&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Search Console data alone cannot establish which explanation is correct.&lt;/p&gt;

&lt;p&gt;The exact thresholds and prioritization rules used by SEO Lens are not specified here.&lt;/p&gt;

&lt;p&gt;The purpose of the example is to illustrate deterministic analysis without introducing an artificial SEO score or an AI-generated interpretation.&lt;/p&gt;




&lt;h2&gt;
  
  
  10. Page Performance and Dataset Boundaries
&lt;/h2&gt;

&lt;p&gt;The page dataset provides a different perspective from the query dataset.&lt;/p&gt;

&lt;p&gt;Instead of organizing metrics around search terms, it organizes them around URLs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Query dataset
    └── Performance by search query

Page dataset
    └── Performance by URL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A page-level view can help identify URLs receiving substantial impressions, generating clicks, or experiencing changes in visibility.&lt;/p&gt;

&lt;p&gt;However, separate aggregated CSV files have an important limitation.&lt;/p&gt;

&lt;p&gt;A query export and a page export do not necessarily establish which query generated impressions for which page.&lt;/p&gt;

&lt;p&gt;Consider:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Queries.csv

Query A → 1000 impressions
Query B → 500 impressions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Pages.csv

Page A → 900 impressions
Page B → 600 impressions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These datasets do not provide enough information to reconstruct the exact relationship between each query and each page.&lt;/p&gt;

&lt;p&gt;That relationship would require data containing both dimensions or a suitably filtered export.&lt;/p&gt;

&lt;p&gt;The same limitation applies when attempting to connect individual queries with countries or devices using separate aggregated datasets.&lt;/p&gt;

&lt;p&gt;An analytical report must therefore distinguish between information explicitly contained in the export and relationships that cannot be established from it.&lt;/p&gt;




&lt;h2&gt;
  
  
  11. Country and Device Analysis
&lt;/h2&gt;

&lt;p&gt;The country and device datasets provide additional views of search performance.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Country&lt;/th&gt;
&lt;th&gt;Clicks&lt;/th&gt;
&lt;th&gt;Impressions&lt;/th&gt;
&lt;th&gt;CTR&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;France&lt;/td&gt;
&lt;td&gt;120&lt;/td&gt;
&lt;td&gt;5000&lt;/td&gt;
&lt;td&gt;2.40%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;US&lt;/td&gt;
&lt;td&gt;35&lt;/td&gt;
&lt;td&gt;4200&lt;/td&gt;
&lt;td&gt;0.83%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;UK&lt;/td&gt;
&lt;td&gt;18&lt;/td&gt;
&lt;td&gt;1100&lt;/td&gt;
&lt;td&gt;1.64%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A device dataset might contain:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Device&lt;/th&gt;
&lt;th&gt;Clicks&lt;/th&gt;
&lt;th&gt;Impressions&lt;/th&gt;
&lt;th&gt;CTR&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Desktop&lt;/td&gt;
&lt;td&gt;95&lt;/td&gt;
&lt;td&gt;3200&lt;/td&gt;
&lt;td&gt;2.97%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mobile&lt;/td&gt;
&lt;td&gt;72&lt;/td&gt;
&lt;td&gt;6800&lt;/td&gt;
&lt;td&gt;1.06%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tablet&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;300&lt;/td&gt;
&lt;td&gt;2.00%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These views help identify differences in visibility and engagement across geographical areas and device categories.&lt;/p&gt;

&lt;p&gt;For example, a lower mobile CTR may indicate a situation worth investigating.&lt;/p&gt;

&lt;p&gt;However, it does not independently establish a mobile usability problem.&lt;/p&gt;

&lt;p&gt;Likewise, a country generating substantial impressions but few clicks does not automatically indicate a translation or localization issue.&lt;/p&gt;

&lt;p&gt;The data provides signals. Further investigation is required to determine their causes.&lt;/p&gt;




&lt;h2&gt;
  
  
  12. Diagnostic and Prioritization
&lt;/h2&gt;

&lt;p&gt;SEO Lens organizes analytical results into diagnostic and priority views.&lt;/p&gt;

&lt;p&gt;The objective is to make the information easier to review without hiding the original metrics behind a single numerical score.&lt;/p&gt;

&lt;p&gt;The conceptual workflow is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Normalized datasets
          │
          ▼
    Metric analysis
          │
          ▼
   Detected patterns
          │
          ▼
 Diagnostic observations
          │
          ▼
  Priorities for review
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A diagnostic observation might identify a query with significant impressions and low CTR.&lt;/p&gt;

&lt;p&gt;A priority view can then bring attention to that query alongside its original metrics.&lt;/p&gt;

&lt;p&gt;This preserves the relationship between the observation and the data supporting it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Avoid a Single SEO Score?
&lt;/h3&gt;

&lt;p&gt;A numerical score such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SEO score: 87/100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;would require a scoring model defining how different metrics are weighted and interpreted.&lt;/p&gt;

&lt;p&gt;Without an explicit model, the score may hide more information than it reveals.&lt;/p&gt;

&lt;p&gt;For example, increased impressions, reduced CTR, and improved average positions could occur during the same period.&lt;/p&gt;

&lt;p&gt;Reducing these changes to one number would require assumptions about their relative importance.&lt;/p&gt;

&lt;p&gt;SEO Lens instead keeps the available metrics visible and organizes the resulting observations into analytical views.&lt;/p&gt;

&lt;p&gt;The report is intended to identify where further investigation may be useful, not to determine whether an entire website is objectively good or bad.&lt;/p&gt;




&lt;h2&gt;
  
  
  13. Client-Side Rendering
&lt;/h2&gt;

&lt;p&gt;Once the analysis is complete, the report is rendered directly in the browser.&lt;/p&gt;

&lt;p&gt;The application organizes the results into several views:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Performance overview&lt;/li&gt;
&lt;li&gt;Performance evolution&lt;/li&gt;
&lt;li&gt;Ranking distribution&lt;/li&gt;
&lt;li&gt;Opportunities&lt;/li&gt;
&lt;li&gt;Page performance&lt;/li&gt;
&lt;li&gt;Countries and devices&lt;/li&gt;
&lt;li&gt;Diagnostic&lt;/li&gt;
&lt;li&gt;SEO priorities&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The separation between analysis and rendering allows the application to distinguish the calculated information from its visual presentation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CSV datasets
      │
      ▼
Normalized records
      │
      ▼
Analysis results
      │
      ├── Performance indicators
      ├── Time-based views
      ├── Ranking distribution
      ├── Tables
      └── Diagnostic observations
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This architecture also means that the presentation layer does not need to interpret the original localized CSV files directly.&lt;/p&gt;

&lt;p&gt;The data has already been prepared before the report is displayed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Rendering Imported Text Safely
&lt;/h3&gt;

&lt;p&gt;Browser-based tools that process user-selected files must also consider how imported text is inserted into the page.&lt;/p&gt;

&lt;p&gt;For example, a search query is data, not HTML.&lt;/p&gt;

&lt;p&gt;An educational rendering example is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;renderQuery&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;container&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;element&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"p"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="n"&gt;element&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="n"&gt;container&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;appendChild&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;element&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using &lt;code&gt;textContent&lt;/code&gt; treats the imported value as text rather than interpreting it as HTML markup.&lt;/p&gt;

&lt;p&gt;This is a general security consideration for client-side data processing. It is not a claim about the exact rendering implementation used by SEO Lens.&lt;/p&gt;




&lt;h2&gt;
  
  
  14. Local Processing and Privacy
&lt;/h2&gt;

&lt;p&gt;SEO Lens performs its analysis locally in the browser.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User device
    ├── Selected ZIP archive
    ├── CSV extraction and parsing
    ├── Normalization
    ├── Analysis
    └── Visual report
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The architecture does not require:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A user account&lt;/li&gt;
&lt;li&gt;A Google API connection&lt;/li&gt;
&lt;li&gt;A remote database&lt;/li&gt;
&lt;li&gt;An AI service&lt;/li&gt;
&lt;li&gt;Uploading the Search Console export to Palks Studio&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The selected archive is processed on the user's device.&lt;/p&gt;

&lt;p&gt;This is particularly relevant because Search Console exports can contain information about a website's search visibility, queries, geographical audience, and page performance.&lt;/p&gt;

&lt;p&gt;A server does not need access to these datasets if the required processing can be performed in the browser.&lt;/p&gt;

&lt;h3&gt;
  
  
  Local Processing and Network Activity
&lt;/h3&gt;

&lt;p&gt;Client-side processing must be distinguished from a completely offline application.&lt;/p&gt;

&lt;p&gt;A web application may still need to load its HTML, JavaScript, stylesheets, or other resources.&lt;/p&gt;

&lt;p&gt;The relevant architectural distinction is that the imported Search Console data does not need to be transmitted to a backend for analysis.&lt;/p&gt;

&lt;p&gt;Local data processing and the network requests required to load the application are separate concerns.&lt;/p&gt;




&lt;h2&gt;
  
  
  15. ZIP Exports vs. Direct API Integration
&lt;/h2&gt;

&lt;p&gt;A direct integration with the Google Search Console API could remove the manual export step.&lt;/p&gt;

&lt;p&gt;However, it would introduce additional architectural responsibilities.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;ZIP-based approach&lt;/th&gt;
&lt;th&gt;Direct API approach&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Data import&lt;/td&gt;
&lt;td&gt;Manual file selection&lt;/td&gt;
&lt;td&gt;Programmatic requests&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Google access&lt;/td&gt;
&lt;td&gt;Existing export&lt;/td&gt;
&lt;td&gt;Authorized API access&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Authentication&lt;/td&gt;
&lt;td&gt;Not required by tool&lt;/td&gt;
&lt;td&gt;OAuth authorization&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Token management&lt;/td&gt;
&lt;td&gt;Not required&lt;/td&gt;
&lt;td&gt;Required&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data freshness&lt;/td&gt;
&lt;td&gt;Export date&lt;/td&gt;
&lt;td&gt;API retrieval date&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The ZIP-based workflow relies on information that the user has already exported.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Google Search Console
          │
          ▼
      ZIP export
          │
          ▼
      SEO Lens
          │
          ▼
     Visual report
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A direct API integration would require handling authorization, permissions, tokens, and API-specific constraints.&lt;/p&gt;

&lt;p&gt;Depending on the architecture, it could also require additional backend infrastructure.&lt;/p&gt;

&lt;p&gt;For this use case, the existing export provides the required input without introducing those dependencies.&lt;/p&gt;

&lt;p&gt;The trade-off is explicit: one manual import step in exchange for a simpler processing architecture.&lt;/p&gt;




&lt;h2&gt;
  
  
  16. Scope and Limitations
&lt;/h2&gt;

&lt;p&gt;SEO Lens analyzes the information contained in the provided Search Console export.&lt;/p&gt;

&lt;p&gt;It does not perform:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Website crawling&lt;/li&gt;
&lt;li&gt;Complete technical SEO audits&lt;/li&gt;
&lt;li&gt;Backlink analysis&lt;/li&gt;
&lt;li&gt;HTML content analysis&lt;/li&gt;
&lt;li&gt;Website modifications&lt;/li&gt;
&lt;li&gt;Direct Search Console synchronization&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The report is therefore limited to the available datasets and the reporting period selected during export.&lt;/p&gt;

&lt;h3&gt;
  
  
  Search Console Data Is Not a Complete Website Inventory
&lt;/h3&gt;

&lt;p&gt;A Search Console export does not necessarily contain every query, every URL, or every aspect of a website's search performance.&lt;/p&gt;

&lt;p&gt;Exported data may be affected by reporting limits, privacy filtering, selected filters, and the way metrics are aggregated.&lt;/p&gt;

&lt;p&gt;An analysis layer cannot reconstruct information that is absent from its input.&lt;/p&gt;

&lt;p&gt;For example, a page missing from an export cannot automatically be classified as unindexed.&lt;/p&gt;

&lt;p&gt;Likewise, the absence of a query does not prove that no user searched for it.&lt;/p&gt;

&lt;p&gt;These distinctions are important when interpreting diagnostic results.&lt;/p&gt;

&lt;h3&gt;
  
  
  Signals Are Not Causes
&lt;/h3&gt;

&lt;p&gt;The report can identify patterns such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;High impressions + Low CTR
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But establishing the cause may require additional investigation involving search results, page content, technical configuration, or indexing information.&lt;/p&gt;

&lt;p&gt;The analysis should therefore remain connected to the data it actually receives.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;SEO Lens illustrates a client-side approach to transforming Google Search Console exports into structured analytical information.&lt;/p&gt;

&lt;p&gt;The architecture separates ZIP import, CSV parsing, localization normalization, deterministic analysis, prioritization, and visual rendering.&lt;/p&gt;

&lt;p&gt;By keeping these responsibilities distinct, the application can organize several datasets without making its analytical logic depend directly on their original filenames or language.&lt;/p&gt;

&lt;p&gt;The report preserves the underlying metrics rather than replacing them with an arbitrary SEO score.&lt;/p&gt;

&lt;p&gt;Its limitations are equally important. Search Console exports provide useful performance information, but they cannot independently establish every cause of a ranking change, reconstruct missing relationships, or replace a complete technical SEO audit.&lt;/p&gt;

&lt;p&gt;The objective is to make existing data easier to inspect while keeping the distinction between measured information, analytical signals, and conclusions that require further investigation.&lt;/p&gt;




&lt;h2&gt;
  
  
  Technical Documentation
&lt;/h2&gt;

&lt;p&gt;The project's technical presentation and architecture documentation are available on GitHub.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Palks-Studio/seo-lens" rel="noopener noreferrer"&gt;View the SEO Lens technical resource&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;a href="https://palks-studio.com" rel="noopener noreferrer"&gt;https://palks-studio.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>seo</category>
      <category>webdev</category>
      <category>architecture</category>
    </item>
    <item>
      <title>🔐 Monitoring Python Packages and VS Code Extensions: Dependency Lifecycle and Security Alerts</title>
      <dc:creator>Anthony Leignel</dc:creator>
      <pubDate>Sun, 16 Aug 2026 15:50:57 +0000</pubDate>
      <link>https://dev.to/palks_studio/how-many-obsolete-dependencies-are-you-using-without-knowing-it-an-open-source-checker-4nnl</link>
      <guid>https://dev.to/palks_studio/how-many-obsolete-dependencies-are-you-using-without-knowing-it-an-open-source-checker-4nnl</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0cyneqyxe853med87awr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0cyneqyxe853med87awr.png" alt="Dependency Security Checker displaying documented alerts for installed Python packages and VS Code extensions." width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Software security is not limited to the code written within a project. It also depends on the packages, libraries, extensions, and development tools installed in its environment.&lt;/p&gt;

&lt;p&gt;Over time, some of these components become deprecated, archived, renamed, or no longer maintained.&lt;/p&gt;

&lt;p&gt;They may continue to work without producing errors, even though their maintenance status has changed.&lt;/p&gt;

&lt;p&gt;Dependency Security Checker is a local utility designed to identify these situations by scanning installed Python packages and VS Code extensions, then comparing them against documented alert databases.&lt;/p&gt;

&lt;p&gt;Its purpose is not to determine whether every installed component is secure. It provides information about dependencies that may require further investigation.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Dependency Security Beyond Known Vulnerabilities
&lt;/h2&gt;

&lt;p&gt;Dependency security is often associated with vulnerability databases and identifiers such as CVEs.&lt;/p&gt;

&lt;p&gt;However, the maintenance status of a dependency introduces another dimension.&lt;/p&gt;

&lt;p&gt;A package can remain functional while no longer receiving updates. An extension can continue to operate after its repository has been archived. A library can be replaced by another project while older installations remain in use.&lt;/p&gt;

&lt;p&gt;These situations do not necessarily indicate an existing vulnerability, but they can affect the long-term reliability of a development environment.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Situation&lt;/th&gt;
&lt;th&gt;Potential implication&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Deprecated package&lt;/td&gt;
&lt;td&gt;Migration may be recommended&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Archived repository&lt;/td&gt;
&lt;td&gt;Future maintenance may be limited&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unmaintained project&lt;/td&gt;
&lt;td&gt;Security fixes may no longer be provided&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Renamed project&lt;/td&gt;
&lt;td&gt;The original identifier may be obsolete&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Suggested successor&lt;/td&gt;
&lt;td&gt;A maintained alternative may exist&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The objective of dependency lifecycle monitoring is to make these changes visible before they become operational problems.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. General Architecture
&lt;/h2&gt;

&lt;p&gt;Dependency Security Checker follows a simple local processing workflow.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Development environment
          │
          ├── Installed Python packages
          │
          └── Installed VS Code extensions
                       │
                       ▼
                Local inventory
                       │
                       ▼
              Alert database lookup
                       │
                       ▼
                Matching entries
                       │
                       ▼
                 Alert display
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The architecture separates three main responsibilities:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Identifying installed components&lt;/li&gt;
&lt;li&gt;Comparing them against documented alerts&lt;/li&gt;
&lt;li&gt;Displaying information about matching entries&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The utility does not automatically modify the development environment.&lt;/p&gt;

&lt;p&gt;The scan produces information that can be reviewed before deciding whether a dependency should be retained, updated, replaced, or removed.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Identifying Installed Python Packages
&lt;/h2&gt;

&lt;p&gt;Python environments can accumulate packages over time.&lt;/p&gt;

&lt;p&gt;Some packages are installed for a specific project, others for testing, automation, or general development tasks.&lt;/p&gt;

&lt;p&gt;A package may remain installed long after the original reason for installing it has disappeared.&lt;/p&gt;

&lt;p&gt;A dependency inventory can be represented conceptually as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Python environment
    ├── package-a 1.2.0
    ├── package-b 2.4.1
    ├── package-c 0.9.5
    └── package-d 3.1.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The package name identifies the installed component, while the version provides additional context for investigating its status.&lt;/p&gt;

&lt;p&gt;Python already provides standard tools for inspecting installed packages.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python -m pip list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command displays packages installed in the Python environment associated with the selected interpreter.&lt;/p&gt;

&lt;p&gt;A typical output looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Package       Version
------------- -------
package-a     1.2.0
package-b     2.4.1
package-c     0.9.5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is an illustration of a standard Python inventory mechanism, not a reproduction of the checker's internal implementation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Environment Scope
&lt;/h3&gt;

&lt;p&gt;A Python package inventory is associated with a particular environment.&lt;/p&gt;

&lt;p&gt;A development machine may contain several independent environments:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Development machine
    ├── System Python
    ├── Project A virtual environment
    └── Project B virtual environment
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each environment may contain different packages and versions.&lt;/p&gt;

&lt;p&gt;Consequently, the result of a dependency scan must be interpreted according to the environment being inspected.&lt;/p&gt;

&lt;p&gt;An inventory of one Python environment does not automatically represent every package installed on the machine.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Identifying VS Code Extensions
&lt;/h2&gt;

&lt;p&gt;Visual Studio Code extensions introduce another category of dependencies.&lt;/p&gt;

&lt;p&gt;They can provide language support, formatting, debugging, diagnostics, code generation, or other development functionality.&lt;/p&gt;

&lt;p&gt;Like Python packages, extensions can become deprecated, archived, or replaced.&lt;/p&gt;

&lt;p&gt;Visual Studio Code provides a command-line interface for listing installed extensions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;code --list-extensions --show-versions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A conceptual result could look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;publisher.extension-a@1.2.0
publisher.extension-b@3.4.1
publisher.extension-c@0.8.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command illustrates how an extension inventory can be obtained. It is not presented as the exact command used internally by Dependency Security Checker.&lt;/p&gt;

&lt;h3&gt;
  
  
  Extension Identifiers
&lt;/h3&gt;

&lt;p&gt;An extension's identifier generally combines its publisher and extension name.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;publisher.extension-name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This identifier is more useful for matching than a display name alone.&lt;/p&gt;

&lt;p&gt;Two extensions may have similar display names while belonging to different publishers or projects.&lt;/p&gt;

&lt;p&gt;Dependency monitoring therefore needs to distinguish between the identity of a component and the name presented to the user.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Comparing Installed Components Against Alert Databases
&lt;/h2&gt;

&lt;p&gt;The utility compares installed Python packages and VS Code extensions against local databases containing documented alerts.&lt;/p&gt;

&lt;p&gt;The comparison can be represented as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Installed components
          │
          ▼
  Alert database lookup
          │
          ├── No matching entry
          │
          └── Matching entry
                    │
                    ▼
               Display alert
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An alert may indicate that a project has been deprecated, archived, renamed, or is no longer maintained.&lt;/p&gt;

&lt;p&gt;The initial database contains hundreds of documented alerts covering Python packages and VS Code extensions.&lt;/p&gt;

&lt;p&gt;However, the database is not intended to be exhaustive.&lt;/p&gt;

&lt;p&gt;The result depends on the information available in the database at the time of the scan.&lt;/p&gt;

&lt;h3&gt;
  
  
  A Conceptual Alert Record
&lt;/h3&gt;

&lt;p&gt;An alert can be understood as a combination of several pieces of information:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Information&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Component identifier&lt;/td&gt;
&lt;td&gt;Identify the installed component&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Status&lt;/td&gt;
&lt;td&gt;Describe its documented state&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reason&lt;/td&gt;
&lt;td&gt;Explain why it was flagged&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Suggested replacement&lt;/td&gt;
&lt;td&gt;Identify an alternative, if any&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Source&lt;/td&gt;
&lt;td&gt;Support the documented alert&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This table describes the information presented by the utility. It does not reproduce the internal structure of its alert databases.&lt;/p&gt;

&lt;p&gt;The source is particularly important because it allows the user to investigate the original announcement or documented change.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Deprecation, Archival, and Vulnerabilities
&lt;/h2&gt;

&lt;p&gt;One of the central distinctions behind this approach is that an obsolete dependency is not necessarily vulnerable.&lt;/p&gt;

&lt;p&gt;These concepts describe different situations.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Status&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Deprecated&lt;/td&gt;
&lt;td&gt;Continued use may be discouraged&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Archived&lt;/td&gt;
&lt;td&gt;A repository has been marked as archived&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unmaintained&lt;/td&gt;
&lt;td&gt;Active maintenance has stopped or slowed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Vulnerable&lt;/td&gt;
&lt;td&gt;A security weakness has been identified&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No known alert&lt;/td&gt;
&lt;td&gt;No matching database entry was found&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A deprecated package may continue to receive security fixes during a transition period.&lt;/p&gt;

&lt;p&gt;An archived project may still work correctly.&lt;/p&gt;

&lt;p&gt;An actively maintained project may contain a newly discovered vulnerability.&lt;/p&gt;

&lt;p&gt;These conditions must therefore remain distinct.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Maintenance Status Still Matters
&lt;/h3&gt;

&lt;p&gt;When a vulnerability is discovered, a maintained project may provide a correction through a new release.&lt;/p&gt;

&lt;p&gt;An unmaintained project may not have an active team available to investigate or fix the issue.&lt;/p&gt;

&lt;p&gt;This creates a different kind of risk.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Vulnerability discovered
          │
          ├── Maintained project
          │       └── A fix may be developed
          │
          └── Unmaintained project
                  └── A fix may never be released
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This does not mean that every abandoned dependency must immediately be removed.&lt;/p&gt;

&lt;p&gt;It means that maintenance status is relevant when evaluating the long-term security and reliability of a component.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Understanding the Alert Output
&lt;/h2&gt;

&lt;p&gt;Dependency Security Checker presents documented information rather than assigning an automatic risk score.&lt;/p&gt;

&lt;p&gt;An example of its alert output is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[!] package-name 1.0.0
    Status / Statut: DEPRECATED / DÉPRÉCIÉ

    Reason:
    ...

    Raison :
    ...

    Suggested replacement / Remplacement suggéré:
    ...

    Source: ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output identifies the installed component and its documented status.&lt;/p&gt;

&lt;p&gt;It also provides the reason for the alert, a suggested replacement when one is available, and the source supporting the information.&lt;/p&gt;

&lt;p&gt;The bilingual presentation allows the information to be read in English or French.&lt;/p&gt;

&lt;h3&gt;
  
  
  No Known Alert
&lt;/h3&gt;

&lt;p&gt;If no installed component matches an entry in the current database, the utility reports:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;No known alert found
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This result has a specific meaning: no matching alert was found in the available database.&lt;/p&gt;

&lt;p&gt;It does not establish that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every installed component is actively maintained&lt;/li&gt;
&lt;li&gt;Every installed version is free from vulnerabilities&lt;/li&gt;
&lt;li&gt;The environment has been comprehensively audited&lt;/li&gt;
&lt;li&gt;The database contains every relevant security issue&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A database-driven checker can only identify situations represented by its available data and matching logic.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. A Read-Only Approach to Dependency Monitoring
&lt;/h2&gt;

&lt;p&gt;The utility is designed to scan and report without automatically changing the environment.&lt;/p&gt;

&lt;p&gt;It does not:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Uninstall Python packages&lt;/li&gt;
&lt;li&gt;Disable VS Code extensions&lt;/li&gt;
&lt;li&gt;Update dependencies&lt;/li&gt;
&lt;li&gt;Install suggested replacements&lt;/li&gt;
&lt;li&gt;Modify project files&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This separation between detection and action is important.&lt;/p&gt;

&lt;p&gt;Automatically removing a package may break a project that still depends on it.&lt;/p&gt;

&lt;p&gt;Updating a library may introduce incompatible API changes.&lt;/p&gt;

&lt;p&gt;Disabling an extension may affect a development workflow or remove functionality that is still required.&lt;/p&gt;

&lt;p&gt;The checker therefore leaves remediation decisions outside the scanning process.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Detection
    │
    ▼
Review documented source
    │
    ▼
Evaluate dependency usage
    │
    ▼
Decide on appropriate action
    │
    ├── Keep
    ├── Update
    ├── Replace
    └── Remove
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A suggested replacement should be understood as information to investigate, not as an instruction to install another component automatically.&lt;/p&gt;




&lt;h2&gt;
  
  
  9. Maintaining a Source-Backed Alert Database
&lt;/h2&gt;

&lt;p&gt;The reliability of this type of utility depends heavily on the quality of its alert data.&lt;/p&gt;

&lt;p&gt;A project may change its name, transfer ownership, resume maintenance, or recommend a successor.&lt;/p&gt;

&lt;p&gt;An alert that was accurate at one point may therefore require revision later.&lt;/p&gt;

&lt;p&gt;The database follows a central principle: an alert should be supported by a documented source.&lt;/p&gt;

&lt;p&gt;Relevant sources can include official project announcements, repository archival notices, package documentation, or migration recommendations published by maintainers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Database Coverage
&lt;/h3&gt;

&lt;p&gt;A large number of alerts does not necessarily guarantee comprehensive coverage.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Database characteristic&lt;/th&gt;
&lt;th&gt;Importance&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Documented sources&lt;/td&gt;
&lt;td&gt;Supports verification&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Component identification&lt;/td&gt;
&lt;td&gt;Reduces incorrect matches&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Current information&lt;/td&gt;
&lt;td&gt;Reflects changes in project status&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Clear explanations&lt;/td&gt;
&lt;td&gt;Provides context for each alert&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Relevant replacements&lt;/td&gt;
&lt;td&gt;Helps investigate migration options&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The objective is not simply to accumulate as many entries as possible.&lt;/p&gt;

&lt;p&gt;A useful alert database should provide information that can be verified and interpreted in the context of the installed component.&lt;/p&gt;

&lt;h3&gt;
  
  
  An Evolving Dataset
&lt;/h3&gt;

&lt;p&gt;Dependency lifecycle monitoring is not a one-time operation.&lt;/p&gt;

&lt;p&gt;New projects become deprecated, repositories are archived, and alternatives emerge over time.&lt;/p&gt;

&lt;p&gt;A local alert database must therefore be maintained if its results are to remain useful.&lt;/p&gt;

&lt;p&gt;The public description of the utility does not specify an automatic update mechanism. Database freshness remains an important consideration when interpreting scan results.&lt;/p&gt;




&lt;h2&gt;
  
  
  10. Local Processing and Development Environment Privacy
&lt;/h2&gt;

&lt;p&gt;Dependency Security Checker performs its scan locally.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Local machine
    ├── Python package inventory
    ├── VS Code extension inventory
    ├── Local alert databases
    └── Scan results
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The inventory does not need to be sent to a remote service to perform the comparison.&lt;/p&gt;

&lt;p&gt;This matters because an installed dependency list can reveal information about a development environment.&lt;/p&gt;

&lt;p&gt;It may indicate which frameworks, libraries, development tools, or technologies are being used.&lt;/p&gt;

&lt;p&gt;Local comparison avoids an unnecessary transfer of this information.&lt;/p&gt;

&lt;p&gt;However, consulting a documented source or obtaining updated alert data may involve separate network activity.&lt;/p&gt;

&lt;p&gt;The distinction is between the local scanning operation and the external sources used to document or investigate alerts.&lt;/p&gt;




&lt;h2&gt;
  
  
  11. Complementing Vulnerability Scanners
&lt;/h2&gt;

&lt;p&gt;Dependency lifecycle monitoring and vulnerability scanning address related but different questions.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool or approach&lt;/th&gt;
&lt;th&gt;Primary objective&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Dependency inventory&lt;/td&gt;
&lt;td&gt;Identify installed components&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lifecycle monitoring&lt;/td&gt;
&lt;td&gt;Detect deprecated or obsolete tools&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Vulnerability scan&lt;/td&gt;
&lt;td&gt;Identify known security weaknesses&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dependency updates&lt;/td&gt;
&lt;td&gt;Install newer component versions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Security audit&lt;/td&gt;
&lt;td&gt;Evaluate broader security exposure&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A vulnerability scanner may identify a known security issue affecting a specific package version.&lt;/p&gt;

&lt;p&gt;A lifecycle checker may identify a package that is no longer maintained, even when no vulnerability has been documented.&lt;/p&gt;

&lt;p&gt;These approaches can complement one another.&lt;/p&gt;

&lt;p&gt;For example, a development workflow could include:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Inventory installed components
             │
             ▼
Review lifecycle alerts
             │
             ▼
Check known vulnerabilities
             │
             ▼
Evaluate dependency usage
             │
             ▼
Plan and test changes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is an example of a broader dependency management workflow, not a description of additional features implemented by Dependency Security Checker.&lt;/p&gt;

&lt;p&gt;The utility focuses on identifying documented alerts associated with installed Python packages and VS Code extensions.&lt;/p&gt;




&lt;h2&gt;
  
  
  12. Practical Use Cases
&lt;/h2&gt;

&lt;p&gt;A local dependency lifecycle checker can be useful in several situations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reviewing a development environment that has accumulated packages over time&lt;/li&gt;
&lt;li&gt;Identifying extensions that have been archived or deprecated&lt;/li&gt;
&lt;li&gt;Investigating older dependencies before maintaining an existing project&lt;/li&gt;
&lt;li&gt;Reviewing suggested alternatives for obsolete components&lt;/li&gt;
&lt;li&gt;Preparing a dependency inventory before a broader security assessment&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It can also help distinguish between dependencies that are still required and components that were installed for temporary experiments or older projects.&lt;/p&gt;

&lt;p&gt;An alert does not automatically determine whether a component should be removed.&lt;/p&gt;

&lt;p&gt;That decision depends on how the component is used, the availability of alternatives, compatibility requirements, and the documented reason for the alert.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Dependency Security Checker illustrates a focused approach to monitoring the lifecycle of installed Python packages and VS Code extensions.&lt;/p&gt;

&lt;p&gt;By comparing a local inventory against documented alert databases, it makes potentially obsolete or unmaintained components easier to identify.&lt;/p&gt;

&lt;p&gt;The architecture deliberately separates detection from remediation.&lt;/p&gt;

&lt;p&gt;The utility reports information, provides sources, and leaves decisions about updates, replacements, or removal to the user.&lt;/p&gt;

&lt;p&gt;Its results should not be confused with a comprehensive vulnerability assessment. An absence of alerts does not establish that an environment is secure, just as a deprecation notice does not establish that a dependency is vulnerable.&lt;/p&gt;

&lt;p&gt;Dependency security involves more than checking whether software currently works. It also involves understanding whether the components that support it are still maintained, documented, and capable of evolving when new problems arise.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://palks-studio.com" rel="noopener noreferrer"&gt;https://palks-studio.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>python</category>
      <category>vscode</category>
      <category>programming</category>
    </item>
    <item>
      <title>📄 Comparing PDF and XML Data Locally with Python: Bidirectional Document Consistency Checks</title>
      <dc:creator>Anthony Leignel</dc:creator>
      <pubDate>Sat, 15 Aug 2026 20:40:01 +0000</pubDate>
      <link>https://dev.to/palks_studio/comparing-pdf-and-xml-data-locally-with-python-502n</link>
      <guid>https://dev.to/palks_studio/comparing-pdf-and-xml-data-locally-with-python-502n</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwzsjl5bppxsw67tbrtd0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwzsjl5bppxsw67tbrtd0.png" alt="PDF / XML Comparator interface for comparing PDF content and XML data locally." width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A PDF and an XML file can represent the same document while containing different information.&lt;/p&gt;

&lt;p&gt;A value may have been modified in one representation, a reference may be missing, a number may use a different format, or some information may exist in one file but not the other.&lt;/p&gt;

&lt;p&gt;When both files are part of the same document processing workflow, checking their consistency manually can quickly become time-consuming.&lt;/p&gt;

&lt;p&gt;PDF / XML Comparator is a lightweight Python utility designed to perform an initial comparison between these two representations locally.&lt;/p&gt;

&lt;p&gt;Its purpose is not to interpret the business meaning of every field, but to identify potential differences between the textual content of a PDF and the data contained in an XML file.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Two Formats, Two Different Representations
&lt;/h2&gt;

&lt;p&gt;PDF and XML serve fundamentally different purposes.&lt;/p&gt;

&lt;p&gt;A PDF provides a human-readable representation of a document. It defines how text, images, and other elements appear on a page.&lt;/p&gt;

&lt;p&gt;XML provides a structured representation of data that can be processed by software.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Format&lt;/th&gt;
&lt;th&gt;Primary purpose&lt;/th&gt;
&lt;th&gt;Data representation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;PDF&lt;/td&gt;
&lt;td&gt;Human-readable document&lt;/td&gt;
&lt;td&gt;Text and graphical elements&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;XML&lt;/td&gt;
&lt;td&gt;Machine-readable information&lt;/td&gt;
&lt;td&gt;Structured elements and data&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Even when both files originate from the same generation process, their contents are not necessarily identical.&lt;/p&gt;

&lt;p&gt;Consider the following simplified example.&lt;/p&gt;

&lt;p&gt;PDF content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Invoice number: INV-2026-001
Customer: Example Company
Total: 1,250.00 EUR
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;XML content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;Invoice&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;InvoiceNumber&amp;gt;&lt;/span&gt;INV-2026-001&lt;span class="nt"&gt;&amp;lt;/InvoiceNumber&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;Customer&amp;gt;&lt;/span&gt;Example Company&lt;span class="nt"&gt;&amp;lt;/Customer&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;Total&amp;gt;&lt;/span&gt;1350.00&lt;span class="nt"&gt;&amp;lt;/Total&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;Currency&amp;gt;&lt;/span&gt;EUR&lt;span class="nt"&gt;&amp;lt;/Currency&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/Invoice&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both files describe the same invoice, but the total amount differs.&lt;/p&gt;

&lt;p&gt;The PDF displays &lt;code&gt;1,250.00&lt;/code&gt;, while the XML contains &lt;code&gt;1350.00&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A comparison between the two representations can help identify this type of inconsistency.&lt;/p&gt;

&lt;p&gt;The XML structure shown here is illustrative and does not represent a specific invoicing standard.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Why a Bidirectional Comparison?
&lt;/h2&gt;

&lt;p&gt;Checking whether XML values appear in a PDF is useful, but it only addresses one side of the problem.&lt;/p&gt;

&lt;p&gt;A value may exist in the XML without appearing in the PDF. Conversely, information displayed in the PDF may not be present in the XML.&lt;/p&gt;

&lt;p&gt;PDF / XML Comparator follows a bidirectional approach.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PDF ──► Text extraction ──► Search values in XML
                                    │
                                    ▼
                               Differences
                                    ▲
                                    │
XML ──► Data extraction ──► Search values in PDF
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The comparison operates in both directions:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Direction&lt;/th&gt;
&lt;th&gt;Objective&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;PDF → XML&lt;/td&gt;
&lt;td&gt;Find PDF values in the XML data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;XML → PDF&lt;/td&gt;
&lt;td&gt;Find XML values in the PDF content&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This distinction is important because neither file is automatically assumed to contain every piece of information present in the other.&lt;/p&gt;

&lt;p&gt;A bidirectional comparison provides a broader view of potential discrepancies than checking only one representation against the other.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Extracting Comparable Information
&lt;/h2&gt;

&lt;p&gt;The first stage consists of extracting information from both files.&lt;/p&gt;

&lt;p&gt;For the PDF, the comparison relies on its textual content.&lt;/p&gt;

&lt;p&gt;For the XML, it relies on the data contained in the structured document.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PDF document                 XML document
     │                            │
     ▼                            ▼
Text extraction              Data extraction
     │                            │
     └─────────────┬──────────────┘
                   │
                   ▼
           Comparable values
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The two extraction processes serve the same objective: obtaining information that can be searched and compared across both representations.&lt;/p&gt;

&lt;p&gt;However, the extracted information does not necessarily retain the same structure.&lt;/p&gt;

&lt;p&gt;For example, a PDF may display:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Customer: Example Company
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;While the corresponding XML may contain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;Customer&amp;gt;&lt;/span&gt;Example Company&lt;span class="nt"&gt;&amp;lt;/Customer&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The visible label and the XML element name are different representations of the same information.&lt;/p&gt;

&lt;p&gt;This is why comparing the raw contents of a PDF file and an XML file would not be sufficient. The comparison must operate on extracted information rather than on the files' binary contents.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Identifying Potential Differences
&lt;/h2&gt;

&lt;p&gt;A comparison between PDF and XML data can help identify several types of discrepancies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A reference that differs between the two files&lt;/li&gt;
&lt;li&gt;An amount that has changed in one representation&lt;/li&gt;
&lt;li&gt;A value present only in the XML&lt;/li&gt;
&lt;li&gt;Information displayed in the PDF but absent from the XML&lt;/li&gt;
&lt;li&gt;Equivalent values represented using different formats&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Consider the following example.&lt;/p&gt;

&lt;p&gt;PDF content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Reference: INV-2026-042
Customer: Example Company
Total: 1,200.00 EUR
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;XML content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;Invoice&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;Reference&amp;gt;&lt;/span&gt;INV-2026-042&lt;span class="nt"&gt;&amp;lt;/Reference&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;Customer&amp;gt;&lt;/span&gt;Example Company&lt;span class="nt"&gt;&amp;lt;/Customer&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;Total&amp;gt;&lt;/span&gt;1350.00&lt;span class="nt"&gt;&amp;lt;/Total&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;Currency&amp;gt;&lt;/span&gt;EUR&lt;span class="nt"&gt;&amp;lt;/Currency&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/Invoice&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The reference and customer name are consistent between the two representations.&lt;/p&gt;

&lt;p&gt;The amount, however, differs.&lt;/p&gt;

&lt;p&gt;A conceptual comparison result could be represented as follows:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Information&lt;/th&gt;
&lt;th&gt;PDF value&lt;/th&gt;
&lt;th&gt;XML value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Reference&lt;/td&gt;
&lt;td&gt;INV-2026-042&lt;/td&gt;
&lt;td&gt;INV-2026-042&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Customer&lt;/td&gt;
&lt;td&gt;Example Company&lt;/td&gt;
&lt;td&gt;Example Company&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Total&lt;/td&gt;
&lt;td&gt;1,200.00&lt;/td&gt;
&lt;td&gt;1350.00&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This table illustrates the type of discrepancy a comparison can help reveal. It does not represent the exact output format of the utility.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Formatting Differences and Equivalent Values
&lt;/h2&gt;

&lt;p&gt;One of the challenges of comparing PDF and XML data is that equivalent information can be represented differently.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Information&lt;/th&gt;
&lt;th&gt;PDF representation&lt;/th&gt;
&lt;th&gt;XML representation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Amount&lt;/td&gt;
&lt;td&gt;1,250.00&lt;/td&gt;
&lt;td&gt;1250.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Date&lt;/td&gt;
&lt;td&gt;15/08/2026&lt;/td&gt;
&lt;td&gt;2026-08-15&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Percentage&lt;/td&gt;
&lt;td&gt;20%&lt;/td&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These values may represent the same information, even though their textual representations differ.&lt;/p&gt;

&lt;p&gt;A direct textual search may therefore identify a difference where the underlying information is actually equivalent.&lt;/p&gt;

&lt;p&gt;This introduces an important distinction between textual matching and semantic comparison.&lt;/p&gt;

&lt;p&gt;Textual matching checks whether a value can be found in another representation.&lt;/p&gt;

&lt;p&gt;Semantic comparison attempts to determine whether two differently formatted values have the same meaning.&lt;/p&gt;

&lt;p&gt;The second approach requires additional knowledge about the data type, formatting conventions, and sometimes the business context.&lt;/p&gt;

&lt;p&gt;For example, interpreting a date requires knowing which date format is being used. Comparing monetary amounts may require understanding decimal separators and currency conventions.&lt;/p&gt;

&lt;p&gt;PDF / XML Comparator is deliberately designed as an initial comparison tool rather than a system that interprets the business meaning of every field.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Value Presence Is Not the Same as Field Consistency
&lt;/h2&gt;

&lt;p&gt;Finding a value in both documents does not necessarily prove that it belongs to the same field.&lt;/p&gt;

&lt;p&gt;Consider the following simplified example.&lt;/p&gt;

&lt;p&gt;PDF content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Subtotal: 100.00
Tax: 20.00
Total: 120.00
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;XML content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;Invoice&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;Subtotal&amp;gt;&lt;/span&gt;120.00&lt;span class="nt"&gt;&amp;lt;/Subtotal&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;Tax&amp;gt;&lt;/span&gt;20.00&lt;span class="nt"&gt;&amp;lt;/Tax&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;Total&amp;gt;&lt;/span&gt;100.00&lt;span class="nt"&gt;&amp;lt;/Total&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/Invoice&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All three numerical values appear in both representations.&lt;/p&gt;

&lt;p&gt;However, the subtotal and total have been exchanged.&lt;/p&gt;

&lt;p&gt;A comparison based solely on value presence may not identify this inconsistency because each value can still be found in both documents.&lt;/p&gt;

&lt;p&gt;Detecting this type of problem requires a more specific approach that associates each value with its corresponding field.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PDF subtotal  → XML Subtotal
PDF tax       → XML Tax
PDF total     → XML Total
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a different level of comparison, requiring knowledge of the document structure and the relationship between PDF labels and XML elements.&lt;/p&gt;

&lt;p&gt;The example illustrates why an initial bidirectional comparison should not be treated as proof that two documents are fully consistent.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Information That Exists in Only One Representation
&lt;/h2&gt;

&lt;p&gt;A PDF and an XML file do not necessarily contain exactly the same set of information.&lt;/p&gt;

&lt;p&gt;An XML document may include technical identifiers, metadata, or structured information intended for software processing.&lt;/p&gt;

&lt;p&gt;A PDF may include explanatory text, visual labels, or presentation elements intended for the reader.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;ProcessingReference&amp;gt;&lt;/span&gt;PROC-2026-001&lt;span class="nt"&gt;&amp;lt;/ProcessingReference&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This value may exist in the XML without being displayed in the PDF.&lt;/p&gt;

&lt;p&gt;Its absence from the PDF does not automatically indicate an error.&lt;/p&gt;

&lt;p&gt;Similarly, a PDF may contain a descriptive heading that does not appear as a separate XML value.&lt;/p&gt;

&lt;p&gt;A bidirectional comparison can help identify information that exists in only one representation, but determining whether that difference is expected requires additional context.&lt;/p&gt;

&lt;p&gt;This distinction is particularly important when comparing documents generated for both human readers and automated processing systems.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. Local Processing
&lt;/h2&gt;

&lt;p&gt;PDF / XML Comparator is designed to perform its comparison locally using Python.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Local machine
      │
      ├── PDF document
      ├── XML document
      ├── Extraction and comparison
      └── Detected differences
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The documents are processed within the local environment rather than being transferred to an online comparison service.&lt;/p&gt;

&lt;p&gt;This approach is useful when working with internal documents, financial information, technical records, or other files that should not be unnecessarily shared with external services.&lt;/p&gt;

&lt;p&gt;Local processing also allows the comparison to remain independent of a remote document analysis platform.&lt;/p&gt;




&lt;h2&gt;
  
  
  9. Practical Use Cases
&lt;/h2&gt;

&lt;p&gt;A local PDF and XML comparison can be useful in several document processing workflows.&lt;/p&gt;

&lt;p&gt;Examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Comparing a generated PDF with its associated XML data&lt;/li&gt;
&lt;li&gt;Reviewing successive versions of document generation systems&lt;/li&gt;
&lt;li&gt;Checking references, amounts, and identifiers across two representations&lt;/li&gt;
&lt;li&gt;Investigating discrepancies between human-readable documents and structured records&lt;/li&gt;
&lt;li&gt;Performing an initial consistency check before further document validation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a developer working on a document generation system, the comparison can help identify unexpected changes between the data used by software and the information displayed to the user.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Structured source data
         │
         ├── Generate PDF
         │
         └── Generate XML
                  │
                  ▼
        Bidirectional comparison
                  │
                  ▼
         Review discrepancies
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This type of check can complement a broader testing workflow without requiring a complete document validation platform.&lt;/p&gt;




&lt;h2&gt;
  
  
  10. Comparison Is Not Validation
&lt;/h2&gt;

&lt;p&gt;Comparing PDF and XML content is not the same as validating either document.&lt;/p&gt;

&lt;p&gt;Several distinct operations may be involved in a complete document processing workflow.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operation&lt;/th&gt;
&lt;th&gt;Objective&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Text comparison&lt;/td&gt;
&lt;td&gt;Identify textual differences&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Value comparison&lt;/td&gt;
&lt;td&gt;Check information across representations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;XML schema validation&lt;/td&gt;
&lt;td&gt;Verify the expected XML structure&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Business rule checks&lt;/td&gt;
&lt;td&gt;Verify domain-specific requirements&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Visual inspection&lt;/td&gt;
&lt;td&gt;Review document layout and rendering&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A value appearing in both files does not establish that the XML follows a required schema.&lt;/p&gt;

&lt;p&gt;Likewise, a document can contain matching amounts while still failing a calculation rule or another business requirement.&lt;/p&gt;

&lt;p&gt;For financial documents, matching values do not automatically establish tax compliance, calculation accuracy, or conformity with an electronic invoicing standard.&lt;/p&gt;

&lt;p&gt;PDF / XML Comparator focuses on the comparison stage. It should therefore be understood as a complementary tool rather than a replacement for schema validation, business rule validation, or document compliance checks.&lt;/p&gt;




&lt;h2&gt;
  
  
  11. Limitations of the Approach
&lt;/h2&gt;

&lt;p&gt;The main limitations arise from the differences between PDF and XML.&lt;/p&gt;

&lt;p&gt;PDF text extraction may not preserve the visual reading order or the relationships between labels and values.&lt;/p&gt;

&lt;p&gt;XML, by contrast, contains an explicit hierarchy of elements, but those elements do not necessarily correspond directly to the way information is presented in a PDF.&lt;/p&gt;

&lt;p&gt;Scanned PDFs introduce another challenge because their content may exist only as images rather than as extractable text.&lt;/p&gt;

&lt;p&gt;Other limitations include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Equivalent values represented using different formats&lt;/li&gt;
&lt;li&gt;Repeated values appearing in different fields&lt;/li&gt;
&lt;li&gt;Information intentionally present in only one representation&lt;/li&gt;
&lt;li&gt;Differences between textual presence and business meaning&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These limitations explain why a bidirectional comparison is useful as an initial verification step, but cannot independently establish complete document equivalence.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;PDF / XML Comparator illustrates a focused approach to comparing two different representations of the same document using Python.&lt;/p&gt;

&lt;p&gt;By extracting information from both files and searching for values in both directions, the utility helps identify potential discrepancies between human-readable content and structured data.&lt;/p&gt;

&lt;p&gt;Its scope remains intentionally limited. It does not attempt to interpret every field, validate business rules, or establish full document compliance.&lt;/p&gt;

&lt;p&gt;The distinction between comparison and validation is central to this approach.&lt;/p&gt;

&lt;p&gt;A local comparison can help identify where further investigation is needed, while more specialized validation mechanisms determine whether the documents meet their expected structural and business requirements.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://palks-studio.com" rel="noopener noreferrer"&gt;https://palks-studio.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>xml</category>
      <category>pdf</category>
      <category>programming</category>
    </item>
    <item>
      <title>📄 Comparing PDF Files Locally with Python: Text Extraction, Normalization, and Diff Analysis</title>
      <dc:creator>Anthony Leignel</dc:creator>
      <pubDate>Wed, 12 Aug 2026 19:41:42 +0000</pubDate>
      <link>https://dev.to/palks_studio/compare-two-pdf-files-locally-with-python-43il</link>
      <guid>https://dev.to/palks_studio/compare-two-pdf-files-locally-with-python-43il</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3zhqds9qgduded8vuk03.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3zhqds9qgduded8vuk03.png" alt="PDF Comparator showing textual differences between two PDF documents in the terminal." width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Comparing two versions of a PDF does not necessarily require uploading documents to an online service.&lt;/p&gt;

&lt;p&gt;For internal documentation, reports, invoices, technical specifications, or administrative documents, local processing can provide a straightforward way to identify changes without transferring sensitive files to a third party.&lt;/p&gt;

&lt;p&gt;PDF Comparator is a lightweight Python utility designed to compare the textual content of two PDF files directly on a local machine.&lt;/p&gt;

&lt;p&gt;The tool focuses on a specific task: extracting text, normalizing it, and identifying differences between two document versions.&lt;/p&gt;

&lt;p&gt;It requires Python 3 and &lt;code&gt;pypdf&lt;/code&gt;, with no external API, remote processing, or AI dependency.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. How PDF Text Comparison Works
&lt;/h2&gt;

&lt;p&gt;A PDF is not structured like a conventional text document. Its primary purpose is to describe how content should appear on a page.&lt;/p&gt;

&lt;p&gt;Before comparing two PDFs, their textual content must therefore be extracted and converted into a representation suitable for comparison.&lt;/p&gt;

&lt;p&gt;PDF Comparator follows a simple processing pipeline:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PDF A                     PDF B
  │                         │
  ▼                         ▼
Text extraction         Text extraction
  │                         │
  ▼                         ▼
Normalization           Normalization
  │                         │
  └────────────┬────────────┘
               │
               ▼
        Text comparison
               │
               ▼
        Detected differences
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first PDF is treated as the reference version, while the second represents the new version.&lt;/p&gt;

&lt;p&gt;Text is extracted from all pages of both documents before being normalized and compared.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Text Extraction with pypdf
&lt;/h2&gt;

&lt;p&gt;The utility relies on &lt;code&gt;pypdf&lt;/code&gt; to read PDF documents and extract their textual content.&lt;/p&gt;

&lt;p&gt;This extraction step makes it possible to compare the text contained in two documents without analyzing their graphical rendering.&lt;/p&gt;

&lt;p&gt;A typical extraction workflow can be represented as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PDF document
     │
     ▼
Read pages
     │
     ▼
Extract available text
     │
     ▼
Combine extracted content
     │
     ▼
Text ready for comparison
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The quality of the extracted content depends on how the original PDF was generated.&lt;/p&gt;

&lt;p&gt;A PDF containing a properly defined text layer can generally be processed directly. A scanned document containing only images, however, does not provide the same textual information.&lt;/p&gt;

&lt;p&gt;Such documents require optical character recognition (OCR) before a reliable textual comparison can be performed.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Lightweight Text Normalization
&lt;/h2&gt;

&lt;p&gt;Two PDF documents can contain visually identical text while producing slightly different extracted content.&lt;/p&gt;

&lt;p&gt;Differences in whitespace, line breaks, or text positioning may influence the extraction result.&lt;/p&gt;

&lt;p&gt;PDF Comparator applies lightweight normalization before comparing the documents.&lt;/p&gt;

&lt;p&gt;The purpose of this step is to reduce unnecessary differences in the extracted text while preserving meaningful content changes.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Document A:

Invoice number: 2026-001

Document B:

Invoice number:  2026-001
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These two lines contain the same information, despite a difference in spacing.&lt;/p&gt;

&lt;p&gt;Normalization can help reduce this type of variation.&lt;/p&gt;

&lt;p&gt;However, normalization must remain limited. Removing too much information could conceal changes that are relevant to the document being compared.&lt;/p&gt;

&lt;p&gt;The objective is not to interpret or rewrite the document, but to prepare its extracted text for comparison.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Detecting Added and Removed Lines
&lt;/h2&gt;

&lt;p&gt;Once both documents have been processed, their textual content is compared to identify differences.&lt;/p&gt;

&lt;p&gt;The result follows a line-based diff representation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;&lt;span class="gd"&gt;--- old.pdf&lt;/span&gt;
&lt;span class="gi"&gt;+++ new.pdf&lt;/span&gt;

&lt;span class="gd"&gt;-Address: 12 Example Street&lt;/span&gt;
&lt;span class="gi"&gt;+Address: 24 Example Street&lt;/span&gt;

&lt;span class="gd"&gt;-Total: €1,200&lt;/span&gt;
&lt;span class="gi"&gt;+Total: €1,350&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each prefix has a specific meaning:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Prefix&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;---&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Reference document&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;+++&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;New document&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Line removed from the reference&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;+&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Line added in the new document&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A modified line is represented as a removed line followed by an added line.&lt;/p&gt;

&lt;p&gt;In this example, two changes are immediately visible: the address and the total amount.&lt;/p&gt;

&lt;p&gt;The utility does not attempt to determine whether these changes are correct. It simply identifies differences in the extracted textual content.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Running the Comparison
&lt;/h2&gt;

&lt;p&gt;The utility requires Python 3 and the &lt;code&gt;pypdf&lt;/code&gt; library.&lt;/p&gt;

&lt;p&gt;The dependency can be installed with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python -m pip install pypdf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The comparison is then executed by passing the two PDF files to the Python script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python pdf-compare.py old.pdf new.pdf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The arguments define the comparison order:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Argument&lt;/th&gt;
&lt;th&gt;Role&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;old.pdf&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Reference document&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;new.pdf&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;New document&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If textual differences are detected, they are displayed directly in the terminal.&lt;/p&gt;

&lt;p&gt;If no textual difference is found, the utility reports that no difference was detected.&lt;/p&gt;

&lt;p&gt;Importantly, this means that no difference was found in the extracted and normalized text. It does not necessarily mean that the two PDF files are identical at the binary or visual level.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Textual Comparison vs. Visual Comparison
&lt;/h2&gt;

&lt;p&gt;PDF comparison can refer to several different operations.&lt;/p&gt;

&lt;p&gt;A textual comparison identifies changes in extracted text, while a visual comparison examines how documents are rendered.&lt;/p&gt;

&lt;p&gt;PDF Comparator is deliberately limited to textual comparison.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Comparison type&lt;/th&gt;
&lt;th&gt;Supported&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Added text&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Removed text&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Modified text&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Images&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fonts&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Colors&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Graphical layout&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Visual rendering&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For example, changing an invoice total from &lt;code&gt;1200&lt;/code&gt; to &lt;code&gt;1350&lt;/code&gt; produces a textual difference.&lt;/p&gt;

&lt;p&gt;Changing the font or moving the same text to another position on the page may not produce a meaningful textual difference.&lt;/p&gt;

&lt;p&gt;Similarly, two PDFs may appear identical when displayed but contain different internal representations of their text.&lt;/p&gt;

&lt;p&gt;These distinctions are important when choosing the appropriate comparison method.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Practical Use Cases
&lt;/h2&gt;

&lt;p&gt;A local PDF comparison utility can be useful when reviewing successive versions of documents such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Technical documentation&lt;/li&gt;
&lt;li&gt;Reports and specifications&lt;/li&gt;
&lt;li&gt;Invoices&lt;/li&gt;
&lt;li&gt;Administrative documents&lt;/li&gt;
&lt;li&gt;Generated PDFs&lt;/li&gt;
&lt;li&gt;Archived documents&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It can also support development workflows involving automated PDF generation.&lt;/p&gt;

&lt;p&gt;For example, after modifying a document generation system, a developer may want to compare two generated outputs to determine whether their textual content has changed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Previous PDF output
         │
         ▼
     Comparison
         ▲
         │
Updated PDF output
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This can provide a quick way to identify unexpected changes in generated content.&lt;/p&gt;

&lt;p&gt;However, textual comparison alone does not replace visual inspection or functional testing when document layout and formatting are also important.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. Local Processing and Document Privacy
&lt;/h2&gt;

&lt;p&gt;The utility processes both PDF files directly on the local machine.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Local machine
      │
      ├── Reference PDF
      ├── New PDF
      ├── Python script
      └── Comparison output
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No document upload or remote processing is required.&lt;/p&gt;

&lt;p&gt;The comparison does not depend on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An external API&lt;/li&gt;
&lt;li&gt;A remote server&lt;/li&gt;
&lt;li&gt;A user account&lt;/li&gt;
&lt;li&gt;An AI model&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once Python and the required dependency are installed, the comparison can be performed offline.&lt;/p&gt;

&lt;p&gt;For documents containing confidential or internal information, this architecture avoids an unnecessary transfer to an external service.&lt;/p&gt;

&lt;p&gt;Local processing does not eliminate every security concern, but it keeps the comparison workflow within the user's own environment.&lt;/p&gt;




&lt;h2&gt;
  
  
  9. Limitations of Text Extraction
&lt;/h2&gt;

&lt;p&gt;The main limitation of this approach comes from the PDF format itself.&lt;/p&gt;

&lt;p&gt;Text extraction does not always reproduce the reading order that a person sees on the page.&lt;/p&gt;

&lt;p&gt;Documents containing multiple columns, complex tables, or unusual text positioning may produce extracted text in an unexpected order.&lt;/p&gt;

&lt;p&gt;Scanned documents introduce another limitation: without an existing text layer, there may be little or no text available for comparison.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Document characteristic&lt;/th&gt;
&lt;th&gt;Potential limitation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Standard text layer&lt;/td&gt;
&lt;td&gt;Suitable for text extraction&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Multiple columns&lt;/td&gt;
&lt;td&gt;Reading order may differ&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Complex tables&lt;/td&gt;
&lt;td&gt;Structure may be lost&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Scanned pages&lt;/td&gt;
&lt;td&gt;OCR may be required&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Graphical content&lt;/td&gt;
&lt;td&gt;Not included in text analysis&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These limitations do not necessarily indicate a problem with the comparison itself. They reflect the difference between extracting textual content and reconstructing the visual or logical structure of a PDF.&lt;/p&gt;

&lt;p&gt;A textual diff should therefore be interpreted in the context of the documents being compared.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;PDF Comparator illustrates a focused approach to document comparison using Python and &lt;code&gt;pypdf&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;By separating text extraction, normalization, and comparison, the utility provides a straightforward way to identify changes between two PDF versions without relying on remote processing.&lt;/p&gt;

&lt;p&gt;Its scope remains intentionally limited: it detects textual differences rather than visual changes or the meaning of those changes.&lt;/p&gt;

&lt;p&gt;For development workflows, document reviews, and internal files, this distinction makes the tool useful without introducing unnecessary complexity.&lt;/p&gt;

&lt;p&gt;Two PDF files, local text extraction, and a readable representation of their differences.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://palks-studio.com" rel="noopener noreferrer"&gt;https://palks-studio.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>pdf</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
    <item>
      <title>🛠️ Local VS Code Environment Architecture: Python Scripts, Explicit Tasks, and Controlled Code Changes</title>
      <dc:creator>Anthony Leignel</dc:creator>
      <pubDate>Wed, 01 Jul 2026 17:27:54 +0000</pubDate>
      <link>https://dev.to/palks_studio/i-built-a-local-vs-code-environment-that-saves-me-hours-on-every-project-lpc</link>
      <guid>https://dev.to/palks_studio/i-built-a-local-vs-code-environment-that-saves-me-hours-on-every-project-lpc</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0tuju5l9nxx224fkdqef.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0tuju5l9nxx224fkdqef.png" alt="Before and after comparison showing automatic code reindentation and whitespace cleanup applied to the same source file." width="800" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A development environment is more than a code editor. It also includes formatters, maintenance tools, backup mechanisms, language-specific settings, and various forms of automation.&lt;/p&gt;

&lt;p&gt;As these components accumulate, it can become difficult to determine which tool modifies a file, when it happens, and which rules are applied.&lt;/p&gt;

&lt;p&gt;A modification may originate from a formatter, an extension, an action triggered on save, or a project-specific setting.&lt;/p&gt;

&lt;p&gt;VS Code Environment Pack, developed by Palks Studio, follows a different approach: organizing the development environment around independent Python scripts, explicitly triggered tasks, and project-local configuration.&lt;/p&gt;

&lt;p&gt;The objective is not to replace existing tools, but to define their responsibilities, their execution scope, and the conditions under which they can modify code.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. General Architecture
&lt;/h2&gt;

&lt;p&gt;The system relies on three main layers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A configuration layer specific to Visual Studio Code&lt;/li&gt;
&lt;li&gt;An execution layer based on VS Code tasks and Python scripts&lt;/li&gt;
&lt;li&gt;A local storage layer for backups and generated files&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Version 1.2 presents the following structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vscode_pack_environnement_v1.2/
│
├── .vscode/
│   ├── extensions.json
│   ├── launch.json
│   ├── settings.json
│   ├── keybindings.json
│   └── tasks.json
│
├── clean.py
├── convert.py
├── space.py
├── backup.py
├── create.py
├── tree.py
│
├── LICENCE.md
│
└── docs/
    ├── README_COMMERCIAL.md
    ├── README_TECHNIQUE.md
    ├── INSTALL.md
    └── exemples/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each configuration file operates at a different level.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;Primary responsibility&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;settings.json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Editor behavior and configuration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;tasks.json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Definition of executable tasks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;launch.json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Running and debugging the active Python file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;keybindings.json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Mapping actions to keyboard shortcuts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;extensions.json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Extension recommendations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Python scripts&lt;/td&gt;
&lt;td&gt;Execution of technical operations&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The architecture separates editor behavior from maintenance operations applied to files.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Visual Studio Code
        │
        ├── Editor configuration
        ├── Keyboard shortcuts
        └── User tasks
                  │
                  ▼
            Python scripts
                  │
                  ├── Analysis
                  ├── Cleaning
                  ├── Conversion
                  ├── Generation
                  └── Backup
                  │
                  ▼
              Local files
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The scripts can also be executed directly from a terminal.&lt;/p&gt;

&lt;p&gt;This separation allows a significant portion of the functionality to remain independent of Visual Studio Code.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Local Configuration and Predictable Behavior
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;.vscode/settings.json&lt;/code&gt; file defines workspace-specific settings.&lt;/p&gt;

&lt;p&gt;This configuration makes it possible to share common conventions across multiple projects or developers without necessarily modifying the editor's global settings.&lt;/p&gt;

&lt;p&gt;The main documented conventions are as follows:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Setting&lt;/th&gt;
&lt;th&gt;Configuration&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Indentation&lt;/td&gt;
&lt;td&gt;4 spaces&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reference line width&lt;/td&gt;
&lt;td&gt;100 characters&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Encoding&lt;/td&gt;
&lt;td&gt;UTF-8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Line endings&lt;/td&gt;
&lt;td&gt;LF&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Format on save&lt;/td&gt;
&lt;td&gt;Disabled&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Automatic saving&lt;/td&gt;
&lt;td&gt;Disabled&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Visual word wrapping&lt;/td&gt;
&lt;td&gt;Enabled&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The following educational configuration example illustrates this approach:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"editor.formatOnSave"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"editor.tabSize"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"editor.insertSpaces"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"editor.detectIndentation"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"editor.wordWrap"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"on"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"editor.rulers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"files.encoding"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"utf8"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"files.eol"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"\n"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"files.autoSave"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"off"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;editor.detectIndentation&lt;/code&gt; setting is presented here as an option for enforcing a fixed indentation convention rather than allowing the editor to detect the indentation of an existing file.&lt;/p&gt;

&lt;p&gt;This example illustrates the configuration principles. It does not reproduce the complete configuration file provided with the pack.&lt;/p&gt;

&lt;h3&gt;
  
  
  Disabling Automatic Formatting
&lt;/h3&gt;

&lt;p&gt;The central setting is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"editor.formatOnSave"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It prevents the standard formatting operation from being triggered when a file is saved.&lt;/p&gt;

&lt;p&gt;However, this does not mean that every automatic modification is disabled.&lt;/p&gt;

&lt;p&gt;Other settings may still apply, including:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"files.trimTrailingWhitespace"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"files.insertFinalNewline"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These native editor operations remove trailing whitespace and insert a final newline when necessary.&lt;/p&gt;

&lt;p&gt;The pack therefore distinguishes full-file formatting from basic operations performed by the editor.&lt;/p&gt;

&lt;p&gt;This distinction is important for understanding exactly what happens when a file is saved.&lt;/p&gt;

&lt;h3&gt;
  
  
  Limitations of Workspace Configuration
&lt;/h3&gt;

&lt;p&gt;Workspace settings do not provide complete isolation.&lt;/p&gt;

&lt;p&gt;Language-specific settings, active extensions, and additional configurations can influence the editor's effective behavior.&lt;/p&gt;

&lt;p&gt;For example, disabling &lt;code&gt;editor.formatOnSave&lt;/code&gt; does not automatically disable every action defined in &lt;code&gt;editor.codeActionsOnSave&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A predictable configuration therefore also requires reviewing save actions, active extensions, and potential language-specific overrides.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. VS Code Tasks as an Orchestration Layer
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;tasks.json&lt;/code&gt; file allows commands to be executed directly from Visual Studio Code.&lt;/p&gt;

&lt;p&gt;In this architecture, tasks act as an intermediary between the editor and the Python scripts.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User action
     │
     ▼
 tasks.json
     │
     ▼
Python command
     │
     ▼
Maintenance script
     │
     ▼
Analysis or modification
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The user does not need to memorize every command or manually navigate between directories.&lt;/p&gt;

&lt;p&gt;The task defines the program to execute, its arguments, and its working directory.&lt;/p&gt;

&lt;p&gt;The pack already provides configured tasks for its maintenance tools. These operations are accessible directly from:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Terminal → Run Task…
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The user selects the required operation and execution scope without having to enter commands manually.&lt;/p&gt;

&lt;p&gt;The following educational example illustrates how a task can execute the &lt;code&gt;space.py&lt;/code&gt; analysis script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2.0.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"tasks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nl"&gt;"label"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Analyze whitespace"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"process"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"python"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s2"&gt;"${workspaceFolder}/space.py"&lt;/span&gt;
            &lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;"options"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="nl"&gt;"cwd"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"${workspaceFolder}"&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;"problemMatcher"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;${workspaceFolder}&lt;/code&gt; variable constructs the script path from the folder opened in Visual Studio Code.&lt;/p&gt;

&lt;p&gt;The working directory is also defined explicitly.&lt;/p&gt;

&lt;p&gt;This example uses a &lt;code&gt;process&lt;/code&gt; task, which passes arguments directly to the executable without relying on a shell to interpret an entire command string.&lt;/p&gt;

&lt;p&gt;The Python executable must correspond to the environment being used. Depending on the operating system, it may be necessary to use &lt;code&gt;python3&lt;/code&gt;, a virtual environment, or an explicit interpreter path.&lt;/p&gt;

&lt;p&gt;The example illustrates the underlying integration mechanism. The tasks themselves are already configured in the pack.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Three Execution Scopes
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;clean.py&lt;/code&gt;, &lt;code&gt;convert.py&lt;/code&gt;, and &lt;code&gt;space.py&lt;/code&gt; scripts support three execution modes.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Mode&lt;/th&gt;
&lt;th&gt;Scope&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Global&lt;/td&gt;
&lt;td&gt;Supported files across the project&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Active file&lt;/td&gt;
&lt;td&gt;File currently open in the editor&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Custom selection&lt;/td&gt;
&lt;td&gt;Manually defined list of files&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This organization separates the nature of an operation from its execution scope.&lt;/p&gt;

&lt;p&gt;The same tool can analyze an entire project or operate on a single file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Maintenance script
        │
        ├── Global mode
        │       └── Project
        │
        ├── Active file mode
        │       └── Open file
        │
        └── Custom mode
                └── Selected files
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Custom mode relies on a selection defined in &lt;code&gt;tasks.json&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The different modes are accessible through the VS Code task interface, allowing users to choose the appropriate scope before execution.&lt;/p&gt;

&lt;h3&gt;
  
  
  Active File Execution Example
&lt;/h3&gt;

&lt;p&gt;Visual Studio Code provides the &lt;code&gt;${file}&lt;/code&gt; variable, which represents the path of the active file.&lt;/p&gt;

&lt;p&gt;A task can pass this value to a Python script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"label"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Clean active file"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"process"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"python"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s2"&gt;"${workspaceFolder}/clean.py"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"${file}"&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"options"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"cwd"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"${workspaceFolder}"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"problemMatcher"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example illustrates how a target file can be passed to a Python script. The exact arguments depend on the interface implemented by the script.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Limit the Execution Scope?
&lt;/h3&gt;

&lt;p&gt;A cleaning operation may be straightforward when it affects a single file.&lt;/p&gt;

&lt;p&gt;Applied to hundreds of files, however, it can produce a large number of modifications, complicate Git reviews, and introduce changes in files that were not intended to be affected.&lt;/p&gt;

&lt;p&gt;Execution scope therefore becomes an important aspect of operational safety.&lt;/p&gt;

&lt;p&gt;A maintenance tool must be able to determine:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which files are allowed&lt;/li&gt;
&lt;li&gt;Which directories must be excluded&lt;/li&gt;
&lt;li&gt;Which file extensions are supported&lt;/li&gt;
&lt;li&gt;Whether the operation actually requires writing to a file&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Global execution should remain an explicit decision rather than an unintended consequence of launching a script.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Separating Analysis from Modification
&lt;/h2&gt;

&lt;p&gt;One of the important distinctions within the pack concerns the &lt;code&gt;space.py&lt;/code&gt; and &lt;code&gt;clean.py&lt;/code&gt; scripts.&lt;/p&gt;

&lt;p&gt;The first analyzes files. The second can modify them.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Script&lt;/th&gt;
&lt;th&gt;Primary function&lt;/th&gt;
&lt;th&gt;Modifies files&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;space.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Detect formatting issues&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;clean.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Clean whitespace&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This separation makes it possible to identify issues before deciding whether to apply corrections.&lt;/p&gt;

&lt;h3&gt;
  
  
  Analysis with &lt;code&gt;space.py&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The script detects several types of formatting issues, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Multiple spaces&lt;/li&gt;
&lt;li&gt;Tabs&lt;/li&gt;
&lt;li&gt;Trailing whitespace&lt;/li&gt;
&lt;li&gt;Excessive consecutive blank lines&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The analysis tasks are already available from the VS Code task menu.&lt;/p&gt;

&lt;p&gt;The script can also be executed independently from a terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python space.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The following educational example illustrates how trailing whitespace can be detected:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pathlib&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;analyze_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="n"&gt;content&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;encoding&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"utf-8"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;issues&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;enumerate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;splitlines&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;endswith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;" "&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"\t"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

            &lt;span class="n"&gt;issues&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="s2"&gt;"line"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s2"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"trailing_whitespace"&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;issues&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"line"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"trailing_whitespace"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"line"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;28&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"trailing_whitespace"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This function reads a file and returns detected issues without performing any write operation.&lt;/p&gt;

&lt;p&gt;It illustrates the principle of a read-only analyzer without reproducing the exact implementation of &lt;code&gt;space.py&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Analysis and Correction Are Not Equivalent
&lt;/h3&gt;

&lt;p&gt;The presence of multiple spaces does not necessarily mean that a file requires correction.&lt;/p&gt;

&lt;p&gt;In some cases, whitespace is part of the structure or content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Name:    Example"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In other cases, it may be used for intentional alignment.&lt;/p&gt;

&lt;p&gt;An analyzer can report a situation without automatically concluding that it represents an error.&lt;/p&gt;

&lt;p&gt;This distinction prevents a formatting convention from becoming a systematic modification of file content.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. File Cleaning with &lt;code&gt;clean.py&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;clean.py&lt;/code&gt; script operates on file types supported by the system:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.html
.css
.js
.json
.py
.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Its responsibilities include removing unnecessary spaces and tabs, and limiting sequences of blank lines to two consecutive lines.&lt;/p&gt;

&lt;p&gt;The pack provides dedicated cleaning tasks for the entire project, the active file, or a custom selection.&lt;/p&gt;

&lt;p&gt;These tasks can be launched directly from:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Terminal → Run Task…
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The script also remains available for independent execution:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python clean.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Transforming Content Before Writing
&lt;/h3&gt;

&lt;p&gt;A cleaning architecture can separate three operations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Read file
    │
    ▼
Transform content
    │
    ▼
Compare original and transformed content
    │
    ├── No changes → no write
    │
    └── Changes detected → write file
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This separation makes it possible to test transformations independently of filesystem operations.&lt;/p&gt;

&lt;p&gt;The following educational example illustrates the removal of trailing whitespace while preserving line endings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;clean_trailing_whitespace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;splitlines&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;keepends&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

        &lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rstrip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"\r\n"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="n"&gt;ending&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

        &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rstrip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;" \t"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;ending&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A separate writing function can compare the original content with the transformed content before modifying the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pathlib&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;update_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;original&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_bytes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;updated&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;original&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;updated&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;original&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;

    &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write_bytes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;updated&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This second function expects a transformation operating on bytes. A text-based transformation therefore requires an explicit decoding and encoding step.&lt;/p&gt;

&lt;p&gt;These examples illustrate the separation between transformation and writing. They do not reproduce the source code of &lt;code&gt;clean.py&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Preserving Code Semantics
&lt;/h3&gt;

&lt;p&gt;Cleaning source files requires more care than cleaning ordinary text documents.&lt;/p&gt;

&lt;p&gt;In Python, indentation is part of the program's structure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;authorized&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;process_request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Incorrectly modifying this indentation can change program behavior or make the file invalid.&lt;/p&gt;

&lt;p&gt;Whitespace can also be meaningful in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python multiline strings&lt;/li&gt;
&lt;li&gt;JavaScript strings&lt;/li&gt;
&lt;li&gt;HTML &lt;code&gt;&amp;lt;pre&amp;gt;&lt;/code&gt; elements&lt;/li&gt;
&lt;li&gt;Markdown documents&lt;/li&gt;
&lt;li&gt;Strings stored in JSON files&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A generic cleaning tool must therefore consider the formats being processed and the contexts in which whitespace is significant.&lt;/p&gt;

&lt;p&gt;A rule applied to every line of a file is not automatically safe for every programming language.&lt;/p&gt;

&lt;p&gt;Cleaning should remain a controlled operation, accompanied by a review of modifications when necessary.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Python Formatting and Reindentation
&lt;/h2&gt;

&lt;p&gt;The pack provides a dedicated Python formatting task combining &lt;code&gt;autopep8&lt;/code&gt; and &lt;code&gt;clean.py&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;These tools address two different requirements.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;Responsibility&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;autopep8&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Formatting according to PEP 8 rules&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;clean.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Additional whitespace cleaning&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Python formatting is manually triggered on the active file.&lt;/p&gt;

&lt;p&gt;The workflow can be represented as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Active Python file
        │
        ▼
     autopep8
        │
        ▼
      clean.py
        │
        ▼
   Processed file
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Execution Through VS Code Tasks
&lt;/h3&gt;

&lt;p&gt;The pack includes a dedicated task for formatting and cleaning the active Python file.&lt;/p&gt;

&lt;p&gt;This task is directly accessible from:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Terminal → Run Task…
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The required commands are already configured in &lt;code&gt;tasks.json&lt;/code&gt;. The user simply selects the Python formatting task without having to enter a command in the terminal.&lt;/p&gt;

&lt;p&gt;Behind the scenes, the formatting operation relies on a command such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python -m autopep8 --in-place app.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The target file is automatically determined from the active file in the editor. The &lt;code&gt;clean.py&lt;/code&gt; script then performs the additional cleaning operation.&lt;/p&gt;

&lt;p&gt;This integration makes command-line tools accessible directly from VS Code while preserving manual execution and a clearly defined scope.&lt;/p&gt;

&lt;p&gt;The task requires &lt;code&gt;autopep8&lt;/code&gt; to be installed in the selected Python environment.&lt;/p&gt;

&lt;h3&gt;
  
  
  Formatting and Syntax Correction
&lt;/h3&gt;

&lt;p&gt;A formatter cannot always determine the developer's intention when a file contains an inconsistent structure.&lt;/p&gt;

&lt;p&gt;Consider the following example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;process_order&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;validate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Several corrections are possible depending on the intended behavior.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;process_order&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;validate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;process_order&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;validate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both versions can be syntactically valid, but they do not produce the same behavior.&lt;/p&gt;

&lt;p&gt;In the first version, saving depends on the condition. In the second, it occurs independently of that condition.&lt;/p&gt;

&lt;p&gt;Correcting invalid indentation may therefore require a business logic decision.&lt;/p&gt;

&lt;p&gt;A formatter cannot replace that decision.&lt;/p&gt;

&lt;h3&gt;
  
  
  Checking Syntax Before and After
&lt;/h3&gt;

&lt;p&gt;Syntax validation can complement a formatting operation.&lt;/p&gt;

&lt;p&gt;Python provides the &lt;code&gt;ast&lt;/code&gt; module for analyzing source code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ast&lt;/span&gt;

&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pathlib&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;validate_python&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="n"&gt;source&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;encoding&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"utf-8"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;ast&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This function verifies that the source can be parsed successfully.&lt;/p&gt;

&lt;p&gt;Comparing abstract syntax trees before and after a transformation can also provide an additional safeguard for certain types of formatting.&lt;/p&gt;

&lt;p&gt;However, it does not replace functional testing and cannot independently guarantee that behavior remains unchanged.&lt;/p&gt;

&lt;p&gt;These checks represent possible additional safeguards rather than confirmed features of the current pack.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. Line Ending Normalization with &lt;code&gt;convert.py&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Line endings are a common source of differences between development environments.&lt;/p&gt;

&lt;p&gt;Two representations are particularly widespread.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Format&lt;/th&gt;
&lt;th&gt;Sequence&lt;/th&gt;
&lt;th&gt;Historical environment&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;CRLF&lt;/td&gt;
&lt;td&gt;&lt;code&gt;\r\n&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Windows&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LF&lt;/td&gt;
&lt;td&gt;&lt;code&gt;\n&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Unix, Linux, macOS&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The same file can appear identical visually while containing different byte sequences.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CRLF : 0D 0A
LF   : 0A
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These differences can produce extensive Git changes, compatibility issues with certain scripts, or inconsistencies between operating systems.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;convert.py&lt;/code&gt; script normalizes CRLF line endings to LF.&lt;/p&gt;

&lt;p&gt;The corresponding conversion tasks are available directly through the VS Code task menu, with the same three execution scopes.&lt;/p&gt;

&lt;p&gt;The script can also be executed independently:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python convert.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The documentation specifies that the script writes to a file only when conversion is necessary.&lt;/p&gt;

&lt;h3&gt;
  
  
  Byte-Level Conversion Example
&lt;/h3&gt;

&lt;p&gt;An educational implementation can operate directly on the binary content of a file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pathlib&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;convert_to_lf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;original&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_bytes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;updated&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;original&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="s2"&gt;"\r\n"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="s2"&gt;"\n"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;updated&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;original&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;

    &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write_bytes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;updated&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This approach avoids implicit line ending conversion through Python's text mode.&lt;/p&gt;

&lt;p&gt;It also preserves the remaining bytes of the file.&lt;/p&gt;

&lt;p&gt;However, the function must be limited to supported text files. Applying this replacement to binary files could corrupt their content.&lt;/p&gt;

&lt;p&gt;Files using different encodings, particularly UTF-16, also require an appropriate strategy.&lt;/p&gt;

&lt;h3&gt;
  
  
  An Idempotent Operation
&lt;/h3&gt;

&lt;p&gt;CRLF-to-LF conversion has an interesting property: idempotence.&lt;/p&gt;

&lt;p&gt;An operation is idempotent when repeating it produces no additional changes after the first successful execution.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;First execution:

CRLF → LF

Second execution:

LF → LF
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This property is particularly useful for maintenance scripts.&lt;/p&gt;

&lt;p&gt;It allows an operation to be repeated without generating unnecessary additional modifications.&lt;/p&gt;

&lt;h3&gt;
  
  
  Editor Configuration and Existing Files
&lt;/h3&gt;

&lt;p&gt;The following setting defines the editor's line ending convention:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"files.eol"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"\n"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It does not necessarily replace a normalization operation across existing project files.&lt;/p&gt;

&lt;p&gt;In a collaborative project using Git, a &lt;code&gt;.gitattributes&lt;/code&gt; file can also define normalization rules:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* text=auto

*.py   text eol=lf
*.html text eol=lf
*.css  text eol=lf
*.js   text eol=lf
*.json text eol=lf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This configuration represents a possible complement to the pack, extending the convention to the Git repository level.&lt;/p&gt;




&lt;h2&gt;
  
  
  9. Project Structure Generation with &lt;code&gt;create.py&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Version 1.2 introduces a script for automatically generating a directory structure from a &lt;code&gt;structure.txt&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;The principle is to describe a project's structure before creating it on the filesystem.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my_project
    README.md
    app
        app.py
    static
        css
            style.css
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The expected result is a directory structure such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my_project/
├── README.md
├── app/
│   └── app.py
└── static/
    └── css/
        └── style.css
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This approach separates the project description from its actual creation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;structure.txt
      │
      ▼
Parse structure
      │
      ▼
Resolve paths
      │
      ▼
Create directories
      │
      ▼
Create files
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;structure.txt&lt;/code&gt; file becomes a reusable representation of the project's initial architecture.&lt;/p&gt;

&lt;p&gt;The pack provides a configured VS Code task that executes &lt;code&gt;create.py&lt;/code&gt;. Once the structure has been defined, the user can generate the hierarchy directly from the task menu without manually entering Python commands.&lt;/p&gt;

&lt;h3&gt;
  
  
  A Declarative Structure
&lt;/h3&gt;

&lt;p&gt;This approach defines what should exist rather than requiring every creation operation to be repeated manually.&lt;/p&gt;

&lt;p&gt;An educational example using an explicit Python representation could be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pathlib&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;


&lt;span class="n"&gt;structure&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"app"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"directory"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"app/app.py"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"file"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"static/css"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"directory"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"static/css/style.css"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"file"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"README.md"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"file"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;create_structure&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;entries&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="n"&gt;root&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;relative_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;entry_type&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;entries&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

        &lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;root&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;relative_path&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;entry_type&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"directory"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

            &lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mkdir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="n"&gt;parents&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;exist_ok&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;
            &lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;entry_type&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"file"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

            &lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;parent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mkdir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="n"&gt;parents&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;exist_ok&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;
            &lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;touch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example represents a possible stage after parsing the &lt;code&gt;structure.txt&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;It does not reproduce the exact parsing and interpretation mechanism implemented by &lt;code&gt;create.py&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Path Safety and Protection of Existing Files
&lt;/h3&gt;

&lt;p&gt;Automatic file generation introduces several constraints.&lt;/p&gt;

&lt;p&gt;An incorrectly defined structure may contain an absolute path, a reference to a parent directory, or a destination outside the project.&lt;/p&gt;

&lt;p&gt;A robust architecture must verify that generated paths remain within the authorized directory.&lt;/p&gt;

&lt;p&gt;It must also define what happens when a file already exists.&lt;/p&gt;

&lt;p&gt;Overwriting an existing source file when regenerating a project structure could result in data loss.&lt;/p&gt;

&lt;p&gt;Conditional file creation, illustrated in the previous example, provides an initial safeguard. Additional checks are still necessary for untrusted paths and concurrent access.&lt;/p&gt;

&lt;p&gt;The purpose of this type of tool is to prepare a structure, not silently replace an existing project.&lt;/p&gt;




&lt;h2&gt;
  
  
  10. Architecture Documentation with &lt;code&gt;tree.py&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Understanding a project often begins with identifying its components and how they are organized.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;tree.py&lt;/code&gt; script automatically generates a file named:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PROJECT_TREE.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This file represents the existing project structure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my_project/
├── app/
│   ├── app.py
│   └── controllers/
├── static/
│   ├── css/
│   └── js/
├── README.md
└── requirements.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Automatic generation provides a representation of the project's state at the time of execution.&lt;/p&gt;

&lt;p&gt;It avoids manually maintaining a file listing that can quickly become outdated.&lt;/p&gt;

&lt;p&gt;The corresponding VS Code task is already configured in the pack. A single execution generates the documentation file directly from the current project.&lt;/p&gt;

&lt;h3&gt;
  
  
  Recursive Directory Traversal
&lt;/h3&gt;

&lt;p&gt;Python provides several mechanisms for traversing a directory hierarchy, including &lt;code&gt;pathlib&lt;/code&gt; and &lt;code&gt;os.walk()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;An educational example can be constructed using &lt;code&gt;pathlib&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pathlib&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;generate_tree&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;prefix&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;entries&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;iterdir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;is_dir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;lines&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;entry&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;enumerate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;entries&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

        &lt;span class="n"&gt;last&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;entries&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;

        &lt;span class="n"&gt;branch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"└── "&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="s2"&gt;"├── "&lt;/span&gt;

        &lt;span class="n"&gt;lines&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;prefix&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;branch&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;is_dir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;is_symlink&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

            &lt;span class="n"&gt;extension&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="s2"&gt;"    "&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="s2"&gt;"│   "&lt;/span&gt;
            &lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="n"&gt;lines&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;extend&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="nf"&gt;generate_tree&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                    &lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="n"&gt;prefix&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;extension&lt;/span&gt;
                &lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;lines&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result can then be written to a text file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;root&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"my_project"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;lines&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;lines&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;extend&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;generate_tree&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"PROJECT_TREE.txt"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write_text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s2"&gt;"\n"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lines&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;"\n"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;encoding&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"utf-8"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example illustrates recursive traversal with sorted entries and a visual representation of the directory hierarchy.&lt;/p&gt;

&lt;p&gt;It avoids following symbolic links to directories, reducing the risk of unexpected recursive traversal.&lt;/p&gt;

&lt;h3&gt;
  
  
  Defining the Documentation Scope
&lt;/h3&gt;

&lt;p&gt;A complete directory tree can become difficult to use when it contains thousands of generated files or dependencies.&lt;/p&gt;

&lt;p&gt;A documentation strategy may exclude certain directories:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.git/
node_modules/
__pycache__/
.venv/
.backups/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These exclusions represent a possible approach to producing a more readable structure.&lt;/p&gt;

&lt;p&gt;The public documentation does not specify the exact exclusion list applied by &lt;code&gt;tree.py&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Project structure documentation must also be distinguished from publication of project content.&lt;/p&gt;

&lt;p&gt;Even without displaying file contents, a directory tree can reveal configuration names, internal paths, or the organization of sensitive components.&lt;/p&gt;

&lt;p&gt;A review is therefore necessary before sharing a &lt;code&gt;PROJECT_TREE.txt&lt;/code&gt; file publicly.&lt;/p&gt;




&lt;h2&gt;
  
  
  11. Timestamped Local Backups with &lt;code&gt;backup.py&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Version 1.2 introduces a local backup system integrated into the development workflow.&lt;/p&gt;

&lt;p&gt;The documentation describes a backup triggered when a file is saved through a VS Code task named Auto-Backup.&lt;/p&gt;

&lt;p&gt;Copies are stored in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.backups/filename/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each backup is timestamped.&lt;/p&gt;

&lt;p&gt;A possible organization is illustrated below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.backups/
└── app.py/
    ├── app_20260701_142501.py
    ├── app_20260701_143212.py
    └── app_20260701_144037.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These filenames illustrate the timestamping principle. They do not necessarily reproduce the exact naming convention used by &lt;code&gt;backup.py&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Saving and Backing Up Files
&lt;/h3&gt;

&lt;p&gt;The system distinguishes the working file from its successive copies.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Working file
      │
      ▼
Save with Ctrl + S
      │
      ▼
Auto-Backup task
      │
      ▼
Timestamped copy
      │
      ▼
.backups/ directory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The backup script does not need to modify the source file.&lt;/p&gt;

&lt;p&gt;It produces an independent copy that can be used to restore a previously saved version.&lt;/p&gt;

&lt;p&gt;The following educational example illustrates a backup operation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pathlib&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;shutil&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;copy2&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;backup_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;backup_root&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="n"&gt;source&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;backup_root&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;backup_root&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;destination&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;backup_root&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;

    &lt;span class="n"&gt;destination&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mkdir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;parents&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;exist_ok&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;timestamp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strftime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="s2"&gt;"%Y%m%d_%H%M%S_%f"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;backup&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;destination&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{source.stem}_{timestamp}"&lt;/span&gt;
        &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{source.suffix}"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nf"&gt;copy2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;backup&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;backup&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The function creates a dedicated directory, generates a timestamped filename, and copies the source file.&lt;/p&gt;

&lt;p&gt;Including microseconds reduces the risk of collisions between backups created within the same second.&lt;/p&gt;

&lt;p&gt;This example illustrates a possible strategy without reproducing the source code of &lt;code&gt;backup.py&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  A Specific Aspect of VS Code Integration
&lt;/h3&gt;

&lt;p&gt;Tasks defined in &lt;code&gt;tasks.json&lt;/code&gt; do not, by themselves, provide a generic native trigger that executes a task every time a file is saved.&lt;/p&gt;

&lt;p&gt;A backup integration can therefore rely on a command sequence, a custom keyboard shortcut, or another mechanism connecting the save operation to script execution.&lt;/p&gt;

&lt;p&gt;The pack's documentation describes an integration with &lt;code&gt;Ctrl + S&lt;/code&gt; without an external extension, but does not present the complete triggering mechanism in the public README.&lt;/p&gt;

&lt;p&gt;It is also important to distinguish a backup performed before saving from one performed afterward.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Backup timing&lt;/th&gt;
&lt;th&gt;Content preserved&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Before saving&lt;/td&gt;
&lt;td&gt;Previous version stored on disk&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;After saving&lt;/td&gt;
&lt;td&gt;Newly saved version&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Both approaches can preserve previous versions, but their restoration behavior is not identical.&lt;/p&gt;

&lt;p&gt;The order of operations must therefore be clearly defined.&lt;/p&gt;




&lt;h2&gt;
  
  
  12. Local Backups, VS Code History, and Git
&lt;/h2&gt;

&lt;p&gt;Timestamped backups do not address exactly the same requirements as a version control system.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Mechanism&lt;/th&gt;
&lt;th&gt;Primary responsibility&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Git&lt;/td&gt;
&lt;td&gt;Structured project version history&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Local History&lt;/td&gt;
&lt;td&gt;Local history integrated into VS Code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hot Exit&lt;/td&gt;
&lt;td&gt;Recovery of unsaved modifications&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;backup.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Timestamped copies of saved files&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Git preserves coherent versions of a project, supports change comparisons and branching, and enables collaboration between developers.&lt;/p&gt;

&lt;p&gt;Local backups make it possible to recover intermediate versions that may not have been committed.&lt;/p&gt;

&lt;p&gt;Hot Exit addresses a different requirement: recovering unsaved modifications after the editor is closed or restarted.&lt;/p&gt;

&lt;p&gt;These mechanisms can therefore complement one another.&lt;/p&gt;

&lt;h3&gt;
  
  
  Limitations of Per-File Backups
&lt;/h3&gt;

&lt;p&gt;A timestamped copy of a file does not necessarily represent a consistent state of the entire project.&lt;/p&gt;

&lt;p&gt;A modification may involve several interdependent files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app.py
config.py
models.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Restoring only &lt;code&gt;app.py&lt;/code&gt; to a previous version could introduce incompatibilities with the other files.&lt;/p&gt;

&lt;p&gt;A local per-file backup provides a quick recovery mechanism, but does not replace Git commits or complete project backups.&lt;/p&gt;

&lt;h3&gt;
  
  
  Managing Backup Storage
&lt;/h3&gt;

&lt;p&gt;Creating a copy every time a file is saved can gradually increase disk usage.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Average file size : 200 KB
Number of backups : 100
Total storage     : approximately 20 MB
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Across several projects and months of development, this volume can become significant.&lt;/p&gt;

&lt;p&gt;A retention strategy could introduce a maximum retention period, a per-file limit, or different retention rules depending on backup age.&lt;/p&gt;

&lt;p&gt;These mechanisms are not presented as current features of the pack. They represent possible improvements for managing storage.&lt;/p&gt;

&lt;p&gt;Finally, backups stored on the same disk as the source files do not protect against complete disk failure.&lt;/p&gt;




&lt;h2&gt;
  
  
  13. Exclusions and Filesystem Protection
&lt;/h2&gt;

&lt;p&gt;Maintenance scripts must distinguish source files from technical or generated directories.&lt;/p&gt;

&lt;p&gt;The documentation includes exclusions for common directories such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.git/
node_modules/
__pycache__/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The cleaning and conversion scripts also ignore the following directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.backups/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This last exclusion is particularly important.&lt;/p&gt;

&lt;p&gt;A backup should preserve the content recorded at a specific point in time. If a global cleaning operation also modifies previous copies, those backups no longer accurately represent historical versions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Project
   │
   ├── Source files  → processing allowed
   │
   ├── .git/         → excluded
   ├── node_modules/ → excluded
   ├── __pycache__/  → excluded
   └── .backups/     → excluded
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  File Filtering
&lt;/h3&gt;

&lt;p&gt;An educational file selection approach could be represented as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pathlib&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;


&lt;span class="no"&gt;SUPPORTED&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;".py"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;".html"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;".css"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;".js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;".json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;".txt"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="no"&gt;EXCLUDED&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;".git"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"node_modules"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"__pycache__"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;".backups"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;is_supported&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;relative&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;relative_to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;part&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="no"&gt;EXCLUDED&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;part&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;relative&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;parts&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;is_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;suffix&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="no"&gt;SUPPORTED&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This filter checks a file's extension and the components of its relative path.&lt;/p&gt;

&lt;p&gt;It does not provide complete protection on its own.&lt;/p&gt;

&lt;p&gt;A robust implementation must also account for symbolic links, resolved paths, inaccessible files, and permission errors.&lt;/p&gt;

&lt;p&gt;Visually excluding a directory from the VS Code explorer does not guarantee that a Python script will exclude it.&lt;/p&gt;

&lt;p&gt;Selection rules must be enforced by the component that actually performs the operation.&lt;/p&gt;




&lt;h2&gt;
  
  
  14. Write Operations, Errors, and File Integrity
&lt;/h2&gt;

&lt;p&gt;Maintenance scripts operate directly on project files.&lt;/p&gt;

&lt;p&gt;An interruption during a write operation, a permission issue, or insufficient disk space can therefore affect file integrity.&lt;/p&gt;

&lt;p&gt;A more robust writing strategy consists of creating a temporary file before replacing the target file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Original file
      │
      ▼
Transformation
      │
      ▼
Temporary file
      │
      ▼
Verification
      │
      ▼
Replace target file
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The following educational example uses &lt;code&gt;tempfile&lt;/code&gt; and &lt;code&gt;os.replace()&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;tempfile&lt;/span&gt;

&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pathlib&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;atomic_write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;temporary&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;

    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;tempfile&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;NamedTemporaryFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;mode&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"wb"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nb"&gt;dir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;parent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;delete&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;False&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

            &lt;span class="n"&gt;temporary&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;flush&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fileno&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;temporary&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;finally&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;temporary&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;temporary&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;temporary&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;unlink&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The temporary file is created in the same directory as the destination, allowing the operation to remain on the same filesystem.&lt;/p&gt;

&lt;p&gt;This approach reduces the risk of leaving a partially written file if execution is interrupted before replacement.&lt;/p&gt;

&lt;p&gt;However, it does not guarantee complete protection against every possible failure.&lt;/p&gt;

&lt;p&gt;Preserving permissions, handling concurrent modifications, maintaining metadata, and ensuring durability after a system failure require additional precautions.&lt;/p&gt;

&lt;p&gt;This strategy represents a possible improvement for maintenance scripts. The public documentation does not confirm its use in the current pack.&lt;/p&gt;




&lt;h2&gt;
  
  
  15. Cross-Platform Compatibility
&lt;/h2&gt;

&lt;p&gt;The pack is designed to operate on Windows, macOS, and Linux.&lt;/p&gt;

&lt;p&gt;Python and Visual Studio Code allow a significant portion of the configuration to be shared across these environments.&lt;/p&gt;

&lt;p&gt;However, several differences remain important.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Element&lt;/th&gt;
&lt;th&gt;Consideration&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Paths&lt;/td&gt;
&lt;td&gt;Separators and absolute paths&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Python interpreter&lt;/td&gt;
&lt;td&gt;Executable name and location&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Line endings&lt;/td&gt;
&lt;td&gt;CRLF and LF conventions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Permissions&lt;/td&gt;
&lt;td&gt;Read and write access&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Keyboard shortcuts&lt;/td&gt;
&lt;td&gt;Operating system shortcut conflicts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Case sensitivity&lt;/td&gt;
&lt;td&gt;Filesystem behavior&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;pathlib&lt;/code&gt; module makes it possible to manipulate paths without manually constructing operating-system-specific strings.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pathlib&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;


&lt;span class="n"&gt;workspace&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cwd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;backup_directory&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;workspace&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="s2"&gt;".backups"&lt;/span&gt;

&lt;span class="n"&gt;backup_directory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mkdir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;parents&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;exist_ok&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same code can therefore construct a path appropriate to the environment in which it runs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Keyboard Shortcut Management
&lt;/h3&gt;

&lt;p&gt;The pack documents two shortcuts:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Shortcut&lt;/th&gt;
&lt;th&gt;Action&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Alt + M&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Toggle the minimap&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Alt + R&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Reindent the active file&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Visual Studio Code allows commands to be associated with keyboard shortcuts in &lt;code&gt;keybindings.json&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;An example configuration is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"alt+m"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"editor.action.toggleMinimap"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"alt+r"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"editor.action.reindentlines"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;"when"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"editorTextFocus"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;when&lt;/code&gt; condition restricts shortcut activation to a particular context.&lt;/p&gt;

&lt;p&gt;However, workspace settings must be distinguished from user keyboard shortcuts.&lt;/p&gt;

&lt;p&gt;Unlike &lt;code&gt;settings.json&lt;/code&gt; and &lt;code&gt;tasks.json&lt;/code&gt;, a &lt;code&gt;keybindings.json&lt;/code&gt; file placed inside &lt;code&gt;.vscode/&lt;/code&gt; is not automatically loaded as a native project-specific keyboard shortcut configuration.&lt;/p&gt;

&lt;p&gt;Its contents must be integrated into the user's Visual Studio Code keyboard shortcut settings or handled through an appropriate mechanism.&lt;/p&gt;

&lt;p&gt;This distinction is important when deploying the pack across multiple development machines.&lt;/p&gt;




&lt;h2&gt;
  
  
  16. Optional Extensions and Controlled Dependencies
&lt;/h2&gt;

&lt;p&gt;The pack provides configuration compatible with several common extensions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Prettier&lt;/li&gt;
&lt;li&gt;ErrorLens&lt;/li&gt;
&lt;li&gt;Indent-Rainbow&lt;/li&gt;
&lt;li&gt;Auto-Rename-Tag&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These extensions remain optional.&lt;/p&gt;

&lt;p&gt;The objective is to maintain a separation between the tools required for core functionality and those that improve the editing experience.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;Function&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Python&lt;/td&gt;
&lt;td&gt;Execution of local scripts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;VS Code&lt;/td&gt;
&lt;td&gt;Editor and task orchestration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;autopep8&lt;/td&gt;
&lt;td&gt;Python formatting through a dedicated task&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Prettier&lt;/td&gt;
&lt;td&gt;Formatting of supported languages&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ErrorLens&lt;/td&gt;
&lt;td&gt;Displaying diagnostics in the editor&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The presence of a Prettier configuration does not mean that the formatter executes automatically.&lt;/p&gt;

&lt;p&gt;Similarly, the &lt;code&gt;.vscode/extensions.json&lt;/code&gt; file can define extension recommendations and unwanted recommendations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"unwantedRecommendations"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s2"&gt;"esbenp.prettier-vscode"&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This setting does not technically disable an extension that is already installed and active.&lt;/p&gt;

&lt;p&gt;Disabling an extension within a workspace is handled through Visual Studio Code's extension management features.&lt;/p&gt;

&lt;p&gt;Three mechanisms must therefore remain distinct:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Recommending or not recommending an extension&lt;/li&gt;
&lt;li&gt;Enabling or disabling an extension within a workspace&lt;/li&gt;
&lt;li&gt;Configuring the actions an extension can trigger&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A consistent configuration must account for all three levels.&lt;/p&gt;

&lt;p&gt;The absence of a dependency on an external service does not mean the absence of software dependencies. Python is required to execute the scripts, and &lt;code&gt;autopep8&lt;/code&gt; must be available for the Python formatting task.&lt;/p&gt;




&lt;h2&gt;
  
  
  17. A Local Environment Without Remote Service Dependencies
&lt;/h2&gt;

&lt;p&gt;The pack's scripts execute their operations directly on the local filesystem.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Development machine
         │
         ├── Visual Studio Code
         ├── Python interpreter
         ├── Maintenance scripts
         ├── Source files
         └── Local backups
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Cleaning, line ending conversion, structure generation, and backup creation do not require communication with a remote server.&lt;/p&gt;

&lt;p&gt;This architecture allows the scripts to operate in isolated or offline environments, provided the required tools are already installed.&lt;/p&gt;

&lt;p&gt;However, the behavior of the scripts must be distinguished from that of the complete development environment.&lt;/p&gt;

&lt;p&gt;Visual Studio Code, its extensions, synchronization features, and dependency management tools may perform network communications independently of the pack.&lt;/p&gt;

&lt;p&gt;Local script execution therefore does not guarantee a complete absence of network traffic on the development machine.&lt;/p&gt;

&lt;p&gt;For a strictly isolated environment, synchronization settings, active extensions, and other components must also be controlled.&lt;/p&gt;




&lt;h2&gt;
  
  
  18. An Explicit and Verifiable Workflow
&lt;/h2&gt;

&lt;p&gt;The organization of the pack makes it possible to build a workflow in which individual operations remain identifiable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Project creation
       │
       ▼
Development
       │
       ▼
Saving and backup
       │
       ▼
File analysis
       │
       ▼
Execution scope selection
       │
       ▼
Cleaning or formatting
       │
       ▼
Review modifications
       │
       ▼
Generate structure documentation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These operations do not necessarily need to be executed during every development session.&lt;/p&gt;

&lt;p&gt;Their value lies in the ability to select the operations appropriate to the current context.&lt;/p&gt;

&lt;p&gt;For example, before a code review, a developer can analyze whitespace, clean only the relevant files, and review the modifications with Git.&lt;/p&gt;

&lt;p&gt;The analysis and cleaning operations are available directly through the VS Code task menu.&lt;/p&gt;

&lt;p&gt;Git can then be used to review the resulting changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git diff --stat
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And inspect the detailed modifications:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git diff
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Directory tree generation can be executed whenever technical documentation needs to be updated.&lt;/p&gt;

&lt;p&gt;Local backups remain available independently of these operations.&lt;/p&gt;

&lt;h3&gt;
  
  
  One Responsibility per Tool
&lt;/h3&gt;

&lt;p&gt;The entire architecture relies on specialized components.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Script&lt;/th&gt;
&lt;th&gt;Responsibility&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;create.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Project structure creation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;tree.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Directory structure documentation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;space.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Whitespace and formatting analysis&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;clean.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;File cleaning&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;convert.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Line ending normalization&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;backup.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Timestamped local backups&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This organization allows one script to evolve without systematically modifying the others.&lt;/p&gt;

&lt;p&gt;It also facilitates reuse outside Visual Studio Code.&lt;/p&gt;

&lt;p&gt;A conversion script can be integrated into another workflow. A directory tree generator can document an independent project. An analyzer can be executed from a terminal without loading the entire development environment.&lt;/p&gt;

&lt;p&gt;Modularity is therefore not simply about separating files. It involves defining responsibilities precisely enough for each component to remain understandable, testable, and reusable.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;VS Code Environment Pack illustrates an approach to development environments in which editor configuration, maintenance operations, and backup mechanisms remain distinct.&lt;/p&gt;

&lt;p&gt;VS Code tasks provide an orchestration layer, while Python scripts perform operations on local files.&lt;/p&gt;

&lt;p&gt;The separation between analysis and modification, the three execution scopes, line ending normalization, and timestamped backups contribute to a more predictable workflow.&lt;/p&gt;

&lt;p&gt;This architecture does not eliminate the risks associated with automated modifications. It makes it easier to identify operations, limit their scope, and maintain recovery mechanisms.&lt;/p&gt;

&lt;p&gt;A controlled development environment does not necessarily rely on the absence of automation.&lt;/p&gt;

&lt;p&gt;It relies on a clear distinction between authorized automatic actions, explicitly triggered operations, and transformations that require verification.&lt;/p&gt;

&lt;p&gt;The objective is to make the behavior of development tools as understandable as the code they help maintain.&lt;/p&gt;




&lt;h2&gt;
  
  
  Technical Documentation
&lt;/h2&gt;

&lt;p&gt;The pack's structure, available scripts, configuration settings, and operating principles for version 1.2 are described in its public documentation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Palks-Studio/vs-code-environment-pack" rel="noopener noreferrer"&gt;View the technical documentation on GitHub&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;a href="https://palks-studio.com" rel="noopener noreferrer"&gt;https://palks-studio.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>python</category>
      <category>architecture</category>
      <category>productivity</category>
    </item>
    <item>
      <title>🔎 Python Data Collection System Architecture: Modular Collectors, Processing Pipeline, and Local Storage</title>
      <dc:creator>Anthony Leignel</dc:creator>
      <pubDate>Thu, 04 Jun 2026 17:13:36 +0000</pubDate>
      <link>https://dev.to/palks_studio/i-built-a-local-data-collection-system-in-python-3k6p</link>
      <guid>https://dev.to/palks_studio/i-built-a-local-data-collection-system-in-python-3k6p</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fikdp3uzo5b1idyprjcnc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fikdp3uzo5b1idyprjcnc.png" alt="Local data collection interface displaying structured business records, contact details, filters, export options, and prospect tracking" width="800" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Collecting data from multiple sources involves more than simply retrieving information from the internet. It also requires handling heterogeneous formats, incomplete records, network errors, duplicates, and export mechanisms.&lt;/p&gt;

&lt;p&gt;As the number of sources grows, another challenge emerges: how can the system evolve without modifying its entire business logic every time a new collector is added?&lt;/p&gt;

&lt;p&gt;Data Collection System, developed by Palks Studio, relies on a modular Python architecture with a local Flask interface, independent collectors, and a structured data processing pipeline.&lt;/p&gt;

&lt;p&gt;The system allows users to define searches, collect information from multiple sources, visit discovered websites, extract contact details, and produce structured datasets.&lt;/p&gt;

&lt;p&gt;Its architecture follows a central principle: each component has a clearly defined responsibility and can evolve independently of the others.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. General Architecture
&lt;/h2&gt;

&lt;p&gt;The system is organized into several layers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A main engine responsible for orchestrating executions&lt;/li&gt;
&lt;li&gt;Collectors responsible for retrieving data&lt;/li&gt;
&lt;li&gt;Processors responsible for cleaning, normalization, and validation&lt;/li&gt;
&lt;li&gt;Exporters responsible for generating output files&lt;/li&gt;
&lt;li&gt;A local web interface for managing searches and results&lt;/li&gt;
&lt;li&gt;Cross-cutting components for logging and error handling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The documented project structure is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data-collection-system/
│
├── main.py
├── requirements.txt
├── run.bat
│
├── config/
│   ├── __init__.py
│   └── settings.py
│
├── collectors/
│   ├── __init__.py
│   ├── duckduckgo_collector.py
│   ├── bing_collector.py
│   ├── qwant_collector.py
│   ├── source_registry.py
│   └── base_collector.py
│
├── processors/
│   ├── __init__.py
│   ├── cleaner.py
│   ├── validator.py
│   ├── deduplicator.py
│   ├── email_extractor.py
│   ├── phone_extractor.py
│   └── normalizer.py
│
├── exports/
│   ├── __init__.py
│   ├── csv_exporter.py
│   └── json_exporter.py
│
├── core/
│   ├── __init__.py
│   ├── logger.py
│   ├── retry_handler.py
│   ├── error_handler.py
│   └── folder_initializer.py
│
├── models/
│   ├── __init__.py
│   └── company.py
│
├── data/
│   ├── prospected.json
│   └── processed/
│
├── logs/
│   └── app.log
│
├── searches/
│   ├── __init__.py
│   ├── search_manager.py
│   └── searches.json
│
├── web/
│   ├── __init__.py
│   ├── app.py
│   └── templates/
│       ├── edit_searches.html
│       ├── results.html
│       ├── running.html
│       ├── searches.html
│       └── new_search.html
│
├── LICENCE.md
└── docs/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This structure separates technical components from persistent data.&lt;/p&gt;

&lt;p&gt;Collectors are not responsible for the user interface. Exporters do not determine how data is retrieved. Processors do not depend directly on a particular search engine.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;main.py&lt;/code&gt; file orchestrates these different layers.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Search Management and Configuration
&lt;/h2&gt;

&lt;p&gt;The process begins with the definition of a search.&lt;/p&gt;

&lt;p&gt;From the local interface, users can create, modify, delete, and execute custom searches.&lt;/p&gt;

&lt;p&gt;A search can include a name, a keyword, a city, a country, and the sources to use.&lt;/p&gt;

&lt;p&gt;The documentation provides the following example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Plumbers Paris"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"keyword"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"plumber"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"city"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Paris"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"enabled"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Searches are stored in &lt;code&gt;searches/searches.json&lt;/code&gt; and managed by &lt;code&gt;search_manager.py&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This separation distinguishes two types of configuration.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;Responsibility&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;config/settings.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Technical system settings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;searches/searches.json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;User-defined searches&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;search_manager.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Search management and execution&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;source_registry.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Identification of active collectors&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Technical configuration centralizes storage paths, timeouts, execution limits, export settings, and logging options.&lt;/p&gt;

&lt;p&gt;The business criteria of a search therefore remain independent of the engine's execution settings.&lt;/p&gt;

&lt;p&gt;The same search can be reused without reconfiguring the entire system.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. A Multi-Collector Architecture
&lt;/h2&gt;

&lt;p&gt;The system supports several search engines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DuckDuckGo&lt;/li&gt;
&lt;li&gt;Bing&lt;/li&gt;
&lt;li&gt;Qwant&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each source has its own collector.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User-defined search
         │
         ▼
  source_registry.py
         │
         ├── duckduckgo_collector.py
         ├── bing_collector.py
         └── qwant_collector.py
         │
         ▼
   Structured records
         │
         ▼
   Processing pipeline
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The objective is to avoid embedding the specific behavior of each source directly into the main engine.&lt;/p&gt;

&lt;p&gt;A search engine may change its HTML structure, pagination parameters, or result presentation. Ideally, these changes should remain localized within the corresponding collector.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Common Collector Contract
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;base_collector.py&lt;/code&gt; file defines the common contract that all collectors must follow.&lt;/p&gt;

&lt;p&gt;This contract allows the main engine to use different collectors without knowing their implementation details.&lt;/p&gt;

&lt;p&gt;The following educational example illustrates this principle in Python:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;abc&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="no"&gt;ABC&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;abstractmethod&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;typing&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Dict&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;List&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;BaseCollector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;ABC&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="nd"&gt;@abstractmethod&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;collect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;search&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Dict&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;Dict&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;pass&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A specific collector could then implement this interface:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ExampleCollector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;BaseCollector&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;collect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;search&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Dict&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;Dict&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

        &lt;span class="n"&gt;keyword&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;search&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"keyword"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="n"&gt;city&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;search&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"city"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fetch_results&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;keyword&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;city&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse_result&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;fetch_results()&lt;/code&gt; and &lt;code&gt;parse_result()&lt;/code&gt; methods represent source-specific operations.&lt;/p&gt;

&lt;p&gt;This example illustrates the architectural contract without reproducing the production source code.&lt;/p&gt;

&lt;p&gt;The main engine can then interact with different collectors through a common interface.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Source Registry
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;source_registry.py&lt;/code&gt; file references the available collectors and returns those that are active for a particular execution.&lt;/p&gt;

&lt;p&gt;A simplified registry could work as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="no"&gt;COLLECTORS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"duckduckgo"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;DuckDuckGoCollector&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"bing"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;BingCollector&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"qwant"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;QwantCollector&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_collectors&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;selected_sources&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="no"&gt;COLLECTORS&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;source&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;selected_sources&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;source&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="no"&gt;COLLECTORS&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The main engine no longer needs to maintain a sequence of conditions specific to each source.&lt;/p&gt;

&lt;p&gt;Adding a new collector primarily requires an implementation compatible with the common contract and its registration within the source registry.&lt;/p&gt;

&lt;p&gt;The processing pipeline can remain unchanged.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Data Collection and Enrichment
&lt;/h2&gt;

&lt;p&gt;Search engine results do not necessarily contain all the useful information.&lt;/p&gt;

&lt;p&gt;A result may provide a company name, a URL, and a description without including an email address or phone number.&lt;/p&gt;

&lt;p&gt;The system can therefore visit discovered websites to enrich the records.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Search engine
      │
      ▼
Discovered result
      │
      ├── Name
      ├── URL
      └── Description
      │
      ▼
 Website visit
      │
      ├── Email extraction
      ├── Phone extraction
      └── Additional information
      │
      ▼
Structured record
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This distinction is important.&lt;/p&gt;

&lt;p&gt;Discovering a company and extracting its contact information are two different operations.&lt;/p&gt;

&lt;p&gt;The first identifies a potential source. The second enriches the available information.&lt;/p&gt;

&lt;h3&gt;
  
  
  HTTP Requests and Browser Automation
&lt;/h3&gt;

&lt;p&gt;The system uses Requests, BeautifulSoup, and Playwright.&lt;/p&gt;

&lt;p&gt;These tools address complementary requirements.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Technology&lt;/th&gt;
&lt;th&gt;Primary responsibility&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Requests&lt;/td&gt;
&lt;td&gt;Retrieving HTTP resources&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;BeautifulSoup&lt;/td&gt;
&lt;td&gt;Parsing and extracting HTML content&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Playwright&lt;/td&gt;
&lt;td&gt;Browser automation and page rendering&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flask&lt;/td&gt;
&lt;td&gt;Local web interface&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Python&lt;/td&gt;
&lt;td&gt;Orchestration and data processing&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A standard HTTP request may be sufficient when a page contains the required information directly in its HTML.&lt;/p&gt;

&lt;p&gt;However, some pages generate their content dynamically using JavaScript.&lt;/p&gt;

&lt;p&gt;Browser automation may then be necessary to access the rendered content.&lt;/p&gt;

&lt;p&gt;This capability introduces additional costs in execution time, memory, and resource consumption.&lt;/p&gt;

&lt;p&gt;A collection architecture must therefore distinguish operations requiring a browser from those that can be handled through a simple HTTP request.&lt;/p&gt;

&lt;p&gt;The public documentation does not specify the exact strategy used to select one method or the other for individual pages.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Extracting Email Addresses and Phone Numbers
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;email_extractor.py&lt;/code&gt; and &lt;code&gt;phone_extractor.py&lt;/code&gt; modules are responsible for extracting contact details from visited websites.&lt;/p&gt;

&lt;p&gt;These operations should remain independent of the original collector.&lt;/p&gt;

&lt;p&gt;An email address extracted from a website discovered through Bing should be processed in the same way as an address originating from a DuckDuckGo result.&lt;/p&gt;

&lt;h3&gt;
  
  
  Email Extraction
&lt;/h3&gt;

&lt;p&gt;One initial approach is to identify links using the &lt;code&gt;mailto:&lt;/code&gt; protocol.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;bs4&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;BeautifulSoup&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;extract_mailto&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;html&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="n"&gt;soup&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;BeautifulSoup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;html&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"html.parser"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;emails&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;link&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;soup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;select&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'a[href^="mailto:"]'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

        &lt;span class="n"&gt;href&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;link&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"href"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="n"&gt;email&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;href&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeprefix&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"mailto:"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"?"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;emails&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;emails&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This educational example uses a Python set to eliminate repeated addresses within the same page.&lt;/p&gt;

&lt;p&gt;It does not cover every possible format. An email address may appear in plain text, be encoded, or become visible only after a JavaScript interaction.&lt;/p&gt;

&lt;p&gt;Extraction may therefore require several complementary strategies.&lt;/p&gt;

&lt;p&gt;Three concepts must also remain distinct:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An email address detected within a page&lt;/li&gt;
&lt;li&gt;A syntactically valid email address&lt;/li&gt;
&lt;li&gt;An email address that can actually be used to contact the company&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The presence of an email address on a website does not guarantee its existence or relevance to the company being searched for.&lt;/p&gt;

&lt;h3&gt;
  
  
  Phone Number Extraction
&lt;/h3&gt;

&lt;p&gt;Phone numbers can appear in &lt;code&gt;tel:&lt;/code&gt; links, plain text, or different national formats.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;01 23 45 67 89
01.23.45.67.89
+33 1 23 45 67 89
+33123456789
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These representations may refer to the same number.&lt;/p&gt;

&lt;p&gt;Extraction must therefore be followed by a normalization stage.&lt;/p&gt;

&lt;p&gt;For international formats, this operation requires consideration of the country and its applicable numbering rules.&lt;/p&gt;

&lt;p&gt;Simply removing spaces and punctuation is not always sufficient to produce a valid international phone number.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. A Common Data Model
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;models/company.py&lt;/code&gt; file defines the structure of a company within the system.&lt;/p&gt;

&lt;p&gt;This common structure allows results from different sources to converge into a consistent representation.&lt;/p&gt;

&lt;p&gt;The public documentation presents a record similar to the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Example Company"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"website"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://example.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"email"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"contact@example.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"phone"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"+33123456789"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"city"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Paris"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"country"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"France"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"sector"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"keyword"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"source"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Directory"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"processed"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The fields no longer depend directly on how a particular search engine presents its results.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Field&lt;/th&gt;
&lt;th&gt;Role&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;name&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Company name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;website&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Website address&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;email&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Collected email address&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;phone&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Phone number&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;city&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;City associated with the company&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;country&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Country associated with the company&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;sector&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Industry or search keyword&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;source&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Origin of the record&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;processed&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Processing status indicator&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Preserving the source is an important aspect of traceability.&lt;/p&gt;

&lt;p&gt;It allows records originating from different collectors to be distinguished and can help identify differences in data quality between sources.&lt;/p&gt;

&lt;p&gt;Collected information must also be distinguished from inferred information.&lt;/p&gt;

&lt;p&gt;A search using the keyword "plumber Paris" does not guarantee that every returned company actually operates in that industry or is located in Paris.&lt;/p&gt;

&lt;p&gt;Search criteria should not automatically be treated as verified information about every result.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. The Data Processing Pipeline
&lt;/h2&gt;

&lt;p&gt;The main engine orchestrates a sequential processing pipeline.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     Load configuration
             │
             ▼
    Initialize environment
             │
             ▼
        Load searches
             │
             ▼
       Run collectors
             │
             ▼
         Clean data
             │
             ▼
       Normalize data
             │
             ▼
       Validate records
             │
             ▼
       Remove duplicates
             │
             ▼
       Generate exports
             │
             ▼
        Log execution
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each stage transforms the data before passing it to the next.&lt;/p&gt;

&lt;p&gt;This organization separates responsibilities and allows individual processing operations to be tested independently.&lt;/p&gt;

&lt;p&gt;A collector may produce an incomplete record. The cleaning processor can correct certain values. The validator can then determine whether the record meets the requirements for export.&lt;/p&gt;

&lt;p&gt;The objective is not simply to produce more data, but to produce data that is sufficiently consistent to be usable.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. Cleaning and Normalization
&lt;/h2&gt;

&lt;p&gt;Cleaning and normalization are often grouped together, although they address two distinct requirements.&lt;/p&gt;

&lt;p&gt;Cleaning removes unnecessary elements or corrects simple inconsistencies.&lt;/p&gt;

&lt;p&gt;Normalization standardizes representations to facilitate comparisons and subsequent processing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Data Cleaning
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;cleaner.py&lt;/code&gt; module prepares collected values.&lt;/p&gt;

&lt;p&gt;A simple example consists of removing unnecessary whitespace:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;clean_text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;" "&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input  : "  Example   Company  "
Output : "Example Company"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This operation improves string consistency without changing the meaning of the value.&lt;/p&gt;

&lt;h3&gt;
  
  
  Data Normalization
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;normalizer.py&lt;/code&gt; module standardizes values.&lt;/p&gt;

&lt;p&gt;The documentation provides the example of city names:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PARIS
Paris
paris
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These three representations become:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Paris
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;URLs provide another important example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://example.com
https://example.com/
https://EXAMPLE.COM/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These addresses can be represented in a common form to facilitate comparisons.&lt;/p&gt;

&lt;p&gt;The following educational example illustrates basic normalization limited to HTTP and HTTPS URLs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;parse&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;urlsplit&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;urlunsplit&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;normalize_url&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="n"&gt;parts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;urlsplit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;scheme&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"http"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"https"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hostname&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;urlunsplit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;scheme&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;netloc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="s2"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;""&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example preserves the path and query parameters while standardizing the scheme and host representation.&lt;/p&gt;

&lt;p&gt;However, URL normalization requires careful consideration.&lt;/p&gt;

&lt;p&gt;Two addresses sharing the same domain may refer to different pages. Query parameters can also change the resource returned.&lt;/p&gt;

&lt;p&gt;Normalization should therefore not arbitrarily remove information required to identify a resource.&lt;/p&gt;




&lt;h2&gt;
  
  
  9. Record Validation
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;validator.py&lt;/code&gt; module verifies the presence and consistency of required information.&lt;/p&gt;

&lt;p&gt;The documentation provides the company name and website as examples of required fields.&lt;/p&gt;

&lt;p&gt;A simplified validation function could be represented as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;is_valid_company&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;website&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"website"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;website&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;

    &lt;span class="n"&gt;parts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;urlsplit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;website&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;scheme&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"http"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"https"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hostname&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This check verifies the presence of values and the basic structure of the URL.&lt;/p&gt;

&lt;p&gt;It does not verify whether the website is accessible, whether the company exists, or whether the contact details actually belong to that company.&lt;/p&gt;

&lt;p&gt;These different levels of validation must remain distinct.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Validation level&lt;/th&gt;
&lt;th&gt;Question addressed&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Structure&lt;/td&gt;
&lt;td&gt;Does the record contain the required fields?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Syntax&lt;/td&gt;
&lt;td&gt;Are the values correctly formatted?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Consistency&lt;/td&gt;
&lt;td&gt;Are the values compatible with each other?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Accessibility&lt;/td&gt;
&lt;td&gt;Is the remote resource accessible?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Business verification&lt;/td&gt;
&lt;td&gt;Does the data correspond to the entity?&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A data collection architecture must define precisely the expected quality level before export.&lt;/p&gt;

&lt;p&gt;A syntactically valid record is not necessarily an accurate record.&lt;/p&gt;




&lt;h2&gt;
  
  
  10. Deduplication: Identifying the Same Company
&lt;/h2&gt;

&lt;p&gt;Deduplication is an essential stage in a multi-source architecture.&lt;/p&gt;

&lt;p&gt;A company may appear several times in the results of a single search engine, as well as across multiple search engines.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DuckDuckGo : Example Company
Bing       : Example Company
Qwant      : Example Company
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without specific processing, these three results could be exported as three different prospects.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;deduplicator.py&lt;/code&gt; module identifies and removes redundant records.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key-Based Deduplication
&lt;/h3&gt;

&lt;p&gt;One educational approach consists of using the website domain as a comparison key.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;parse&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;urlsplit&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;company_key&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="n"&gt;website&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"website"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;host&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;urlsplit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;website&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hostname&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeprefix&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"www."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Deduplication can then be performed using a dictionary:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;deduplicate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;records&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="n"&gt;unique&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;records&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

        &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;company_key&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;unique&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;unique&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;unique&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;values&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example preserves the first record encountered for each domain.&lt;/p&gt;

&lt;p&gt;It illustrates a possible strategy rather than the exact deduplication key used in the production system.&lt;/p&gt;

&lt;p&gt;This method has several limitations.&lt;/p&gt;

&lt;p&gt;A corporate group may operate multiple establishments sharing the same domain. Several independent companies may be hosted on the same platform. A company may also operate multiple websites.&lt;/p&gt;

&lt;p&gt;The deduplication key must therefore correspond to the entity the system actually intends to identify.&lt;/p&gt;

&lt;h3&gt;
  
  
  Removing or Merging Duplicates
&lt;/h3&gt;

&lt;p&gt;Two results may represent the same company while containing complementary information.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Source&lt;/th&gt;
&lt;th&gt;Website&lt;/th&gt;
&lt;th&gt;Email&lt;/th&gt;
&lt;th&gt;Phone&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;DuckDuckGo&lt;/td&gt;
&lt;td&gt;example.com&lt;/td&gt;
&lt;td&gt;&lt;a href="mailto:contact@example.com"&gt;contact@example.com&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bing&lt;/td&gt;
&lt;td&gt;example.com&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;+33123456789&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Qwant&lt;/td&gt;
&lt;td&gt;example.com&lt;/td&gt;
&lt;td&gt;&lt;a href="mailto:contact@example.com"&gt;contact@example.com&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;+33123456789&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Removing the last two records would result in the loss of the phone number if only the first record were retained.&lt;/p&gt;

&lt;p&gt;Another strategy consists of merging complementary information:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Example Company"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"website"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://example.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"email"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"contact@example.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"phone"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"+33123456789"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"sources"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s2"&gt;"DuckDuckGo"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"Bing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"Qwant"&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This merging model represents a possible architectural evolution.&lt;/p&gt;

&lt;p&gt;The public documentation confirms duplicate removal but does not specify merging rules, source priorities, or how conflicting values are resolved.&lt;/p&gt;




&lt;h2&gt;
  
  
  11. Workflow Orchestration
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;main.py&lt;/code&gt; file is the main entry point of the system.&lt;/p&gt;

&lt;p&gt;It coordinates search loading, collector selection, data processing, and export generation.&lt;/p&gt;

&lt;p&gt;A simplified example illustrates this orchestration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run_search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;search&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;collectors&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="n"&gt;raw_records&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;collector&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;collectors&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

        &lt;span class="n"&gt;records&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;collector&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;collect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;search&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="n"&gt;raw_records&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;extend&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;records&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;cleaned&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="nf"&gt;clean_record&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;raw_records&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="n"&gt;normalized&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="nf"&gt;normalize_record&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;cleaned&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="n"&gt;valid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="n"&gt;record&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;normalized&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;is_valid_company&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="n"&gt;unique&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;deduplicate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;valid&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nf"&gt;export_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;unique&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;export_json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;unique&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;unique&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The functions used here represent the responsibilities of the different modules.&lt;/p&gt;

&lt;p&gt;The main engine does not necessarily contain the details of cleaning, normalization, or exporting.&lt;/p&gt;

&lt;p&gt;It primarily defines the order of operations and transfers data between components.&lt;/p&gt;

&lt;p&gt;This separation makes it possible to modify an exporter or add a validation rule without rewriting the overall system workflow.&lt;/p&gt;




&lt;h2&gt;
  
  
  12. Error Handling, Retries, and Logging
&lt;/h2&gt;

&lt;p&gt;Collecting data from the internet depends on resources that are not entirely controlled by the application.&lt;/p&gt;

&lt;p&gt;A request may fail, a website may become unavailable, a connection may time out, or a page may change its structure.&lt;/p&gt;

&lt;p&gt;The system provides dedicated components for these responsibilities.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;Responsibility&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;logger.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Event and error logging&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;retry_handler.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Retrying failed operations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;error_handler.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Centralized error handling&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;folder_initializer.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Initializing required directories&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Retrying Only Temporary Failures
&lt;/h3&gt;

&lt;p&gt;Not every error justifies a retry.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Situation&lt;/th&gt;
&lt;th&gt;Possible behavior&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Connection timeout&lt;/td&gt;
&lt;td&gt;Limited retry attempts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HTTP 503 server error&lt;/td&gt;
&lt;td&gt;Retry after a delay&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HTTP 429 rate limit&lt;/td&gt;
&lt;td&gt;Respect the server's requested delay&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HTTP 404 not found&lt;/td&gt;
&lt;td&gt;Abandon the affected resource&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HTTP 403 forbidden&lt;/td&gt;
&lt;td&gt;Stop the attempt&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Invalid data&lt;/td&gt;
&lt;td&gt;Reject or flag the record&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Automatic retries should improve system robustness rather than generate an uncontrolled sequence of requests.&lt;/p&gt;

&lt;p&gt;The following educational example illustrates exponential backoff:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;

&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exceptions&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nc"&gt;ConnectionError&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;Timeout&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run_with_retry&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;operation&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;attempts&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;attempts&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

        &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;operation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ConnectionError&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Timeout&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;attempts&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;raise&lt;/span&gt;

            &lt;span class="n"&gt;delay&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt;

            &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This strategy progressively increases the delay between attempts.&lt;/p&gt;

&lt;p&gt;It does not represent the exact implementation of &lt;code&gt;retry_handler.py&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A more complete implementation could also include randomized delays, a maximum delay, an overall execution limit, and handling of HTTP headers such as &lt;code&gt;Retry-After&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Retries must not be used to circumvent access restrictions imposed by a source.&lt;/p&gt;

&lt;h3&gt;
  
  
  Logging
&lt;/h3&gt;

&lt;p&gt;Events are recorded in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;logs/app.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The documentation provides examples of events such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Application started
Collection started
250 records collected
Export completed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Logging makes it possible to monitor executions and facilitates troubleshooting when errors occur.&lt;/p&gt;

&lt;p&gt;In a multi-collector architecture, it can also help identify sources that produce recurring errors or data that is difficult to process.&lt;/p&gt;

&lt;p&gt;However, detailed logging should avoid unnecessarily retaining personal data, secrets, or sensitive information.&lt;/p&gt;




&lt;h2&gt;
  
  
  13. A Local Flask Interface
&lt;/h2&gt;

&lt;p&gt;The system includes a web interface accessible through a browser.&lt;/p&gt;

&lt;p&gt;The Flask application is defined in &lt;code&gt;web/app.py&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The HTML templates correspond to the different stages of the user workflow.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Template&lt;/th&gt;
&lt;th&gt;Function&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;searches.html&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;List of saved searches&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;new_search.html&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Search creation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;edit_searches.html&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Search criteria modification&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;running.html&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Execution progress display&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;results.html&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Results viewing and filtering&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The interface allows users to manage searches, select collectors, launch executions, and review the resulting data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; Local browser
       │
       ▼
Flask application
       │
       ├── Search management
       ├── Collection execution
       ├── Progress display
       └── Results viewing
       │
       ▼
Processing engine
       │
       ▼
   Local data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Flask acts as the user interaction layer.&lt;/p&gt;

&lt;p&gt;Collectors, processors, and exporters remain independent Python components.&lt;/p&gt;

&lt;p&gt;This separation prevents the collection logic from becoming entirely dependent on the web interface.&lt;/p&gt;

&lt;h3&gt;
  
  
  Handling Long-Running Operations
&lt;/h3&gt;

&lt;p&gt;A collection may require multiple HTTP requests, website visits, and processing operations.&lt;/p&gt;

&lt;p&gt;Executing the entire workflow directly within an HTTP request can block the server response for the duration of the operation.&lt;/p&gt;

&lt;p&gt;A local architecture may consider several approaches:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An independent collection process&lt;/li&gt;
&lt;li&gt;A background task&lt;/li&gt;
&lt;li&gt;An execution status tracking mechanism&lt;/li&gt;
&lt;li&gt;An interface that periodically requests progress updates&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The presence of &lt;code&gt;running.html&lt;/code&gt; indicates that the system provides a dedicated interface for search execution.&lt;/p&gt;

&lt;p&gt;However, the public documentation does not describe the exact mechanism used to handle long-running tasks, concurrency, or progress updates.&lt;/p&gt;

&lt;p&gt;This is an important architectural consideration when multiple searches can be launched or when a collection may take several minutes.&lt;/p&gt;




&lt;h2&gt;
  
  
  14. Tracking Previously Contacted Prospects
&lt;/h2&gt;

&lt;p&gt;The system allows prospects to be marked as contacted directly from the results interface.&lt;/p&gt;

&lt;p&gt;The contact history is stored in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data/prospected.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This file records previously contacted prospects and their associated contact dates.&lt;/p&gt;

&lt;p&gt;This functionality introduces an important distinction between two types of data.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Collected data&lt;/th&gt;
&lt;th&gt;Tracking data&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Company name&lt;/td&gt;
&lt;td&gt;Contact status&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Website&lt;/td&gt;
&lt;td&gt;Contact date&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Email and phone number&lt;/td&gt;
&lt;td&gt;Action history&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Geographic information&lt;/td&gt;
&lt;td&gt;User-specific information&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Collected data may be refreshed with each execution.&lt;/p&gt;

&lt;p&gt;Contact history, however, must remain available independently of newly collected results.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   New collection
         │
         ▼
   Updated results
         │
         ├── Compare with contact history
         │
         ▼
New or previously contacted prospects
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This separation prevents a new collection from erasing the previous tracking status.&lt;/p&gt;

&lt;p&gt;An educational data model could use a stable key:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"example.com"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"contacted"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;"contacted_at"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2026-06-04"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example does not reproduce the exact internal format of &lt;code&gt;prospected.json&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The main challenge is identifying a prospect consistently, even if its name or URL changes slightly between two collections.&lt;/p&gt;

&lt;p&gt;Normalization and deduplication therefore also become important for maintaining continuity in contact history.&lt;/p&gt;




&lt;h2&gt;
  
  
  15. CSV and JSON Exports
&lt;/h2&gt;

&lt;p&gt;Processed results are stored in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data/processed/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The system supports two export formats.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Format&lt;/th&gt;
&lt;th&gt;Primary use&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;CSV&lt;/td&gt;
&lt;td&gt;Spreadsheets, imports, tabular data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;JSON&lt;/td&gt;
&lt;td&gt;Application integration and Python&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Exporters are separated from the collection engine.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;csv_exporter.py&lt;/code&gt; file generates tabular data, while &lt;code&gt;json_exporter.py&lt;/code&gt; preserves a structured representation.&lt;/p&gt;

&lt;h3&gt;
  
  
  CSV Export Example
&lt;/h3&gt;

&lt;p&gt;Python provides native tools for generating CSV files.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;csv&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;export_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;records&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="n"&gt;fields&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s2"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"website"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"email"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"phone"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"city"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"country"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"sector"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"source"&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"w"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;encoding&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"utf-8"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;newline&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

        &lt;span class="n"&gt;writer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;csv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DictWriter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;fieldnames&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;fields&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;extrasaction&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"ignore"&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="n"&gt;writer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writeheader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;writer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writerows&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;records&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This educational example generates a file containing the main fields of the data model.&lt;/p&gt;

&lt;p&gt;The separator, encoding, and value representation rules must be adapted to the software consuming the exports.&lt;/p&gt;

&lt;p&gt;Spreadsheet formula injection must also be considered when data collected from external sources begins with characters that spreadsheet applications interpret as formulas.&lt;/p&gt;

&lt;p&gt;Exporting should not be considered a simple formatting operation. It represents another boundary between the application and the systems that consume its data.&lt;/p&gt;




&lt;h2&gt;
  
  
  16. Security and the Limitations of Local Collection
&lt;/h2&gt;

&lt;p&gt;A local architecture allows searches, results, and contact history to remain on the user's machine.&lt;/p&gt;

&lt;p&gt;However, this does not mean that the system operates entirely offline.&lt;/p&gt;

&lt;p&gt;Collectors communicate with external search engines and websites.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; Local machine
       │
       ├── Configuration
       ├── Searches
       ├── Processing
       ├── Results
       └── Contact history
       │
       ▼
Outbound network requests
       │
       ├── Search engines
       └── Visited websites
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The distinction is important: storage and processing are local, but collection requires network communication.&lt;/p&gt;

&lt;p&gt;External sources may receive search queries, the connection's IP address, and technical information associated with website visits.&lt;/p&gt;

&lt;h3&gt;
  
  
  Security of Remote Resources
&lt;/h3&gt;

&lt;p&gt;Collected web pages represent untrusted data.&lt;/p&gt;

&lt;p&gt;A collection architecture must account for redirects, oversized responses, timeouts, and potentially malicious content.&lt;/p&gt;

&lt;p&gt;Discovered URLs must be validated before they are used.&lt;/p&gt;

&lt;p&gt;Particular attention should be paid to requests that could target local addresses, internal services, or resources that should not be accessible from the collection engine.&lt;/p&gt;

&lt;p&gt;Possible security measures include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Restricting allowed protocols to HTTP and HTTPS&lt;/li&gt;
&lt;li&gt;Validating destinations and redirects&lt;/li&gt;
&lt;li&gt;Limiting response sizes&lt;/li&gt;
&lt;li&gt;Enforcing timeouts and execution limits&lt;/li&gt;
&lt;li&gt;Isolating the automated browser&lt;/li&gt;
&lt;li&gt;Encoding collected data when rendering it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These measures represent security requirements to consider for this type of architecture. The public documentation does not confirm their complete implementation in the current version.&lt;/p&gt;

&lt;h3&gt;
  
  
  Security of the Local Interface
&lt;/h3&gt;

&lt;p&gt;A local Flask application should not be unnecessarily exposed to the network.&lt;/p&gt;

&lt;p&gt;A server intended for individual use can be restricted to the loopback interface.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"127.0.0.1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;debug&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;False&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example illustrates a possible local configuration.&lt;/p&gt;

&lt;p&gt;It does not necessarily represent the exact settings of the system.&lt;/p&gt;

&lt;p&gt;The Flask development server should not be used as a publicly exposed production server.&lt;/p&gt;

&lt;p&gt;Operations that launch, modify, or delete searches must also have appropriate protections against unauthorized requests.&lt;/p&gt;

&lt;h3&gt;
  
  
  Data Collection and Usage
&lt;/h3&gt;

&lt;p&gt;The absence of a SaaS platform does not eliminate the need to respect source access conditions and applicable rules concerning collected data.&lt;/p&gt;

&lt;p&gt;A professional email address may constitute personal data when it identifies an individual.&lt;/p&gt;

&lt;p&gt;The collection of publicly available information does not automatically mean that its reuse for prospecting is free from legal obligations.&lt;/p&gt;

&lt;p&gt;The system must therefore be used within a framework that accounts for collection purposes, retention policies, and applicable prospecting requirements.&lt;/p&gt;

&lt;p&gt;Technical control over data does not replace responsibility for its use.&lt;/p&gt;




&lt;h2&gt;
  
  
  17. Extensibility and Architectural Evolution
&lt;/h2&gt;

&lt;p&gt;One of the main benefits of the system is the ability to evolve each layer independently.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Proposed evolution&lt;/th&gt;
&lt;th&gt;Primary component affected&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;New collection source&lt;/td&gt;
&lt;td&gt;Collector and source registry&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;New phone number format&lt;/td&gt;
&lt;td&gt;Normalization&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;New required field&lt;/td&gt;
&lt;td&gt;Model and validation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;New deduplication rule&lt;/td&gt;
&lt;td&gt;Deduplication&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;New export format&lt;/td&gt;
&lt;td&gt;Exporter&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;New user interface view&lt;/td&gt;
&lt;td&gt;Flask interface and templates&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This separation limits the impact of changes on the rest of the system.&lt;/p&gt;

&lt;p&gt;However, it does not mean that every component can evolve without coordination.&lt;/p&gt;

&lt;p&gt;Changing the common data model may require adjustments to multiple collectors, processors, and exporters.&lt;/p&gt;

&lt;p&gt;The architecture must therefore maintain sufficiently stable contracts between its different layers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Storage Evolution
&lt;/h3&gt;

&lt;p&gt;JSON and CSV files make it possible to retain structured data without introducing a database server.&lt;/p&gt;

&lt;p&gt;As data volume grows, several constraints may emerge:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Loading large files&lt;/li&gt;
&lt;li&gt;Searching across multiple collections&lt;/li&gt;
&lt;li&gt;Concurrent updates to contact history&lt;/li&gt;
&lt;li&gt;Deduplication across large datasets&lt;/li&gt;
&lt;li&gt;Tracking changes in collected data over time&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;SQLite could become a relevant evolution if these requirements become more significant.&lt;/p&gt;

&lt;p&gt;It would make it possible to introduce indexes, uniqueness constraints, and transactions while preserving a local architecture.&lt;/p&gt;

&lt;p&gt;This evolution is not presented as a current feature of the system, but as a possibility enabled by the separation between collection, processing, and storage.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Data Collection System illustrates the construction of a modular Python data collection pipeline, from search definition to the generation of structured files.&lt;/p&gt;

&lt;p&gt;Its architecture relies on independent collectors, a common data model, a cleaning and validation pipeline, deduplication mechanisms, and separate exporters.&lt;/p&gt;

&lt;p&gt;The Flask interface allows these operations to be managed locally, while results and contact history remain stored within the user's environment.&lt;/p&gt;

&lt;p&gt;The main technical challenges are not limited to retrieving data.&lt;/p&gt;

&lt;p&gt;They also involve the quality of collected information, source stability, normalization, error handling, remote resource security, and data consistency across executions.&lt;/p&gt;

&lt;p&gt;A modular architecture does not eliminate these constraints. It makes it possible to address them within clearly identified components, limit dependencies between layers, and progressively evolve the system.&lt;/p&gt;

&lt;p&gt;The objective remains to build a processing pipeline whose data, transformations, and technical responsibilities are understandable, maintainable, and controlled.&lt;/p&gt;




&lt;h2&gt;
  
  
  Technical Documentation
&lt;/h2&gt;

&lt;p&gt;The project structure, components, collection workflow, and design principles are described in its public documentation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Palks-Studio/data-collection-system" rel="noopener noreferrer"&gt;View the technical documentation on GitHub&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;a href="https://palks-studio.com" rel="noopener noreferrer"&gt;https://palks-studio.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>architecture</category>
      <category>flask</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
