{"id":22954699,"url":"https://github.com/juniors90/pymaciesarg","last_synced_at":"2025-04-02T00:26:18.329Z","repository":{"id":61534685,"uuid":"552038648","full_name":"juniors90/PymaciesArg","owner":"juniors90","description":"An extension that registers all pharmacies in Argentina.","archived":false,"fork":false,"pushed_at":"2022-10-16T08:36:43.000Z","size":28218,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-09T10:47:37.834Z","etag":null,"topics":["argentina","datascience","etl-automation","etl-framework","etl-job","etl-pipeline","etl-pipelines","pharmacies","pharmacy","pypi-package","python"],"latest_commit_sha":null,"homepage":"http://pymaciesarg.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/juniors90.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-10-15T17:17:42.000Z","updated_at":"2022-10-16T07:29:16.000Z","dependencies_parsed_at":"2022-10-20T10:15:22.504Z","dependency_job_id":null,"html_url":"https://github.com/juniors90/PymaciesArg","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juniors90%2FPymaciesArg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juniors90%2FPymaciesArg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juniors90%2FPymaciesArg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juniors90%2FPymaciesArg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juniors90","download_url":"https://codeload.github.com/juniors90/PymaciesArg/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246732177,"owners_count":20824679,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["argentina","datascience","etl-automation","etl-framework","etl-job","etl-pipeline","etl-pipelines","pharmacies","pharmacy","pypi-package","python"],"created_at":"2024-12-14T16:19:12.967Z","updated_at":"2025-04-02T00:26:18.256Z","avatar_url":"https://github.com/juniors90.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PymaciesArg\n\n[![Build status](https://github.com/juniors90/PymaciesArg/actions/workflows/CI.yml/badge.svg)](https://github.com/juniors90/PymaciesArg/actions)\n[![codecov](https://codecov.io/gh/juniors90/PymaciesArg/branch/main/graph/badge.svg?token=kMzNWlpS4X)](https://codecov.io/gh/juniors90/PymaciesArg)\n[![Documentation Status](https://readthedocs.org/projects/pymaciesarg/badge/?version=latest)](https://pymaciesarg.readthedocs.io/en/latest/?badge=latest)\n![docstr-cov](https://img.shields.io/endpoint?url=https://jsonbin.org/juniors90/PymaciesArg/badges/docstr-cov)\n[![GitHub license](https://img.shields.io/github/license/juniors90/PymaciesArg)](https://github.com/juniors90/PymaciesArg/blob/main/LICENSE)\n[![Forks](https://img.shields.io/github/forks/juniors90/PymaciesArg)](https://github.com/juniors90/PymaciesArg/stargazers)\n[![star](https://img.shields.io/github/stars/juniors90/PymaciesArg?color=yellow)](https://github.com/juniors90/PymaciesArg/network/members)\n[![issues](https://img.shields.io/github/issues/juniors90/PymaciesArg?color=teal)](https://github.com/juniors90/PymaciesArg/issues)\n[![GitHub contributors](https://img.shields.io/github/contributors/juniors90/PymaciesArg?color=green)](https://github.com/juniors90/PymaciesArg/graphs/contributors)\n[![black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\nPymaciesArg is an extension that registers all pharmacies in Argentina.\n\n## Features\n\n- [x] [Data generation and extration](https://datos.gob.ar/dataset/salud-listado-establecimientos-farmacias).\n\n\n## Requirements\n\nPython 3.8+\n\n## Dependecies for this project.\n\n- [pandas==1.5.0](https://pandas.pydata.org/) for build the backend.\n- [requests==2.28.1](https://requests.readthedocs.io/en/latest/) for build the backend.\n\n## intallation\n\nYou can install via pip:\n\n```cmd\n    $\u003e pip install PymaciesArg\n```\n\n## Example\n\nRegister the extension:\n\n```python\nimport os\nimport pathlib\n\nimport click\n\nfrom pymacies_arg import (\n    DepartmentsLoader,\n    LocationsLoader,\n    PharmaciesLoader,\n    PymaciesArg,\n    TABLE_NAMES,\n)\n\nfrom sqlalchemy import create_engine\n\n# this path is pointing to project/\nPATH = os.path.abspath(os.path.dirname(__file__))\nSQLALCHEMY_DATABASE_URI = \"sqlite:///\" + PATH + \"/db_data.db\"\n\nengine = create_engine(SQLALCHEMY_DATABASE_URI)\n\n\n# this path is pointing to project/sample_app_sqlite\nCURRENT_PATH = pathlib.Path(os.path.abspath(os.path.dirname(__file__)))\n\nquery1 = \"\"\"CREATE TABLE IF NOT EXISTS pharmacies (\n    \"id\"  INTEGER PRIMARY KEY,\n    \"name\" VARCHAR(255) NOT NULL,\n    \"id_location\"  INTEGER NOT NULL,\n    \"id_department\"  INTEGER NOT NULL,\n    \"postal_code\"  INTEGER NOT NULL,\n    \"adress\" VARCHAR(255) NOT NULL);\"\"\"\n\nquery2 = \"\"\"CREATE TABLE IF NOT EXISTS department (\n    \"id_department\"  INTEGER NOT NULL PRIMARY KEY,\n    \"department\" VARCHAR(255) NOT NULL,\n    FOREIGN KEY (id_department) REFERENCES pharmacies(id_department));\"\"\"\n\nquery3 = \"\"\"CREATE TABLE IF NOT EXISTS \"locations\"(\n    \"id_location\"  INTEGER PRIMARY KEY,\n    \"location\" VARCHAR(255) NOT NULL,\n    FOREIGN KEY (id_location) REFERENCES pharmacies(id_location));\"\"\"\n\n\ndef create_table():\n    with engine.connect() as conn:\n        for tname in TABLE_NAMES[0:3]:\n            print(f\"create table {tname}\")\n            for q in [query1, query2, query3]:\n                conn.execute(f\"DROP TABLE IF EXISTS {tname};\")\n                conn.execute(q)\n\n\n# : configure the command for run pipeline.\n@click.command()\n@click.option(\"--date\", help=\"run date in format yyyy-mm-dd\")\n@click.argument(\"province\")\ndef run_pipeline(date, province) -\u003e None:\n\n    pymacies = PymaciesArg(date, CURRENT_PATH)\n    # Extract\n    print(\"Extracting\")\n    file_paths = pymacies.extract_raws()\n\n    # Transform\n    print(\"Tansform\")\n    paths = pymacies.trasform_raws(file_paths, province)\n\n    # Load\n    print(\"Loading\")\n    PharmaciesLoader(engine).load_table(paths[0])\n    LocationsLoader(engine).load_table(paths[1])\n    DepartmentsLoader(engine).load_table(paths[2])\n\n    # Done\n    print(\"Done!\")\n\n\nif __name__ == \"__main__\":\n    create_table()\n    run_pipeline()\n```\n\n1. run the following command line:\n\n    ```shell script\n    $\u003e python -m scripts --date 2022-10-16 \"BUENOS AIRES\"\n    ```\n\n## Recommended running instructions for dev:\n\n1. Create a virtual environment:\n\n    ```shell script\n    $\u003e python3 -m venv venv\n    ```\n\n2. Activate the newly created environment:\n\n   On macOS and Linux:\n    ```shell script\n    $\u003e source venv/bin/activate\n    ```\n   \n   On Windows\n   ```\n   c:\\\u003e .\\env\\Scripts\\activate\n   ```\n\n3. Install dependencies:\n\n    ```shell script\n    $\u003e (venv) python -m pip install -r requirements/dev.txt\n    ```\n4. Start the sample app on server locally:\n\n    ```shell script\n    $\u003e (venv) pip install -e .\n    ```\n\n5. Start the sample app on server locally:\n\n    ```shell script\n    $\u003e (venv) python application/pipeline.py\n    10/16/2022 04:58:34 AM - pymacies_arg - INFO - Extracting\n    10/16/2022 04:58:35 AM - pymacies_arg - INFO - Tansform\n    10/16/2022 04:58:38 AM - pymacies_arg - INFO - Loading\n    10/16/2022 04:58:40 AM - pymacies_arg - INFO - Done!\n    ```\n    \n## Links\n\n- [Documentation](https://pymaciesarg.readthedocs.io)\n- [Example Application using Postgresql](https://github.com/juniors90/PymaciesArg/tree/main/sample_app_postgres)\n- [Example Application using sqlite](https://github.com/juniors90/PymaciesArg/tree/main/sample_app_sqlite)\n- [PyPI Releases](https://pypi.org/project/PymaciesArg/)\n- [Changelog](https://github.com/juniors90/PymaciesArg/blob/main/CHANGELOG.rst)\n\n## Authors\n\n- Ferreira, Juan David\n\nPlease submit bug reports, suggestions for improvements and patches via\nthe (E-mail: juandavid9a0@gmail.com).\n\n## Contributors\n\nCredits goes to these peoples:\n\n\u003ca href=\"https://github.com/juniors90/PymaciesArg/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=juniors90/PymaciesArg\" /\u003e\n\u003c/a\u003e\n\n## Official repository and Issues\n\n- https://github.com/juniors90/PymaciesArg\n\n\n## License\n\n`PymaciesArg` is free software you can redistribute it and/or modify it\nunder the terms of the MIT License. For more information, you can see the\n[LICENSE](https://github.com/juniors90/PymaciesArg/blob/main/LICENSE) file\nfor details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuniors90%2Fpymaciesarg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuniors90%2Fpymaciesarg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuniors90%2Fpymaciesarg/lists"}