Skip to content

Commit bc395d1

Browse files
committed
Improve tutorials
1 parent 0176472 commit bc395d1

File tree

2 files changed

+119
-41
lines changed

2 files changed

+119
-41
lines changed

content/collections/tutorials/create-collection.md

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,86 @@ weight: 1
77

88
This tutorial will guide you through creating your first Open Terms Archive collection.
99

10-
By the end, you'll have a working collection that tracks changes to a service's privacy policy. You will also have a basic understanding of how to create a collection and how to set up the API.
10+
By the end, you'll have a working collection that tracks changes to a service's privacy policy. You will also have a basic understanding of how to create a collection.
1111

1212
## Prerequisites
1313

1414
- Node.js installed on your system
1515
- Basic familiarity with the command line
1616
- A text editor
1717

18-
## Track a terms
18+
## Create a collection
1919

2020
### Step 1: Set up the project structure
21+
22+
1. Create a new directory:
23+
```bash
24+
mkdir ota-tutorial-declarations
25+
cd ota-tutorial-declarations
26+
```
27+
28+
2. Create a `declarations` directory inside the project. This is where you will declare the service and terms you want to track:
29+
```bash
30+
mkdir declarations
31+
```
32+
33+
3. Create the configuration file for the collection:
34+
```bash
35+
mkdir config
36+
```
37+
38+
### Step 2: Create the service declaration
39+
40+
4. Create a file `declarations/Open Terms Archive.js` with the basic structure, the first thing to declare is the service name:
41+
```json
42+
{
43+
"name": "Open Terms Archive",
44+
"documents": {
45+
"Privacy Policy": {
46+
"fetch": "https://opentermsarchive.org/en/privacy-policy",
47+
"select": ".textcontent"
48+
}
49+
}
50+
}
51+
```
52+
53+
### Step 2: Create the metadata file
54+
55+
6. Create a file `metadata.yaml`:
56+
```yaml
57+
id: ota-tutorial
58+
name: Tutorial collection
59+
tagline: Learn how to create an Open Terms Archive collection
60+
description: |
61+
A step-by-step tutorial collection that guides through creating an Open Terms Archive collection.
62+
Track terms and conditions from websites while learning the basics of declarations, configuration, and metadata.
63+
languages: [en]
64+
jurisdictions: [EU]
65+
```
66+
67+
### Step 3: Create the configuration file
68+
69+
5. Create a file `config/development.json` and set the tracking schedule to every minute:
70+
```json
71+
{
72+
"trackingSchedule": "* * * * *"
73+
}
74+
```
75+
76+
### Step 4: Install and run the engine
77+
78+
1. Install the Open Terms Archive engine:
79+
```bash
80+
npm install --save @opentermsarchive/engine
81+
```
82+
83+
2. Start the scheduled tracking of the declared terms:
84+
```bash
85+
npx ota track --schedule
86+
```
87+
88+
3. After one minute, check the results:
89+
- Check the extracted version, which should contain the Privacy Policy of Open Terms Archive in the markdown format without insignificant content (like the header, footer, etc.): `./data/versions/Open Terms Archive/Privacy Policy.md`
90+
- Check the snapshot, which is the original html document of the Open Terms Archive Privacy Policy: `./data/snapshots/Open Terms Archive/Privacy Policy.html`
91+
92+
Congratulations! You have created your first collection.

content/terms/tutorials/track-terms.md

Lines changed: 45 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ weight: 1
55

66
# Track your first terms
77

8-
This tutorial will guide you through creating your first Open Terms Archive collection.
8+
This tutorial will guide you through tracking your first terms.
99

10-
By the end, you'll have a working collection that tracks changes to a service's privacy policy. You will also have a basic understanding of how to create a collection and how to set up the API.
10+
By the end, you'll have tracked a service's privacy policy. You will also have a basic understanding of how to declare a terms to track and how to run the engine.
1111

1212
## Prerequisites
1313

