Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logging fur realz dis taim #66

Merged
merged 18 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

- name: Install Poetry
run: |
pipx install --pip-args "-c .github/workflows/constraints.txt" poetry
pipx install --pip-args "-c ${{ github.workspace }}/.github/workflows/constraints.txt" poetry
poetry --version

- name: Set up Python
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ jobs:

- name: Upgrade pip
run: |
pip install -c .github/workflows/constraints.txt pip
pip install -c ${{ github.workspace }}/.github/workflows/constraints.txt pip
pip --version

- name: Install Poetry
run: |
pip install -c .github/workflows/constraints.txt poetry
pip install -c ${{ github.workspace }}/.github/workflows/constraints.txt poetry
poetry --version

- name: Check if there is a parent commit
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- { python: "3.11", os: "windows-latest", session: "tests" }
- { python: "3.11", os: "macos-latest", session: "tests" }
- { python: "3.10", os: "ubuntu-latest", session: "typeguard" }
- { python: "3.11", os: "ubuntu-latest", session: "xdoctest" }
#- { python: "3.11", os: "ubuntu-latest", session: "xdoctest" }
- { python: "3.10", os: "ubuntu-latest", session: "docs-build" }

env:
Expand All @@ -42,7 +42,7 @@ jobs:

- name: Upgrade pip
run: |
pip install -c .github/workflows/constraints.txt pip
pip install -c ${{ github.workspace }}/.github/workflows/constraints.txt pip
pip --version

- name: Upgrade pip in virtual environments
Expand All @@ -56,13 +56,13 @@ jobs:

- name: Install Poetry
run: |
pipx install --pip-args "-c .github/workflows/constraints.txt" poetry
pipx install --pip-args "-c ${{ github.workspace }}/.github/workflows/constraints.txt" poetry
poetry --version

- name: Install Nox
run: |
pipx install --pip-args "-c .github/workflows/constraints.txt" nox
pipx inject --pip-args "-c .github/workflows/constraints.txt" nox nox-poetry
pipx install --pip-args "-c ${{ github.workspace }}/.github/workflows/constraints.txt" nox
pipx inject --pip-args "-c ${{ github.workspace }}/.github/workflows/constraints.txt" nox nox-poetry
nox --version

- name: Compute pre-commit cache key
Expand Down Expand Up @@ -124,18 +124,18 @@ jobs:

- name: Upgrade pip
run: |
pip install -c .github/workflows/constraints.txt pip
pip install -c ${{ github.workspace }}/.github/workflows/constraints.txt pip
pip --version

- name: Install Poetry
run: |
pipx install --pip-args "-c .github/workflows/constraints.txt" poetry
pipx install --pip-args "-c ${{ github.workspace }}/.github/workflows/constraints.txt" poetry
poetry --version

- name: Install Nox
run: |
pipx install --pip-args "-c .github/workflows/constraints.txt" nox
pipx inject --pip-args "-c .github/workflows/constraints.txt" nox nox-poetry
pipx install --pip-args "-c ${{ github.workspace }}/.github/workflows/constraints.txt" nox
pipx inject --pip-args "-c ${{ github.workspace }}/.github/workflows/constraints.txt" nox nox-poetry
nox --version

