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

Kesse/minor tweaks #3

Merged
merged 4 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Linting Pipeline
name: General Pipeline

on:
pull_request:
Expand All @@ -7,7 +7,7 @@ on:

jobs:
linter:
name: PyLint check
name: Lint
runs-on: ubuntu-latest
steps:
- name: linter checkout
Expand Down
51 changes: 50 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,50 @@
.venv
# Created by https://www.toptal.com/developers/gitignore/api/python,flask,git
# Edit at https://www.toptal.com/developers/gitignore?templates=python,flask,git

### Flask ###
instance/*
!instance/.gitignore
.webassets-cache
.env

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# Flask stuff:
instance/

# Environments
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

### Git ###
*.orig
*.BACKUP.*
*.BASE.*
*.LOCAL.*
*.REMOTE.*
*_BACKUP_*.txt
*_BASE_*.txt
*_LOCAL_*.txt
*_REMOTE_*.txt
56 changes: 9 additions & 47 deletions P5-Metadata-api.postman_collection.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"info": {
"_postman_id": "7085b715-1a0f-41de-ba42-0d41bc8c2377",
"name": "P5-Metadata api",
"name": "P5-Metadata-api",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
Expand Down Expand Up @@ -31,60 +31,22 @@
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"uuid\": \"{{$guid}}\",\r\n \"metadata\": [\r\n { \"author\": \"John Snut\", \"pages\": 420 }\r\n ]\r\n}",
"raw": "{\r\n \"metadata\":\r\n { \r\n \"author\": \"Other Test Author\", \r\n \"pages\": 69\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:5000/binduuid",
"raw": "http://localhost:5000/metadata",
"protocol": "http",
"host": [
"localhost"
],
"port": "5000",
"path": [
"binduuid"
]
}
},
"response": []
},
{
"name": "TESTING_Get uuids",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://localhost:5000/getuuids",
"protocol": "http",
"host": [
"localhost"
],
"port": "5000",
"path": [
"getuuids"
]
}
},
"response": []
},
{
"name": "TESTING_Get triples",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://localhost:5000/gettriples",
"protocol": "http",
"host": [
"localhost"
],
"port": "5000",
"path": [
"gettriples"
"metadata"
]
}
},
Expand All @@ -97,22 +59,22 @@
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"uuid\": \"b3d47bdd-5190-4c43-892c-dab379a72ebc\",\r\n \"triple\": [\r\n \"knox-kb01.srv.aau.dk/Barack_Obama\", \r\n \"http://dbpedia.org/ontology/spouse\", \r\n \"knox-kb01.srv.aau.dk/Michelle_Obama\"\r\n ]\r\n}",
"raw": "{\r\n \"uuid\": \"b7d29cec-89e0-44b3-988f-960496374ba5\",\r\n \"triple\": [\r\n \"knox-kb01.srv.aau.dk/Barack_Obama\", \r\n \"http://dbpedia.org/ontology/spouse\", \r\n \"knox-kb01.srv.aau.dk/Michelle_Obama\"\r\n ]\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:5000/bindtriple",
"raw": "http://localhost:5000/triple",
"protocol": "http",
"host": [
"localhost"
],
"port": "5000",
"path": [
"bindtriple"
"triple"
]
}
},
Expand All @@ -136,14 +98,14 @@
}
},
"url": {
"raw": "http://localhost:5000/getMetadata",
"raw": "http://localhost:5000/metadata",
"protocol": "http",
"host": [
"localhost"
],
"port": "5000",
"path": [
"getMetadata"
"metadata"
]
}
},
Expand Down
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,20 @@ docker-compose -f dev-docker-compose.yml up
4. Access the api at the specified host and port (if not changed: http://localhost:5000/)

## Documentation
Use postman and import the documentation from the file "P5-Metadata-api.postman_collection.json"
Use Postman and import the documentation from the file "P5-Metadata-api.postman_collection.json"

## To make changes
1) Clone the repository from [here](https://github.com/Knox-AAU/Metadata-api)
2) Make the changes you want to make
3) Push them into a branch
4) Make a pull request
5) Ensure pipelines pass
3) Update the api documentation
4) Push them into a branch
5) Make a pull request
6) Ensure pipelines pass

## To use linter
```bash
pylint ./**/*.py
```

## TODO
- Remove testing functions
- Remove testing functions from documentation
- Update the functionality such that if a triple already exists in the database, then ignore the triple and store the metadata in the JSON object in the database connected to that triple
See: https://github.com/orgs/Knox-AAU/projects/26/
4 changes: 2 additions & 2 deletions dev-docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ services:
image: python:3.9
container_name: metadataapi_api
environment:
- PYTHON_ENV=development
- DATABASE_URI='postgresql://myuser:mypassword@metadataapi_database:5432/mydatabase'
PYTHON_ENV: development
DATABASE_URI: postgresql://myuser:mypassword@metadataapi_database:5432/mydatabase
command: sh -c "pip install -r /app/requirements.txt && python /app/src/app.py"
volumes:
- .:/app
Expand Down
4 changes: 2 additions & 2 deletions prod-docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ services:
image: python:3.9
container_name: metadataapi_api
environment:
- PYTHON_ENV=production
- DATABASE_URI='postgresql://myuser:mypassword@metadataapi_database:5432/mydatabase'
PYTHON_ENV: production
DATABASE_URI: postgresql://myuser:mypassword@metadataapi_database:5432/mydatabase
command: sh -c "pip install -r /app/requirements.txt && python -u /app/src/app.py"
volumes:
- .:/app
Expand Down
Loading