Skip to content

Instantly share code, notes, and snippets.

View lu-pl's full-sized avatar
🎯
Focusing

Lukas Plank lu-pl

🎯
Focusing
View GitHub Profile
@lu-pl
lu-pl / fastapi_query_parameter_meta_draft.md
Last active December 17, 2024 06:17
FastAPI QueryParameter Metaclass Draft

Metaclass hack for injecting model information into a Query Parameter Model; this allows to add dynamically computed information in a parametrized generic model which can then be used as static type in a FastAPI context.

E.g. in the following, order-able fields of the Author model are computed at "parametrization-time" of the QueryParamteres model.

query = """
select *
@lu-pl
lu-pl / gutenberg_model.md
Last active May 22, 2024 10:05
CRM/LRM model for Gutenberg data

For example API data see the well documented Gutendex API.

CRM/CLSCor model

<f1_uri> a lrm:F1_Work ;
    rdfs:label "<title> [Work Title]" ;
    lrm:R3_is_realized_in <f2_uri> .

<f2_uri> a lrm:F2_Expression ;
@lu-pl
lu-pl / eltec_examples.md
Created March 28, 2024 08:22
ELTeC CLSCor examples

Example: DEU002

JSON extracted from source

{
    "resource_uri": "https://raw.githubusercontent.com/COST-ELTeC/ELTeC-deu/master/level1/DEU002.xml",
    "file_stem": "deu002",
    "repo_id": "eltec-deu",
    "work_title": "Der Lehnhold",
@lu-pl
lu-pl / rem_model.md
Created February 29, 2024 10:14
CRM/LRM model for ReM data

Example data extracted from ReM teiHeaders:

{
    "id": "M001",
    "title": "Ad equum errehet",
    "genre": "Segen",
    "token_count": "212",
    "publication": {
        "idno": "Elias von Steinmeyer (Hg.), Die kleineren althochdeutschen Sprachdenkm\u00e4ler, Berlin 1916,  Nr. 66,2",
{
    "id": "M001",
    "title": "Ad equum errehet",
    "genre": "Segen",
    "token_count": "212",
    "publication": {
        "idno": "Elias von Steinmeyer (Hg.), Die kleineren althochdeutschen Sprachdenkm\u00e4ler, Berlin 1916,  Nr. 66,2",
        "date": "1916"
    },