Skip to content

Commit ad34022

Browse files
committed
Added items on html page
1 parent 37cc315 commit ad34022

4 files changed

Lines changed: 99 additions & 26 deletions

File tree

docs-src/index.html

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,38 @@
1414
<div class="container">
1515
<h1>Health Data Safe - Data Dictionnary</h1>
1616
<a href="https://github.com/healthdatasafe/data-model-draft">Github Repo</a>
17+
1718
<br>
1819
<hr>
19-
<table class="table">
20-
<thead>
21-
<tr>
22-
<th scope="col">Title</th>
23-
<th scope="col">Filename</th>
24-
</tr>
25-
</thead>
26-
<tbody>
27-
{TABLE_BODY}
28-
</tbody>
29-
</table>
20+
<h3>Files</h3>
21+
<table class="table">
22+
<thead>
23+
<tr>
24+
<th scope="col"><b>Title</b></th>
25+
<th scope="col"><b>Filename</b></th>
26+
</tr>
27+
</thead>
28+
<tbody>
29+
{TABLE_FILES}
30+
</tbody>
31+
</table>
32+
33+
<br>
34+
<hr>
35+
<h3>Items</h3>
36+
<table class="table">
37+
<thead>
38+
<tr>
39+
<th scope="col"><b>Id & Type</b></th>
40+
<th scope="col"><b>Description</b></th>
41+
<th scope="col"><b>streamId & eventType</b></th>
42+
<th scope="col"><b>Variations</b></th>
43+
</tr>
44+
</thead>
45+
<tbody>
46+
{TABLE_ITEMS}
47+
</tbody>
48+
</table>
3049
</div>
3150
</body>
3251
</html>

docs/index.html

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,63 @@
1414
<div class="container">
1515
<h1>Health Data Safe - Data Dictionnary</h1>
1616
<a href="https://github.com/healthdatasafe/data-model-draft">Github Repo</a>
17+
1718
<br>
1819
<hr>
19-
<table class="table">
20-
<thead>
21-
<tr>
22-
<th scope="col">Title</th>
23-
<th scope="col">Filename</th>
24-
</tr>
25-
</thead>
26-
<tbody>
27-
<tr><td>Pack items & streams</td><td><a href="./pack.json">pack.json</a></tr>
20+
<h3>Files</h3>
21+
<table class="table">
22+
<thead>
23+
<tr>
24+
<th scope="col"><b>Title</b></th>
25+
<th scope="col"><b>Filename</b></th>
26+
</tr>
27+
</thead>
28+
<tbody>
29+
<tr><td>Pack items & streams</td><td><a href="./pack.json">pack.json</a></tr>
2830
<tr><td>Json Schema Item</td><td><a href="./json-schemas/item.json">./json-schemas/item.json</a></tr>
2931
<tr><td>Json Schema Defs</td><td><a href="./json-schemas/defs.json">./json-schemas/defs.json</a></tr>
3032
<tr><td>Streams Tree</td><td><a href="./streamsTree.json">./streamsTree.json</a></tr>
3133
<tr><td>Items dictionnary</td><td><a href="./items.json">./items.json</a></tr>
32-
</tbody>
33-
</table>
34+
</tbody>
35+
</table>
36+
37+
<br>
38+
<hr>
39+
<h3>Items</h3>
40+
<table class="table">
41+
<thead>
42+
<tr>
43+
<th scope="col"><b>Id & Type</b></th>
44+
<th scope="col"><b>Description</b></th>
45+
<th scope="col"><b>streamId & eventType</b></th>
46+
<th scope="col"><b>Variations</b></th>
47+
</tr>
48+
</thead>
49+
<tbody>
50+
<tr><td>Id: body-vulva-mucus-inspect<br>Type: select</td><td>Cervical Fluid Inspect<br>Visual aspect of cervical fluid inspection</td><td>streamId: body-vulva-mucus-inspect<br>eventType: vulva-mucus-inspect/v0</td><td><pre></pre></td></tr>
51+
<tr><td>Id: body-vulva-mucus-stretch<br>Type: select</td><td>Cervical Fluid Stretch<br>Manual strech test of cervical fluid</td><td>streamId: body-vulva-mucus-stretch<br>eventType: ratio/generic</td><td><pre></pre></td></tr>
52+
<tr><td>Id: body-vulva-wetness-feeling<br>Type: select</td><td>Vulva Wetness feeling<br>Vulava wetness feeling</td><td>streamId: body-vulva-wetness-feeling<br>eventType: ratio/generic</td><td><pre></pre></td></tr>
53+
<tr><td>Id: body-weight<br>Type: number</td><td>Body Weight<br>Measured body weight</td><td>streamId: body-weight<br>eventType: undefined</td><td><pre>eventType:
54+
mass/kg:
55+
label:
56+
en: Kg
57+
mass/lb:
58+
label:
59+
en: Lbs
60+
</pre></td></tr>
61+
<tr><td>Id: family-children-count<br>Type: number</td><td>Nb of children<br>Numer of children at this date</td><td>streamId: family-children<br>eventType: count/generic</td><td><pre></pre></td></tr>
62+
<tr><td>Id: fertility-cycles-charted-count<br>Type: number</td><td>Nb of charted cycles<br>Number of total charted cycles at this date</td><td>streamId: fertility-cycles-charted-estimation<br>eventType: count/generic</td><td><pre></pre></td></tr>
63+
<tr><td>Id: fertility-cycles-ovulation<br>Type: checkbox</td><td>Ovulation Day<br>Flag this day as an ovulation day</td><td>streamId: fertility-cycles-ovulation<br>eventType: activity/plain</td><td><pre></pre></td></tr>
64+
<tr><td>Id: fertility-cycles-start<br>Type: checkbox</td><td>New Cycle<br>Flag this day as a new cycle start</td><td>streamId: fertility-cycles-start<br>eventType: activity/plain</td><td><pre></pre></td></tr>
65+
<tr><td>Id: fertility-miscarriages-count<br>Type: number</td><td>Nb of miscarriages<br>Number of total miscarriages at this date</td><td>streamId: fertility-miscarriages<br>eventType: count/generic</td><td><pre></pre></td></tr>
66+
<tr><td>Id: fertility-ttc-tta<br>Type: select</td><td>Trying to conceive / Avoiding pregnancy<br>Current fertility intention</td><td>streamId: fertility-ttc-tta<br>eventType: ratio/generic</td><td><pre></pre></td></tr>
67+
<tr><td>Id: profile-addresscountry<br>Type: text</td><td>Country<br>Country of living</td><td>streamId: profile-address<br>eventType: contact/country</td><td><pre></pre></td></tr>
68+
<tr><td>Id: profile-contact-name<br>Type: text</td><td>Name<br>Name</td><td>streamId: profile-name<br>eventType: contact/name</td><td><pre></pre></td></tr>
69+
<tr><td>Id: profile-date-of-birth<br>Type: date</td><td>Date of Birth<br>Date of birth</td><td>streamId: profile-date-of-birth<br>eventType: date/iso-8601</td><td><pre></pre></td></tr>
70+
<tr><td>Id: profile-name<br>Type: text</td><td>Surname<br>Surname</td><td>streamId: profile-name<br>eventType: contact/surname</td><td><pre></pre></td></tr>
71+
<tr><td>Id: profile-sex<br>Type: select</td><td>Sex<br>Biological Sex</td><td>streamId: profile-sex<br>eventType: attributes/biological-sex</td><td><pre></pre></td></tr>
72+
</tbody>
73+
</table>
3474
</div>
3575
</body>
3676
</html>

