Skip to content

Commit

Permalink
Fix Data Quality Components (#678)
Browse files Browse the repository at this point in the history
* Add precision dropdown to date object

* Refactor Date and Datetime Components

Handling precision.

* Update package.json version to 1.4.0-beta.16

* Update package.json version to 1.4.0-beta.16

* chore: Update package.json version to 1.5.0-beta.1

* Update package.json version to 1.5.0-beta.7

* Add "Reference" to Evaluation Procedure

Also code formatting single quote to double quote

* Revert to single quotes

* Refactor .prettierrc.js to use single quotes for consistency

* chore: Update alert styling in md-standalone-quality-report template

* Refactor md-quality-report templates to use model.name for input value

* feat: Update md-quality-report template to use quantitativeValue for input value

* chore: Bump version to 1.5.0-beta.5 in package.json

* chore: Remove console.log statement in md-datetime component

* chore: Update mdcodes and mdjson-schemas dependencies to latest beta versions

* chore: Bump version to 1.5.0-beta.10 in package.json

* Refactor md-quality-report templates to use model.name for input value

* chore: Update mdjson-schemas dependency to version 2.9.2-beta.19

* chore: Update mdjson-schemas and mdcodes dependencies to latest beta versions

* Refactor md-codelist component to remove console.log statement

* chore: Update mdjson-schemas and mdcodes dependencies to latest beta versions

* Revert changes

* chore: Bump version to 1.5.0-beta.13 in package.json

* chore: Update mdcodes and mdjson-schemas dependencies to latest stable versions

* chore: Update mdcodes and mdjson-schemas dependencies to latest beta versions

* chore: Bump version to 1.5.0-beta.15 in package.json

* chore: Bump version to 1.6.0-beta.0 in package.json

* feat: Add Simple HTML option to the translator dropdown

* chore: Bump version to 1.5.0-beta.16 in package.json

* chore: Update mdcodes and mdjson-schemas dependencies to latest beta versions

* Updates

Fix Lineage Source Citation Identitfier - set simpleIdentifier to true
Add identification reference to taxonomy collection
Remove modifications from system preview

* Require standalone quality report reference

* chore: Update versions

mdJson-schemas to v2.9.3-beta.3
mdCodes to v2.9.4-beta.4

* Add "on <today's date>" to Taxonomy System->Citation->Other Details

* Fix typo

* Fix Input

Codelist not string

* feat: Update md-datetime component to use single quotes consistently

* Update md-datetime component to use single quotes consistently

* Update md-datetime component to use single quotes consistently

* Remove modifications from system preview template

* chore: Bump version to 1.5.0-beta.19 in package.json

* Remove modifications from system preview template

* Update md-datetime component to use single quotes consistently

* chore: Bump version to 1.5.0-beta.20 in package.json

* Update md-datetime component to use ISO 8601 format consistently

* chore: Bump version to 1.5.0-beta.25 in package.json

* chore: Update npm dependencies to latest versions

* Add precision control to date range

* chore: Bump version to 1.5.0-beta.26 in package.json

* feat: Add Altitude Min/Max and Units Inputs to Bounding Box

* chore: Bump version to 1.5.0-beta.27 in package.json
  • Loading branch information
jwaspin authored Jul 1, 2024
1 parent 736074c commit 9b713e5
Show file tree
Hide file tree
Showing 26 changed files with 767 additions and 462 deletions.
5 changes: 5 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

module.exports = {
singleQuote: true,
};
132 changes: 69 additions & 63 deletions app/pods/components/control/md-itis/component.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,12 @@
import Component from '@ember/component';
import {
inject as service
} from '@ember/service';
import {
computed,
set,
get,
getWithDefault
} from '@ember/object';
import {
or
} from '@ember/object/computed';
import {
isArray,
A
} from '@ember/array';
import {
later
} from '@ember/runloop';
import {
assert
} from '@ember/debug';
import { inject as service } from '@ember/service';
import { computed, set, get, getWithDefault } from '@ember/object';
import { or } from '@ember/object/computed';
import { isArray, A } from '@ember/array';
import { later } from '@ember/runloop';
import { assert } from '@ember/debug';
import moment from 'moment';
import {
formatCitation
} from '../../object/md-citation/component';
import { formatCitation } from '../../object/md-citation/component';

export default Component.extend({
init() {
Expand Down Expand Up @@ -61,19 +43,20 @@ export default Component.extend({
this.set('isLoading', true);
this.set('searchResult', null);

itis.sendQuery(this.searchString, this.kingdom, this.limit).then(response => {

if(!response) {
return;
}
itis
.sendQuery(this.searchString, this.kingdom, this.limit)
.then((response) => {
if (!response) {
return;
}

let docs = response.response.docs;
let data = docs.map(doc => itis.parseDoc(doc));
let docs = response.response.docs;
let data = docs.map((doc) => itis.parseDoc(doc));

this.set('searchResult', data);
this.set('total', response.response.numFound);
this.set('isLoading', false);
});
this.set('searchResult', data);
this.set('total', response.response.numFound);
this.set('isLoading', false);
});
},
actions: {
search() {
Expand All @@ -82,58 +65,81 @@ export default Component.extend({
selectItem(item) {
item.set('animate', true);
item.set('selected', true);
later(this, function () {
this.searchResult.removeObject(item);
this.selected.pushObject(item);
}, 250);
later(
this,
function () {
this.searchResult.removeObject(item);
this.selected.pushObject(item);
},
250
);
},
deselectItem(item) {
item.set('selected', false);
later(this, function () {
this.selected.removeObject(item);
this.searchResult.pushObject(item);
}, 250);
later(
this,
function () {
this.selected.removeObject(item);
this.searchResult.pushObject(item);
},
250
);
},
importTaxa(taxa) {
let taxonomy = this.taxonomy;
let itisCitation = this.get('itis.citation');

let classification = set(taxonomy, 'taxonomicClassification', getWithDefault(taxonomy,
'taxonomicClassification', []));
let systems= set(taxonomy, 'taxonomicSystem', getWithDefault(taxonomy,
'taxonomicSystem', [{citation:{}}]));
let system = systems.findBy('citation.title', get(itisCitation,'title'));

let allTaxa = taxa.reduce((acc, itm) => acc.pushObjects(itm.taxonomy), []);
let classification = set(
taxonomy,
'taxonomicClassification',
getWithDefault(taxonomy, 'taxonomicClassification', [])
);
let systems = set(
taxonomy,
'taxonomicSystem',
getWithDefault(taxonomy, 'taxonomicSystem', [{ citation: {} }])
);
let system = systems.findBy('citation.title', get(itisCitation, 'title'));

let allTaxa = taxa.reduce(
(acc, itm) => acc.pushObjects(itm.taxonomy),
[]
);
let today = moment().format('YYYY-MM-DD');
let dateObj = {
date: today,
dateType: 'transmitted',
description: 'Taxa imported from ITIS'
description: 'Taxa imported from ITIS',
};
itisCitation.otherCitationDetails = [
`Retrieved from the Integrated Taxonomic Information System on-line database, https://www.itis.gov on ${today}.`,
];

allTaxa.forEach(itm => this.itis.mergeTaxa(itm, classification));
allTaxa.forEach((itm) => this.itis.mergeTaxa(itm, classification));

if(!system) {
if (!system) {
itisCitation.get('date').pushObject(dateObj);
systems.pushObject({
citation: itisCitation
citation: itisCitation,
});
} else {
let citation = set(system, 'citation', getWithDefault(system,'citation', {}));
let citation = set(
system,
'citation',
getWithDefault(system, 'citation', {})
);
formatCitation(citation);

let date = A(get(citation, 'date'));

if(!date.findBy('date', today)) {
if (!date.findBy('date', today)) {
date.pushObject(dateObj);
}
}

this.flashMessages
.success(
`Successfully imported ${ allTaxa.length } taxa from ITIS.`
);
}
}
this.flashMessages.success(
`Successfully imported ${allTaxa.length} taxa from ITIS.`
);
},
},
});
45 changes: 23 additions & 22 deletions app/pods/components/input/md-codelist/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ export default Select.extend({
this._super(...arguments);

//define cp using a dynamic dependent property
defineProperty(this, 'mdCodelist',
defineProperty(
this,
'mdCodelist',
computed(`mdCodes.${this.mdCodeName}.codelist.[]`, function () {
return this.mdCodes
.get(this.mdCodeName)
.codelist
//.uniqBy(codeName)
.sortBy(this.namePath);
const codelist = this.mdCodes.get(this.mdCodeName).codelist;
if (this.disableSort) {
return codelist;
}
return codelist.sortBy(this.namePath);
})
);
},
Expand Down Expand Up @@ -118,7 +120,7 @@ export default Select.extend({
* @type String
* @default 'Select one option'
*/
placeholder: "Select one option",
placeholder: 'Select one option',

/**
* Form label for select list
Expand All @@ -141,10 +143,9 @@ export default Select.extend({
selectedItem: computed('value', function () {
let value = this.value;

return this.codelist
.find((item) => {
return item['codeId'] === value;
});
return this.codelist.find((item) => {
return item['codeId'] === value;
});
}),

// mdCodelist: computed('mdCodeName', function() {
Expand Down Expand Up @@ -176,11 +177,12 @@ export default Select.extend({
this.mdCodelist.forEach((item) => {
let newObject = {
codeId: item[codeId],
codeName: this.mdCodes.get(
`codeOverrides.${this.mdCodeName}.${item[codeName]}`) ||
item[codeName],
codeName:
this.mdCodes.get(
`codeOverrides.${this.mdCodeName}.${item[codeName]}`
) || item[codeName],
tooltip: item[tooltip],
icon: icons.get(item[codeName]) || icons.get(defaultIcon)
icon: icons.get(item[codeName]) || icons.get(defaultIcon),
};
codelist.pushObject(newObject);
});
Expand All @@ -203,10 +205,10 @@ export default Select.extend({
let create = this.create;
let filter = this.filterId;

if(value) {
if(create) {
if (value) {
if (create) {
let found = codelist.findBy('codeId', value);
if(found === undefined) {
if (found === undefined) {
let newObject = this.createCode(value);
codelist.pushObject(newObject);
}
Expand All @@ -227,7 +229,7 @@ export default Select.extend({
return {
codeId: code,
codeName: code,
description: 'Undefined'
description: 'Undefined',
};
},

Expand Down Expand Up @@ -259,7 +261,6 @@ export default Select.extend({
let code = this.createCode(selected);

this.setValue(code);
}
}

},
},
});
Loading

0 comments on commit 9b713e5

Please sign in to comment.