Skip to content

Commit

Permalink
gh-308 - address pr feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
abwilson23 committed Mar 31, 2023
1 parent 50bc535 commit 55e02fb
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 36 deletions.
6 changes: 3 additions & 3 deletions docs/CONCEPTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ The primary use case of the Mauro Data Explorer is to:
3. Submit this user data specification to the organisation running this instance to gain access to the real data sets owned by the organisation,
based on the data elements specified.

The current implementation considers user data specification to be _data models_ in their own right - they are created under the access level of the user signed-in to the Mauro Data Explorer, then populated with data elements before they are submitted. The sections below go into further detail.
The current implementation considers user data specifications to be _data models_ in their own right - they are created under the access level of the user signed-in to the Mauro Data Explorer, then populated with data elements before they are submitted. The sections below go into further detail.

## Data Specifications Folder

Expand Down Expand Up @@ -116,7 +116,7 @@ It is possible for a user to create a new version of a previously submitted data

# Template Requests

Instead of creating User Data Specifications from scratch, it is possible to base a data specification off of a _template_. This is a pre-made data specification that is finalised and can be forked to make a copy from.
Instead of creating user data specifications from scratch, it is possible to base a data specification off of a _template_. This is a pre-made data specification that is finalised and can be forked to make a copy from.

## Templates Folder

Expand All @@ -126,4 +126,4 @@ The `mdm-plugin-explorer` will automatically:
2. Secure this folder to only be read by the "Explorer Readers" user group.
3. Install the API property `explorer.config.root_-_template_folder` pointing to this folder.

This will be the root folder to store any finalised template data specifications. The Mauro Data Explorer `/templates` page route will list all available templates and allow the user to inspect them and copy from them. Copying involves forking the Data Model data specification to build the copy, which is then automatically moved to the current user's personal data specification folder.
This will be the root folder to store any finalised template data specifications. The Mauro Data Explorer `/templates` page route will list all available templates and allow the user to inspect them and copy from them. Copying involves forking the template data specification to build the copy, which is then automatically moved to the current user's personal data specification folder.
4 changes: 3 additions & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,9 @@ export class AppComponent implements OnInit, OnDestroy {
return EMPTY;
}),
map((dataSpecifications) => {
return dataSpecifications.filter((req) => req.status === 'unsent').length;
return dataSpecifications.filter(
(specification) => specification.status === 'unsent'
).length;
})
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/data-explorer/data-specification.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ describe('DataSpecificationService', () => {
],
};

