Refactor Client package to use shared Lectern types#211
Merged
Conversation
abae411 to
592dd74
Compare
- helps simply type notation when processing DataRecords in client
The client provides the logic for processing and validating data, any parallelization that is desired should be added to a server implementation and not in the reusable client.
Also updated messages in tests that have changed during code cleanup
592dd74 to
b656e53
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a major refactor of the lectern client code. The starting point was the code as copied from js-lectern-client. The objective of the refactor is to:
anytypesCode Reorganization
Actions Taken on Original Code
src/change-analyzer.ts: Provides a different structure for reviewing changes retrieved from the lectern server diff between schemassrc/changeAnalyzersrc/schema-entities.ts: Types to support client, most were duplicate of the shared lectern dictionary typessrc/types/dataRecord.tssrc/schema-functions.ts: This included code for processing raw TSV data, organizing validation pipelines, and all the validation logic for each restriction typesrc/processingsrc/validationsrc/schema-error-messages.ts: Code used for generating the error content for validation and processing failuressrc/validation/types/validationErrorTypes.tssrc/schema-rest-client.ts: Data fetching from a Lectern serversrc/rest/index.tssrc/utils.ts: Type checking functions and a few other formatting utilitiesChecksnamespace and functions deleted, all references to this were removedsrc/parallel.tsandsrc/schema-worker.ts: Node server solution for running theprocessfunction in a worker threadNew Code Structure
src/changeAnalysis: Processing for schema diffs retrieved from Lectern Server. Appears to be added for ICGC ARGO. Consider for removal from Lectern Client unless a general need for this is identified.src/processing: Raw data processing. Exports the functions that raw TSV data is passed to to be checked vs a Lectern dictionary. Relies heavily on thevalidationmodule.src/rest: Rest client to fetch dictionaries and diffs from Lectern. This can be heavily expanded in future work to interact with all of Lectern's REST features.src/types: TS types to represent the TSV data records provided for validation.src/validation: Functionality to validate data records.src/validation/dataRecordValidation: Validation code for unprocessed data records. Includes checks such as confirming the all columns are provided, no unrecognized columns are provided, and that the data provided is the expected type (string/number/boolean, an array, etc.)src/validation/fieldRestrictions: Validation code for a single field in a data record. Includes checks such as Regex, Range, Scripts etc.src/validation/schemaRestrictions: Validation code for an entire schema or data dictionary. Includes the UniqueKey and ForeignKey checkssrc/validation/types: Validation function structure and error response typessrc/validation/utils: Utilities for interacting with data records used by several validation functions