-
Notifications
You must be signed in to change notification settings - Fork 2
Add a new Datasource
Davide Macchia edited this page Sep 5, 2022
·
10 revisions
If you are a Data Provider and you want to upload the model of your data, follow this guide:
- Add a new unique DatasourceCode on descriptor.enum (e.g. THEGUARDIAN = "THEGUARDIAN").
- Create a new folder under src/source (e.g. /src/source/theguardian).
- In the new folder, create a Model (model.theguardian.ts) containing all the interfaces that describes the datasource's information.
- Add the new file to the index.ts under /source/ folder (export * from './theguardian/model.theguardian').
- If the Datasource contains multiple files (e.g Google datasource) add a new Enumeration into descriptor.enum with a RegEx for each file of the new datasource
- Add the new enumeration to the FileCode type
- Add a description for each new FileCode into descriptor.json, skip this step otherwise.
- if the Datasource can be exported, describe the procedure into the descriptor.json.
- Create a new Validator file under the new folder (e.g. /src/source/theguradian/validator.theguardian.ts). The Validator must have a default list of FileCodes, must extends the ValidatorDatasource class and overwrite the functions to let the FileCodes' RegEx match the files' pathnames.
- Update all the functions related functions under Selector.
- Update the index.ts
- Create a new Service file under the new folder (e.g. /src/source/theguradian/service.theguardian.ts).
- The Service must parse each file of the Datasource and map them into a specific interface of the Model, must have a parseFile function.
- Update all the functions related functions under Selector.
- Update the index.ts
- Create a new Processor file under the new folder (e.g. /src/source/theguradian/processor.theguardian.ts), it must implements ProcessorDatasource using the decorator
@staticImplements<ProcessorDatasource>()
.
@staticImplements<ProcessorDatasource>()
export class ProcessorTheguardian {
...
}