- name: Download coverage data
Expand Down
43 changes: 32 additions & 11 deletions demo/UtdData.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"cell_type": "code",
"execution_count": null,
"id": "0",
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"from ssb_utdanning import UtdData"
Expand Down Expand Up @@ -41,7 +43,10 @@
},
"outputs": [],
"source": [
"vigoskole = UtdData(glob_pattern=glob_pattern)"
"import logging\n",
"\n",
"loggers = [logging.getLogger(name) for name in logging.root.manager.loggerDict]\n",
"# loggers"
]
},
{
Expand All @@ -53,7 +58,7 @@
},
"outputs": [],
"source": [
"vigoskole.periods"
"vigoskole = UtdData(glob_pattern=glob_pattern)"
]
},
{
Expand All @@ -64,6 +69,18 @@
"tags": []
},
"outputs": [],
"source": [
"vigoskole.periods"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"for i, var in enumerate(vigoskole.metadata.variables):\n",
" print(var)\n",
Expand All @@ -73,7 +90,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "6",
"id": "7",
"metadata": {
"tags": []
},
Expand All @@ -84,7 +101,7 @@
},
{
"cell_type": "markdown",
"id": "7",
"id": "8",
"metadata": {},
"source": [
"### Should be possible to extend metadata in the future to hold \"custom_type\"."
Expand All @@ -93,23 +110,27 @@
{
"cell_type": "code",
"execution_count": null,
"id": "8",
"id": "9",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"for i, var in enumerate(vigoskole.metadata.variables):\n",
" if var.short_name==\"SKOLENR\":\n",
" vigoskole.metadata.variables[i].custom_type = [{\"key\": \"utd_noekkel_rekkefolge\", \"value\": 1}]\n",
" if var.short_name==\"SKOLEIER\":\n",
" vigoskole.metadata.variables[i].custom_type = [{\"key\": \"utd_noekkel_rekkefolge\", \"value\": 2}]"
" if var.short_name == \"SKOLENR\":\n",
" vigoskole.metadata.variables[i].custom_type = [\n",
" {\"key\": \"utd_noekkel_rekkefolge\", \"value\": 1}\n",
" ]\n",
" if var.short_name == \"SKOLEIER\":\n",
" vigoskole.metadata.variables[i].custom_type = [\n",
" {\"key\": \"utd_noekkel_rekkefolge\", \"value\": 2}\n",
" ]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9",
"id": "10",
"metadata": {},
"outputs": [],
"source": []
Expand Down
29 changes: 19 additions & 10 deletions demo/UtdKatalog.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@
"source": [
"import pandas as pd\n",
"\n",
"katalog_data = pd.DataFrame({\n",
" \"orgnr\": [\"0123\", \"1234\", \"2345\"],\n",
" \"orgnrbed\": [\"0123\", \"3456\", \"\"],\n",
" \"kommnr\": [\"5000\", \"6000\", \"6789\"],\n",
"})\n",
"fake_orgnr = UtdKatalog([\"orgnr\", \"orgnrbed\"], data=katalog_data, path=\"./fake_path_p2020_v1.parquet\")"
"katalog_data = pd.DataFrame(\n",
" {\n",
" \"orgnr\": [\"0123\", \"1234\", \"2345\"],\n",
" \"orgnrbed\": [\"0123\", \"3456\", \"\"],\n",
" \"kommnr\": [\"5000\", \"6000\", \"6789\"],\n",
" }\n",
")\n",
"fake_orgnr = UtdKatalog(\n",
" [\"orgnr\", \"orgnrbed\"], data=katalog_data, path=\"./fake_path_p2020_v1.parquet\"\n",
")"
]
},
{
Expand All @@ -41,10 +45,15 @@
},
"outputs": [],
"source": [
"fake_data = UtdData(data=pd.DataFrame({\n",
" \"orgnr\": [\"0123\", \"1234\", \"2345\", \"3456\", \"4567\"],\n",
" \"inntekt\": [100, 2000, 30000, 400000, 5000000],\n",
"}), path=\"./fake_data_path_p2020_v1.parquet\")"
"fake_data = UtdData(\n",
" data=pd.DataFrame(\n",
" {\n",
" \"orgnr\": [\"0123\", \"1234\", \"2345\", \"3456\", \"4567\"],\n",
" \"inntekt\": [100, 2000, 30000, 400000, 5000000],\n",
" }\n",
" ),\n",
" path=\"./fake_data_path_p2020_v1.parquet\",\n",
")"
]
},
{
Expand Down
15 changes: 9 additions & 6 deletions demo/datadoc_model_understand.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
"from pathlib import Path\n",
"\n",
"path = Path(\"/ssb/stamme01/utd/katalog/vigo/vigo_skole_testfil_slett_p2021_v1.parquet\")\n",
"metapath = Path(\"/ssb/stamme01/utd/katalog/vigo/vigo_skole_testfil_slett_p2021_v1__DOC.json\")"
"metapath = Path(\n",
" \"/ssb/stamme01/utd/katalog/vigo/vigo_skole_testfil_slett_p2021_v1__DOC.json\"\n",
")"
]
},
{
Expand Down Expand Up @@ -71,10 +73,11 @@
},
"outputs": [],
"source": [
"metadata = DataDocMetadata(StatisticSubjectMapping(\"\"),\n",
" dataset_path=path,\n",
" #metadata_document_path=metapath\n",
" )"
"metadata = DataDocMetadata(\n",
" StatisticSubjectMapping(\"\"),\n",
" dataset_path=path,\n",
" # metadata_document_path=metapath\n",
")"
]
},
{
Expand All @@ -90,7 +93,7 @@
" if var.short_name == \"KOMMNR\":\n",
" print(var)\n",
" metadata.variables[i].temporality_type = \"Random shit\"\n",
" #print(var.__dict__)"
" # print(var.__dict__)"
]
},
{
Expand Down
10 changes: 5 additions & 5 deletions demo/formats_fromSAS.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "cc5a5d7b-d825-4129-aa3e-16e9024daffb",
"id": "0",
"metadata": {
"tags": []
},
Expand All @@ -15,7 +15,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "5f2bba02-f8b8-41b0-8c02-cb104f1cffc1",
"id": "1",
"metadata": {
"tags": []
},
Expand All @@ -27,7 +27,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "c27d031d-d09a-4a8e-bbfd-a28f29419bb5",
"id": "2",
"metadata": {
"tags": []
},
Expand All @@ -39,7 +39,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "e53df836-3a02-486e-b119-f1649eab52a1",
"id": "3",
"metadata": {
"tags": []
},
Expand All @@ -54,7 +54,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "dc13013b-6f94-4c00-9ad9-6925f2788499",
"id": "4",
"metadata": {},
"outputs": [],
"source": []
Expand Down
Loading
Loading