docs/pack.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"publicationDate": "2025-06-05T13:33:50.998Z",
2+
"publicationDate": "2025-06-05T14:53:56.941Z",
33
"streams": [
44
{
55
"id": "body",

src/build.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
const fs = require('fs');
22
const path = require('path');
3+
const YAML = require('yaml');
34

45
const basePath = path.resolve(__dirname, '../docs');
56

7+
const { itemsById } = require('./items');
8+
69
const sources = [
710
require('./schemas/items').toBePublished,
811
require('./streams').toBePublished,
@@ -39,9 +42,20 @@ for (const source of sources) {
3942
const packFilePath = path.resolve(basePath, 'pack.json');
4043
fs.writeFileSync(packFilePath, JSON.stringify(pack, null, 2), 'utf-8');
4144

42-
// -- html table
43-
const htmlTable = htmlTableSrc.map(i => `<tr><td>${i.title}</td><td><a href="${i.link}">${i.linkTxt}</a></tr>`).join('\n');
45+
// -- html table files
46+
const htmlTableFiles = htmlTableSrc.map(i => `<tr><td>${i.title}</td><td><a href="${i.link}">${i.linkTxt}</a></tr>`).join('\n');
4447

4548
const indexHtmlSrc = fs.readFileSync(path.resolve(__dirname, '../docs-src/index.html'), 'utf-8');
46-
const indexHtmlDest = indexHtmlSrc.replace('{TABLE_BODY}', htmlTable);
49+
const indexHtmlDest1 = indexHtmlSrc.replace('{TABLE_FILES}', htmlTableFiles);
50+
51+
// -- html table items
52+
const rowsItems = [];
53+
for (const key of Object.keys(itemsById).sort()) {
54+
const i = itemsById[key];
55+
const variation = i.variations ? YAML.stringify(i.variations, null, 2) : '';
56+
const line = `<tr><td>Id: ${key}<br>Type: ${i.type}</td><td>${i.label.en}<br>${i.description.en}</td><td>streamId: ${i.streamId}<br>eventType: ${i.eventType}</td><td><pre>${variation}</pre></td></tr>`;
57+
rowsItems.push(line);
58+
}
59+
const indexHtmlDest = indexHtmlDest1.replace('{TABLE_ITEMS}', rowsItems.join('\n'));
60+
4761
fs.writeFileSync(path.resolve(basePath, 'index.html'), indexHtmlDest, 'utf-8');

0 commit comments

Comments
 (0)