@@ -17,57 +17,63 @@ By the end, you'll have a working collection that tracks changes to a service's
1717

1818
## Track a terms
1919

20-
### Step 1: Set up the project structure
20+
### Step 1: Set up the structure
2121

22-
1. Create a new directory for your collection:
23-
```bash
24-
mkdir ota-tutorial-declarations
25-
cd ota-tutorial-declarations
26-
```
22+
1. Create a new directory:
23+
```bash
24+
mkdir ota-tutorial-declarations
25+
cd ota-tutorial-declarations
26+
```
2727

28-
2. Create a `declarations` directory inside your project. This is where you will declare the services and terms you want to track:
29-
```bash
30-
mkdir declarations
31-
```
28+
2. Create a `declarations` directory inside the project. This is where you will declare the service and terms you want to track:
29+
```bash
30+
mkdir declarations
31+
```
3232

33-
### Step 2: Create your first service declaration
33+
### Step 2: Create the service declaration
3434

3535
For this tutorial, we will use the Privacy Policy of Open Terms Archive as an example.
36-
1. Create a file `declarations/Open Terms Archive.js` with this basic structure, the first thing to declare is the service name:
37-
```json
38-
{
39-
"name": "Open Terms Archive"
40-
}
41-
```
4236

43-
Now, you can add a terms you want to track to the declaration. For this example, we will use the Privacy Policy of Open Terms Archive.
37+
1. Create a file `declarations/Open Terms Archive.js` with the basic structure, the first thing to declare is the service name:
38+
```json
39+
{
40+
"name": "Open Terms Archive"
41+
}
42+
```
43+
44+
Now, you can add a terms you want to track to the declaration. For this example, we will use the Privacy Policy of Open Terms Archive.
45+
46+
You can go on the open terms archive website and copy the URL of the Privacy Policy to fill the `fetch` field.
47+
48+
And you can inspect the HTML of the page to get the selector of the content you want to extract to fill the `select` field.
4449

4550
2. Add the Privacy Policy document configuration:
46-
```json
47-
{
48-
"name": "Open Terms Archive",
49-
"documents": {
50-
"Privacy Policy": {
51-
"fetch": "https://opentermsarchive.org/en/privacy-policy",
52-
"select": ".textcontent"
53-
}
54-
}
55-
}
56-
```
51+
```json
52+
{
53+
"name": "Open Terms Archive",
54+
"documents": {
55+
"Privacy Policy": {
56+
"fetch": "https://opentermsarchive.org/en/privacy-policy",
57+
"select": ".textcontent"
58+
}
59+
}
60+
}
61+
```
5762

5863
### Step 3: Install and run the engine
5964

6065
1. Install the Open Terms Archive engine:
61-
```bash
62-
npm install --save @opentermsarchive/engine
63-
```
66+
```bash
67+
npm install --save @opentermsarchive/engine
68+
```
6469

6570
2. Start a one time tracking of the declared terms:
66-
```bash
67-
npx ota track
68-
```
71+
```bash
72+
npx ota track
73+
```
6974

7075
3. Verify the results:
71-
- Check the extracted version, which should contain the Privacy Policy of Open Terms Archive in the markdown format without insignificant content (like the header, footer, etc.): `./data/versions/Open Terms Archive/Privacy Policy.md`
72-
- Check the snapshot, which is the original html document of the Open Terms Archive Privacy Policy: `./data/snapshots/Open Terms Archive/Privacy Policy.html`
76+
- Check the extracted version, which should contain the Privacy Policy of Open Terms Archive in the markdown format without insignificant content (like the header, footer, etc.): `./data/versions/Open Terms Archive/Privacy Policy.md`
77+
- Check the snapshot, which is the original html document of the Open Terms Archive Privacy Policy: `./data/snapshots/Open Terms Archive/Privacy Policy.html`
7378

79+
Congratulations! You have tracked your first terms.

0 commit comments

Comments
 (0)