dataModelsStub.getDataModelHierarchy.mockImplementationOnce((req) => {
expect(req).toBe(dataSpecification.id);
dataModelsStub.getDataModelHierarchy.mockImplementationOnce((specification) => {
expect(specification).toBe(dataSpecification.id);
return cold('--a|', {
a: hierarchy,
});
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/dashboard/dashboard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class DashboardComponent implements OnInit {
return throwError(() => error);
}),
map((dataSpecifications) =>
dataSpecifications.filter((req) => req.status === 'unsent')
dataSpecifications.filter((specification) => specification.status === 'unsent')
)
)
.subscribe((dataSpecifications: DataSpecification[]) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ describe('DataSpecificationQueryComponent', () => {
return of(dataSpecification);
});

dataSpecificationStub.listDataElements.mockImplementationOnce((req) => {
expect(req).toStrictEqual(dataSpecification);
dataSpecificationStub.listDataElements.mockImplementationOnce((specification) => {
expect(specification).toStrictEqual(dataSpecification);
return of(dataElements);
});

Expand All @@ -201,8 +201,8 @@ describe('DataSpecificationQueryComponent', () => {
return of(dataSpecification);
});

dataSpecificationStub.listDataElements.mockImplementationOnce((req) => {
expect(req).toStrictEqual(dataSpecification);
dataSpecificationStub.listDataElements.mockImplementationOnce((specification) => {
expect(specification).toStrictEqual(dataSpecification);
return of([]);
});

Expand All @@ -229,8 +229,8 @@ describe('DataSpecificationQueryComponent', () => {
return of(dataSpecification);
});

dataSpecificationStub.listDataElements.mockImplementationOnce((req) => {
expect(req).toStrictEqual(dataSpecification);
dataSpecificationStub.listDataElements.mockImplementationOnce((specification) => {
expect(specification).toStrictEqual(dataSpecification);
return of(dataElements);
});

Expand Down
10 changes: 5 additions & 5 deletions src/app/pages/my-bookmarks/my-bookmarks.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ describe('MyBookmarkComponent', () => {
return { ...bm, isSelected: false };
});
const rootDataModel = { id: 'ID' } as DataModelDetail;
const dar1 = {} as DataModel;
const dar2 = {} as DataModel;
const dataSpecification1 = {} as DataModel;
const dataSpecification2 = {} as DataModel;
const sti1 = {} as SourceTargetIntersection;
const sti2 = {} as SourceTargetIntersection;
const intersections: DataSpecificationSourceTargetIntersections = {
dataSpecifications: [dar1, dar2],
dataSpecifications: [dataSpecification1, dataSpecification2],
sourceTargetIntersections: [sti1, sti2],
};

Expand Down Expand Up @@ -137,10 +137,10 @@ describe('MyBookmarkComponent', () => {
harness.component.sourceTargetIntersections.sourceTargetIntersections.length
).toBe(2);
expect(harness.component.sourceTargetIntersections.dataSpecifications[0]).toBe(
dar1
dataSpecification1
);
expect(harness.component.sourceTargetIntersections.dataSpecifications[1]).toBe(
dar2
dataSpecification2
);
expect(
harness.component.sourceTargetIntersections.sourceTargetIntersections[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ export class MyDataSpecificationsComponent implements OnInit {
) {}

get hasMultipleStatuses() {
const statuses = this.allDataSpecifications.map((req) => req.status);
const statuses = this.allDataSpecifications.map(
(specification) => specification.status
);
const distinct = new Set(statuses);
return distinct.size > 1;
}
Expand Down Expand Up @@ -111,8 +113,8 @@ export class MyDataSpecificationsComponent implements OnInit {
const filtered =
this.statusFilters.length === 0
? this.allDataSpecifications
: this.allDataSpecifications.filter((req) =>
this.statusFilters.includes(req.status)
: this.allDataSpecifications.filter((specification) =>
this.statusFilters.includes(specification.status)
);

this.sortBy = sortBy ?? this.sortByDefaultOption;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ describe('TemplateDataSpecificationDetailComponent', () => {

dataSpecificationStub.get.mockImplementationOnce(() => of(template));

dataSchemaStub.loadDataSchemas.mockImplementationOnce((req) => {
expect(req).toBe(template);
dataSchemaStub.loadDataSchemas.mockImplementationOnce((specification) => {
expect(specification).toBe(template);
expect(harness.component.state).toBe('loading');
return of(dataSchemas);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,18 @@ describe('TemplateDataSpecificationsComponent', () => {
});

it('should copy a template to a new data specification', () => {
dataSpecificationStub.forkWithDialogs.mockImplementationOnce((req, options) => {
expect(req).toBe(dataSpecification);
expect(options?.targetFolder).toBe(dataSpecificationFolder);
return of({
...dataSpecification,
id: '3',
label: 'copied data specification',
status: 'unsent',
});
});
dataSpecificationStub.forkWithDialogs.mockImplementationOnce(
(specification, options) => {
expect(specification).toBe(dataSpecification);
expect(options?.targetFolder).toBe(dataSpecificationFolder);
return of({
...dataSpecification,
id: '3',
label: 'copied data specification',
status: 'unsent',
});
}
);

harness.component.copy(dataSpecification);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,11 @@ export class DataElementInDataSpecificationComponent implements OnInit, OnDestro
.map((sti) => sti.targetDataModelId);

this.dataSpecificationMenuItems = this.sourceTargetIntersections.dataSpecifications
.map((req) => {
.map((specification) => {
return {
dataModel: req,
dataModel: specification,
containsElement: idsOfDataSpecificationsContainingElement.includes(
req.id ?? ''
specification.id ?? ''
),
};
})
Expand Down

0 comments on commit 55e02fb

Please sign in to comment.