# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['edfi_lms_harmonizer', 'edfi_lms_harmonizer.helpers']

package_data = \
{'': ['*'], 'edfi_lms_harmonizer': ['scripts/mssql/*', 'scripts/postgresql/*']}

install_requires = \
['ConfigArgParse>=1.4.1,<2.0.0',
 'SQLAlchemy==1.3.23',
 'edfi-lms-extractor-lib>=1.1.0,<2.0.0',
 'edfi-sql-adapter>=1.0.0,<2.0.0',
 'errorhandler>=2.0.1,<3.0.0',
 'pandas>=1.2.4,<2.0.0',
 'pyodbc>=4.0.30,<5.0.0',
 'python-dotenv>=0.17.1,<0.18.0',
 'sqlparse>=0.4.1,<0.5.0']

setup_kwargs = {
    'name': 'edfi-lms-harmonizer',
    'version': '1.2.0',
    'description': 'Ed-Fi LMS Toolkit Harmonizer',
    'long_description': '# lms-harmonizer\n\nUtility / process for linking LMS data with SIS data in an Ed-Fi ODS. Assumes\nthat LMS data have been retrieved from an LMS via an LMS Extractors and uploaded\ninto tables in the lms schema via LMS Data Store Loader.\n\n## Harmonization Process\n\nThe primary duty of the LMS Harmonizer is to match Student and Sections found in\nthe data extracted from upstream Learning Management Systems (LMS) with the same\nentities in an Ed-Fi ODS database, which are sourced from a Student Information\nSystem (SIS). These systems often do not have perfect alignment, so that the\n"harmonization" process used by this tool is imperfect and may need\ncustomization to fit your implementation.\n\nAny LMS records that cannot be matched to SIS records are considered\n"exceptions"; you can generate CSV exports listing the exceptions by using one\nof the command line options described below. With that information, you can then\neither update the LMS source system by providing it with additional information,\nor you can customize this process.\n\nThe out-of-the box solution has the following mapping logic:\n\n### Student Mapping\n\nFor Canvas and Schoology, the default assumption is that the SIS\'s unique\nidentifier for the student, which has been loaded into the\n`Student.StudentUniqueId` field via the Ed-FI ODS / PAI, has also been loaded\ninto the LMS in the following field:\n\n* Canvas: `sis_user_id` ([API documentation](https://canvas.instructure.com/doc/api/users.html#User))\n* Schoology: `school_uid` ([API documentation](https://developers.schoology.com/api-documentation/rest-api-v1/user))\n\nGoogle Classroom does not have such a field. Instead, the Harmonizer assumes\nthat the student\'s email address used in Google Classroom is also recorded in\nthe SIS and loaded into the ODS. The Harmonizer then does a simple matching of\nrecords by that email address, under the assumption that no two students have\nthe same email address.\n\n### Section Mapping\n\nThe solution currently assumes that the SIS has a globally-unique identifier,\nwhich has been loaded into the `Section.SectionIdentifier` field in the ODS /\nAPI. This same value is then assumed to be loaded into the following field for each LMS:\n\n* Canvas: `sis_section_id` on a course ([API\n  documentation](https://canvas.instructure.com/doc/api/courses.html))\n* Google Classroom: `course.aliases` object ([API\n  documentation](https://developers.google.com/classroom/reference/rest/v1/courses.aliases))\n* Schoology: `section_school_code` on a course section ([API\n  documentation](https://developers.schoology.com/api-documentation/rest-api-v1/course-section))\n\n### Customization\n\nIf your implementation does not match the logic described above, then you can clone\nthis repository and modify the stored procedures to fit alternate logic.\n\n## Getting Started\n\n1. Requires Python 3.9+ and Poetry.\n1. Requires that you have the ODS/API Suite 3, Version 5.2 or Version 5.3 and have [installed the\n   Ed-Fi-LMS extension](../../docs/installing-the-extension.md).\n1. Install required Python packages:\n\n   ```bash\n   poetry install\n   ```\n\n1. Create a `.env` file, or plan to pass all [configuration](#configuration) via\n   command line arguments. See [.env.example](.env.example).\n\n### Configuration\n\nSupported parameters:\n\n| Description                 | Required            | Command Line Argument                   | Environment Variable        |\n| --------------------------- | ------------------- | --------------------------------------- | --------------------------- |\n| DB Engine                   | no                  | `-g` or `--engine` (mssql | postgresql) | DB_ENGINE                   |\n| DB Server                   | yes                 | `-s` or `--server`                      | DB_SERVER                   |\n| DB Port                     | no (default: 1433)  | `--port`                                | DB_PORT                     |\n| DB Name                     | yes                 | `-d` or `--dbname`                      | DB_NAME                     |\n| Exceptions report directory | no (no default)     | `-e` or `--exceptions-report-directory` | EXCEPTIONS_REPORT_DIRECTORY |\n| DB Username **              | no (no default)     | `-u` or `--username`                    | DB_USERNAME                 |\n| DB Password **              | no (no default)     | `-p` or `--password`                    | DB_PASSWORD                 |\n| Use integrated security **  | no (default: false) | `-i` or `--useintegratedsecurity`       | USE_INTEGRATED_SECURITY     |\n| Log level*                  | no (default: INFO)  | `-l` or `--log-level`                   | LOG_LEVEL                   |\n| Encrypt db connection       | no (default: False) | `-n` or `--encrypt`                     | ENCRYPT_SQL_CONNECTION      |\n| Trust db server certificate | no (default: False) | `-t` or `--trust-certificate`           | TRUST_SERVER_CERTIFICATE    |\n\n\\* Valid values for the optional _log level_:\n\n* DEBUG\n* INFO(default)\n* WARNING\n* ERROR\n* CRITICAL\n\n\\** If using integrated security, DB Username and password won\'t be required,\notherwise they are required.\n\n### Running the Tool\n\nFor detailed help, execute `poetry run python edfi_lms_harmonizer -h`.\n\nSample call using full integrated security, loading from the sample files\ndirectory:\n\n```bash\npoetry run python edfi_lms_harmonizer --server localhost --dbname lms_toolkit --useintegratedsecurity\n```\n\n## Developer Notes\n\n### Dev Operations\n\n1. Style check: `poetry run flake8`\n1. Static typing check: `poetry run mypy .`\n1. Run unit tests: `poetry run pytest tests`\n1. Run unit tests with code coverage: `poetry run coverage run -m pytest tests`\n1. View code coverage: `poetry run coverage report`\n1. Run SQL Server integration tests: `poetry run pytest tests_integration_mssql`\n1. Run PostgreSQL integration tests: `poetry run pytest tests_integration_pgsql`\n\n_Also see\n[build.py](https://github.com/Ed-Fi-Exchange-OSS/LMS-Toolkit/blob/main/docs/build.md)_\nfor use of the build script.\n\n### Integration Testing\n\nSee Integration test setup instructions ([SQL\nServer](./tests_integration_mssql/README.md) |\n[PostgreSQL](./tests_integration_pgsql/README.md)) for information on\nconfiguring integration testing to work in various environments.\n\n## Legal Information\n\nCopyright (c) 2022 Ed-Fi Alliance, LLC and contributors.\n\nLicensed under the [Apache License, Version\n2.0](https://github.com/Ed-Fi-Exchange-OSS/LMS-Toolkit/blob/main/LICENSE) (the\n"License").\n\nUnless required by applicable law or agreed to in writing, software distributed\nunder the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR\nCONDITIONS OF ANY KIND, either express or implied. See the License for the\nspecific language governing permissions and limitations under the License.\n\nSee\n[NOTICES](https://github.com/Ed-Fi-Exchange-OSS/LMS-Toolkit/blob/main/NOTICES.md)\nfor additional copyright and license notifications.\n',
    'author': 'Ed-Fi Alliance, LLC and contributors',
    'author_email': None,
    'maintainer': None,
    'maintainer_email': None,
    'url': 'https://techdocs.ed-fi.org/display/EDFITOOLS/LMS+Toolkit',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.9,<4.0',
}


setup(**setup_kwargs)
