Skip to content

Commit 1690b59

Browse files
committed
Taking {UPPER_CASE} out of Mpox pattern field
And fix to "host vaccination status menu" range to "HostVaccinationStatusMenu"
1 parent b19ecbc commit 1690b59

File tree

7 files changed

+45
-72
lines changed

7 files changed

+45
-72
lines changed

lib/DataHarmonizer.js

+24-24
Original file line numberDiff line numberDiff line change
@@ -2468,45 +2468,49 @@ class DataHarmonizer {
24682468
let matrixRow = matrix[row];
24692469
matrixRow[col] = change[3]; // prime changed value
24702470

2471-
const prevName = col > 0 ? fields[col - 1].title : null;
2472-
const nextName = fields.length > col + 1 ? fields[col + 1].title : null;
2471+
const prevName = col > 0 ? fields[col - 1].name : null;
2472+
const nextName = fields.length > col + 1 ? fields[col + 1].name : null;
24732473

2474-
// Match <field>[field unit]
2475-
if (nextName === field.title + ' unit') {
2474+
// On [field] where next field is [field unit]
2475+
if (nextName === field.name + '_unit') {
24762476
if (field.datatype === 'xsd:date') {
24772477
// Transform ISO 8601 date to bin year / month granularity.
2478+
// This literally resets day or month to /01/ value based on
2479+
// granularity, for information accuracy or obfuscation purposes.
24782480
// "day" granularity is taken care of by regular date validation.
24792481
// Don't attempt to reformat x/y/z dates here.
2480-
const dateGranularity = this.hot.getDataAtCell(row, col + 1);
2482+
const dateGranularity = this.hot.getDataAtCell(row, col + 1).split(' ')[0];
24812483
// previously had to block x/y/z with change[3].indexOf('/') === -1 &&
24822484
if (dateGranularity === 'year' || dateGranularity === 'month') {
24832485
change[3] = this.setDateChange(dateGranularity, change[3]);
24842486
}
24852487
return;
24862488
}
24872489

2488-
// Match <field>[field unit][field bin]
2490+
/* Deprecating this. Users need to change unit to trigger bin
2491+
// Match <field> [field]_unit [field]_bin
24892492
const nextNextName =
2490-
fields.length > col + 2 ? fields[col + 2].title : null;
2491-
if (nextNextName === field.title + ' bin') {
2493+
fields.length > col + 2 ? fields[col + 2].name : null;
2494+
if (nextNextName === field.name + '_bin') {
24922495
matrixRow[col + 1] = this.hot.getDataAtCell(row, col + 1); //prime unit
24932496
matrixRow[col + 2] = this.hot.getDataAtCell(row, col + 2); //prime bin
24942497
this.binChangeTest(matrix, col, fields, 2, triggered_changes);
24952498
return;
24962499
}
2500+
*/
24972501
}
24982502

2499-
// Match <field>[field bin]
2500-
if (nextName === field.title + ' bin') {
2503+
// On [field] here, where next column is "[field]_bin".
2504+
if (nextName === field.name + '_bin') {
25012505
matrixRow[col + 1] = this.hot.getDataAtCell(row, col + 1); //prime bin
25022506
this.binChangeTest(matrix, col, fields, 1, triggered_changes);
25032507
return;
25042508
}
25052509

2506-
// Match [field]<field unit>
2507-
if (field.title === prevName + ' unit') {
2508-
// Match [field]<field unit>[field bin]
2509-
if (prevName + ' bin' === nextName) {
2510+
// On "[field] unit" here, where next column is [field]_bin.
2511+
if (field.name === prevName + '_unit') {
2512+
if (prevName + '_bin' === nextName) {
2513+
console.log("on", prevName + '_unit')
25102514
// trigger reevaluation of bin from field
25112515
matrixRow[col - 1] = this.hot.getDataAtCell(row, col - 1);
25122516
matrixRow[col] = this.hot.getDataAtCell(row, col);
@@ -2563,20 +2567,20 @@ class DataHarmonizer {
25632567

25642568
// Rules that require a column or two following current one.
25652569
if (fields.length > col + 1) {
2566-
const nexttitle = fields[col + 1].title;
2570+
const nexttitle = fields[col + 1].name;
25672571

25682572
// Rule: for any <x>[x bin] pattern of field names,
25692573
// find and set appropriate bin selection.
2570-
if (nexttitle === field.title + ' bin') {
2574+
if (nexttitle === field.name + '_bin') {
25712575
this.binChangeTest(matrix, col, fields, 1, triggered_changes);
25722576
}
25732577
// Rule: for any [x], [x unit], [x bin] series of fields
2574-
else if (nexttitle === field.title + ' unit') {
2578+
else if (nexttitle === field.name + '_unit') {
25752579
if (fields[col].datatype === 'xsd:date') {
25762580
//Validate
25772581
for (let row = 0; row < matrix.length; row++) {
25782582
if (!matrix[row][col]) continue;
2579-
const dateGranularity = matrix[row][col + 1];
2583+
const dateGranularity = matrix[row][col + 1].split(' ')[0];
25802584
if (dateGranularity === 'year' || dateGranularity === 'month') {
25812585
matrix[row][col] = this.setDateChange(
25822586
dateGranularity,
@@ -2666,15 +2670,12 @@ class DataHarmonizer {
26662670
// Host age unit is interpreted by default to be year.
26672671
// If user selects month, value is converted into years for binning.
26682672
// Future solution won't hardcode month / year assumption
2673+
// ENGLISH ONLY: value might be suffixed with ontology id.
26692674
if (unit) {
2670-
if (unit === 'month') {
2675+
if (unit.split(' ',1)[0] === 'month') {
26712676
number = number / 12;
26722677
}
26732678
}
2674-
// Force unit to be year if empty.
2675-
//else {
2676-
// triggered_changes.push([rowOffset + parseInt(row), col+1, undefined, 'year']);
2677-
//}
26782679
}
26792680
// .flatVocabulary is an array of string bin ranges e.g. "10 - 19"
26802681
// if (typeof fields[hotRowBinCol].flatVocabulary !== 'undefined') {
@@ -2699,7 +2700,6 @@ class DataHarmonizer {
26992700
const bin_values = fields[hotRowBinCol].flatVocabulary;
27002701
if (value in bin_values && (!bin_value || bin_value === '')) {
27012702
selection = value;
2702-
console.log('no bin value', value);
27032703
}
27042704
// If a unit field exists, then set that to metadata too.
27052705
if (binOffset == 2) {

web/templates/canada_covid19/schema.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -7382,7 +7382,7 @@
73827382
],
73837383
"any_of": [
73847384
{
7385-
"range": "host vaccination status menu"
7385+
"range": "HostVaccinationStatusMenu"
73867386
},
73877387
{
73887388
"range": "NullValueMenu"
@@ -12338,7 +12338,7 @@
1233812338
"slot_group": "Host vaccination information",
1233912339
"any_of": [
1234012340
{
12341-
"range": "host vaccination status menu"
12341+
"range": "HostVaccinationStatusMenu"
1234212342
},
1234312343
{
1234412344
"range": "NullValueMenu"

web/templates/canada_covid19/schema.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1687,7 +1687,7 @@ slots:
16871687
comments: Select the vaccination status of the host from the pick list.
16881688
slot_uri: GENEPIO:0001404
16891689
any_of:
1690-
- range: host vaccination status menu
1690+
- range: HostVaccinationStatusMenu
16911691
- range: NullValueMenu
16921692
examples:
16931693
- value: Fully Vaccinated

web/templates/canada_covid19/schema_slots.tsv

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ CanCOGeNCovid19 GENEPIO:0001122 Database Identifiers
6464
Host Information Informations sur l'hôte GENEPIO:0001401 pre-existing conditions and risk factors preexisting_conditions_and_risk_factors Conditions préexistantes et facteurs de risque PreExistingConditionsAndRiskFactorsMenu NullValueMenu TRUE Patient pre-existing conditions and risk factors. <li>Pre-existing condition: A medical condition that existed prior to the current infection. <li>Risk Factor: A variable associated with an increased risk of disease or infection. Conditions préexistantes et facteurs de risque du patient <li>Condition préexistante : Condition médicale qui existait avant l’infection actuelle <li>Facteur de risque : Variable associée à un risque accru de maladie ou d’infection  Select all of the pre-existing conditions and risk factors experienced by the host from the pick list. If the desired term is missing, contact the curation team. Sélectionnez toutes les conditions préexistantes et tous les facteurs de risque de l’hôte à partir de la liste de sélection. S’il manque le terme souhaité, veuillez communiquer avec l’équipe de conservation des données. Asthma; Pregnancy; Smoking Asthme; grossesse; tabagisme pre-existing conditions and risk factors
6565
Host Information Informations sur l'hôte GENEPIO:0001402 complications complications Complications ComplicationsMenu NullValueMenu TRUE Patient medical complications that are believed to have occurred as a result of host disease. Complications médicales du patient qui seraient dues à une maladie de l’hôte Select all of the complications experienced by the host from the pick list. If the desired term is missing, contact the curation team. Sélectionnez toutes les complications éprouvées par l’hôte à partir de la liste de sélection. S’il manque le terme souhaité, veuillez communiquer avec l’équipe de conservation des données. Acute Respiratory Failure; Coma; Septicemia Insuffisance respiratoire aiguë; coma; septicémie complications
6666
GENEPIO:0001403 Host vaccination information
67-
Host vaccination information Informations sur la vaccination de l'hôte GENEPIO:0001404 host vaccination status host_vaccination_status Statut de vaccination de l’hôte host vaccination status menu NullValueMenu The vaccination status of the host (fully vaccinated, partially vaccinated, or not vaccinated). Statut de vaccination de l’hôte (entièrement vacciné, partiellement vacciné ou non vacciné) Select the vaccination status of the host from the pick list. Sélectionnez le statut de vaccination de l’hôte à partir de la liste de sélection. Fully Vaccinated Entièrement vacciné PH_VACCINATION_HISTORY
67+
Host vaccination information Informations sur la vaccination de l'hôte GENEPIO:0001404 host vaccination status host_vaccination_status Statut de vaccination de l’hôte HostVaccinationStatusMenu NullValueMenu The vaccination status of the host (fully vaccinated, partially vaccinated, or not vaccinated). Statut de vaccination de l’hôte (entièrement vacciné, partiellement vacciné ou non vacciné) Select the vaccination status of the host from the pick list. Sélectionnez le statut de vaccination de l’hôte à partir de la liste de sélection. Fully Vaccinated Entièrement vacciné PH_VACCINATION_HISTORY
6868
Host vaccination information Informations sur la vaccination de l'hôte GENEPIO:0001406 number of vaccine doses received number_of_vaccine_doses_received Nombre de doses du vaccin reçues integer The number of doses of the vaccine recived by the host. Nombre de doses du vaccin reçues par l’hôte Record how many doses of the vaccine the host has received. Enregistrez le nombre de doses du vaccin que l’hôte a reçues. 2 2
6969
Host vaccination information Informations sur la vaccination de l'hôte GENEPIO:0100313 vaccination dose 1 vaccine name vaccination_dose_1_vaccine_name Dose du vaccin 1 – Nom du vaccin VaccineNameMenu NullValueMenu The name of the vaccine administered as the first dose of a vaccine regimen. Nom du vaccin administré comme première dose d’un schéma vaccinal Provide the name and the corresponding manufacturer of the COVID-19 vaccine administered as the first dose by selecting a value from the pick list Fournissez le nom et le fabricant correspondant du vaccin contre la COVID-19 administré comme première dose en sélectionnant une valeur à partir de la liste de sélection. Pfizer-BioNTech (Comirnaty) Pfizer-BioNTech (Comirnaty) PH_VACCINATION_HISTORY
7070
Host vaccination information Informations sur la vaccination de l'hôte GENEPIO:0100314 vaccination dose 1 vaccination date vaccination_dose_1_vaccination_date Dose du vaccin 1 – Date du vaccin date NullValueMenu {today} The date the first dose of a vaccine was administered. Date à laquelle la première dose d’un vaccin a été administrée Provide the date the first dose of COVID-19 vaccine was administered. The date should be provided in ISO 8601 standard format "YYYY-MM-DD". Indiquez la date à laquelle la première dose du vaccin contre la COVID-19 a été administrée. La date doit être fournie selon le format standard ISO 8601 « AAAA-MM-DD ». 2021-03-01 2021-03-01 PH_VACCINATION_HISTORY

web/templates/mpox/schema.json

+7-28
Original file line numberDiff line numberDiff line change
@@ -9909,7 +9909,6 @@
99099909
"MpoxInternational"
99109910
],
99119911
"range": "WhitespaceMinimizedString",
9912-
"pattern": "{UPPER_CASE}",
99139912
"structured_pattern": {
99149913
"syntax": "{UPPER_CASE}",
99159914
"interpolated": true,
@@ -9939,7 +9938,6 @@
99399938
"MpoxInternational"
99409939
],
99419940
"range": "WhitespaceMinimizedString",
9942-
"pattern": "{UPPER_CASE}",
99439941
"structured_pattern": {
99449942
"syntax": "{UPPER_CASE}",
99459943
"interpolated": true,
@@ -10009,7 +10007,7 @@
1000910007
],
1001010008
"examples": [
1001110009
{
10012-
"value": "BC Centre for Disease Control"
10010+
"value": "BCCDC Public Health Laboratory"
1001310011
}
1001410012
],
1001510013
"from_schema": "https://example.com/mpox",
@@ -10535,7 +10533,7 @@
1053510533
},
1053610534
"collection_method": {
1053710535
"name": "collection_method",
10538-
"description": "The process used to collect the sample e.g. phlebotamy, necropsy.",
10536+
"description": "The process used to collect the sample e.g. phlebotomy, necropsy.",
1053910537
"title": "collection method",
1054010538
"comments": [
1054110539
"Provide a descriptor if a collection method was used for sampling. Use the picklist provided in the template. If a desired term is missing from the picklist, contact [email protected]. If not applicable, do not leave blank. Choose a null value."
@@ -10907,12 +10905,7 @@
1090710905
"domain_of": [
1090810906
"Mpox",
1090910907
"MpoxInternational"
10910-
],
10911-
"structured_pattern": {
10912-
"syntax": "{Title_Case}",
10913-
"interpolated": true,
10914-
"partial_match": false
10915-
}
10908+
]
1091610909
},
1091710910
"host_residence_geo_loc_name_country": {
1091810911
"name": "host_residence_geo_loc_name_country",
@@ -15091,7 +15084,6 @@
1509115084
],
1509215085
"slot_group": "Database Identifiers",
1509315086
"range": "WhitespaceMinimizedString",
15094-
"pattern": "{UPPER_CASE}",
1509515087
"structured_pattern": {
1509615088
"syntax": "{UPPER_CASE}",
1509715089
"interpolated": true,
@@ -15125,7 +15117,6 @@
1512515117
],
1512615118
"slot_group": "Database Identifiers",
1512715119
"range": "WhitespaceMinimizedString",
15128-
"pattern": "{UPPER_CASE}",
1512915120
"structured_pattern": {
1513015121
"syntax": "{UPPER_CASE}",
1513115122
"interpolated": true,
@@ -15176,7 +15167,7 @@
1517615167
],
1517715168
"examples": [
1517815169
{
15179-
"value": "BC Centre for Disease Control"
15170+
"value": "BCCDC Public Health Laboratory"
1518015171
}
1518115172
],
1518215173
"from_schema": "https://example.com/mpox",
@@ -15839,7 +15830,7 @@
1583915830
},
1584015831
"collection_method": {
1584115832
"name": "collection_method",
15842-
"description": "The process used to collect the sample e.g. phlebotamy, necropsy.",
15833+
"description": "The process used to collect the sample e.g. phlebotomy, necropsy.",
1584315834
"title": "collection method",
1584415835
"comments": [
1584515836
"Provide a descriptor if a collection method was used for sampling. Use the picklist provided in the template. If a desired term is missing from the picklist, contact [email protected]. If not applicable, do not leave blank. Choose a null value."
@@ -16350,11 +16341,6 @@
1635016341
],
1635116342
"slot_group": "Host Information",
1635216343
"required": true,
16353-
"structured_pattern": {
16354-
"syntax": "{Title_Case}",
16355-
"interpolated": true,
16356-
"partial_match": false
16357-
},
1635816344
"any_of": [
1635916345
{
1636016346
"range": "HostGenderMenu"
@@ -20233,7 +20219,6 @@
2023320219
],
2023420220
"slot_group": "Database Identifiers",
2023520221
"range": "WhitespaceMinimizedString",
20236-
"pattern": "{UPPER_CASE}",
2023720222
"structured_pattern": {
2023820223
"syntax": "{UPPER_CASE}",
2023920224
"interpolated": true,
@@ -20267,7 +20252,6 @@
2026720252
],
2026820253
"slot_group": "Database Identifiers",
2026920254
"range": "WhitespaceMinimizedString",
20270-
"pattern": "{UPPER_CASE}",
2027120255
"structured_pattern": {
2027220256
"syntax": "{UPPER_CASE}",
2027320257
"interpolated": true,
@@ -20345,7 +20329,7 @@
2034520329
],
2034620330
"examples": [
2034720331
{
20348-
"value": "BC Centre for Disease Control"
20332+
"value": "BCCDC Public Health Laboratory"
2034920333
}
2035020334
],
2035120335
"from_schema": "https://example.com/mpox",
@@ -20990,7 +20974,7 @@
2099020974
},
2099120975
"collection_method": {
2099220976
"name": "collection_method",
20993-
"description": "The process used to collect the sample e.g. phlebotamy, necropsy.",
20977+
"description": "The process used to collect the sample e.g. phlebotomy, necropsy.",
2099420978
"title": "collection method",
2099520979
"comments": [
2099620980
"Provide a descriptor if a collection method was used for sampling. Use the picklist provided in the template. If a desired term is missing from the picklist, contact [email protected]. If not applicable, do not leave blank. Choose a null value."
@@ -21611,11 +21595,6 @@
2161121595
],
2161221596
"slot_group": "Host Information",
2161321597
"recommended": true,
21614-
"structured_pattern": {
21615-
"syntax": "{Title_Case}",
21616-
"interpolated": true,
21617-
"partial_match": false
21618-
},
2161921598
"any_of": [
2162021599
{
2162121600
"range": "HostGenderInternationalMenu"

web/templates/mpox/schema.yaml

+2-8
Original file line numberDiff line numberDiff line change
@@ -1753,7 +1753,6 @@ slots:
17531753
Sequence Archive (GSA) accessions start with CRR.
17541754
slot_uri: GENEPIO:0101203
17551755
range: WhitespaceMinimizedString
1756-
pattern: '{UPPER_CASE}'
17571756
structured_pattern:
17581757
syntax: '{UPPER_CASE}'
17591758
partial_match: false
@@ -1773,7 +1772,6 @@ slots:
17731772
the GenBank accession version.
17741773
slot_uri: GENEPIO:0101204
17751774
range: WhitespaceMinimizedString
1776-
pattern: '{UPPER_CASE}'
17771775
structured_pattern:
17781776
syntax: '{UPPER_CASE}'
17791777
partial_match: false
@@ -1828,7 +1826,7 @@ slots:
18281826
slot_uri: GENEPIO:0001153
18291827
required: true
18301828
examples:
1831-
- value: BC Centre for Disease Control
1829+
- value: BCCDC Public Health Laboratory
18321830
sample_collector_contact_email:
18331831
name: sample_collector_contact_email
18341832
title: sample collector contact email
@@ -2155,7 +2153,7 @@ slots:
21552153
collection_method:
21562154
name: collection_method
21572155
title: collection method
2158-
description: The process used to collect the sample e.g. phlebotamy, necropsy.
2156+
description: The process used to collect the sample e.g. phlebotomy, necropsy.
21592157
comments: Provide a descriptor if a collection method was used for sampling. Use
21602158
the picklist provided in the template. If a desired term is missing from the
21612159
picklist, contact [email protected]. If not applicable, do not leave blank.
@@ -2355,10 +2353,6 @@ slots:
23552353
description: The gender of the host at the time of sample collection.
23562354
comments: If known, select a value from the pick list.
23572355
slot_uri: GENEPIO:0001395
2358-
structured_pattern:
2359-
syntax: '{Title_Case}'
2360-
partial_match: false
2361-
interpolated: true
23622356
host_residence_geo_loc_name_country:
23632357
name: host_residence_geo_loc_name_country
23642358
title: host residence geo_loc name (country)

0 commit comments

Comments
 (0)