Skip to content

Commit

Permalink
Search features (#8)
Browse files Browse the repository at this point in the history
* Add search endpoint
Add conditional room deletion (if only 1 the you can't)
Remove auto-adding art if 1 work in 1 room
Add overwrite room ability to store
Add search API

* Add make commands for deploy
Add warmpup endpoints

* Add material ui for browser notif
remove former splash page
Move search to top bar

* Update sitemap and index

* spacing

* Add blog endpoints
Add blog datastore entrypoint
Add blog links
Add blog components
Add covid scraper
Add blog notebook

* Update sitemap with blog links

* Fix bug with blank tag raising exception

* helmet and blog updates for main page
remove console logs for blog
  • Loading branch information
mskarlin authored Nov 11, 2023
1 parent a6e3b7c commit 9bc9c2d
Show file tree
Hide file tree
Showing 37 changed files with 3,668 additions and 137 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,9 @@ deploy-frontend:
cd art_snob_frontend ; npm run build
cp -r art_snob_frontend/build ./build_deploy/build/
cd build_deploy ; gcloud app deploy

deploy-backend:
cd art_snob_api ; gcloud app deploy

deploy-image-api:
cd image_model_api ; gcloud beta app deploy --no-cache
33 changes: 32 additions & 1 deletion art_snob_api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
data = FriendlyDataStore(dsi)

eec = ClusterExplore(data)
app = FastAPI(title='deco-api', version="0.5.0")
app = FastAPI(title='artsnob-api', version="0.6.0")

origins = ["*", "http://localhost:8000/"]

Expand Down Expand Up @@ -559,5 +559,36 @@ def share(app_state: AppState,
except Exception as e:
print(e.message)

@app.get("/_ah/warmup")
def warmup():
return {'status': 'warming-up'}

@app.get('/blog/{blog_name}')
def blog(blog_name: str, session_id=None):

if not session_id:
session_id = str(uuid.uuid4())

blog_name = blog_name.lower().replace('%2c', ',').replace('\'', '').replace(' ','_')
article = dsi.read_nocache(ids=[blog_name], kind=data.BLOG, sorted_list=True)

if article:
return {'blog': article[0]}
else:
return {'blog': None}

@app.get('/list_blogs/')
def list_blogs(session_id=None):

if not session_id:
session_id = str(uuid.uuid4())

articles = dsi.query(kind = data.BLOG, n_records = 100, tolist = True)

# extract and sort by pub date
articles = [articles[0] for ak in articles]

return {'articles': articles[0]}

if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8080)
1 change: 1 addition & 0 deletions art_snob_api/src/datastore_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class FriendlyDataStore():
STATE_KIND = '12202020-state'
STATE_LOGIN = '12202020-login'
SEARCH_API_URL = os.environ.get('SEARCH_API_URL', 'http://localhost:8001')
BLOG='artsnob-blog-articles'
# RAND_MIN = 4503653962481664 # used for scraped-image-data indices
# RAND_MAX = 6755350696951808
RAND_MIN = 1
Expand Down
3 changes: 1 addition & 2 deletions art_snob_api/utilities/datastore_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,7 @@ def read_nocache(self, ids: List[Union[int, str]], kind: str, filter_keys: List[
(dict) keyed to record id or sorted list by input ids
"""

keys = [self.ds.key(kind, idx) for idx in ids]
keys = [self.ds.key(kind, idx) for idx in ids if idx != '']
results = self.ds.get_multi(keys)

if results:
Expand Down
2 changes: 2 additions & 0 deletions art_snob_frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
"html2canvas": "^1.0.0-rc.7",
"lodash": "^4.17.20",
"material-design-icons": "^3.0.1",
"material-ui-cookie-consent": "^0.1.0",
"mathjs": "^7.1.0",
"node-sass": "^4.14.1",
"react": "^16.13.1",
"react-cookie": "^4.0.3",
"react-dom": "^16.13.1",
"react-ga": "^3.3.0",
"react-helmet": "^6.1.0",
"react-hook-form": "^6.8.4",
"react-pro-sidebar": "^0.4.3",
Expand Down
2 changes: 1 addition & 1 deletion art_snob_frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description"
content="Quickly find and build an affordable wall art that matches your taste with our art finder app.">
content="Quickly find and build an affordable wall art that matches your taste with our art finder app." />

<link rel="apple-touch-icon" href="%PUBLIC_URL%/apple-touch-icon.png" />
<!--
Expand Down
72 changes: 71 additions & 1 deletion art_snob_frontend/public/sitemap.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,73 @@
https://artsnob.io/
https://artsnob.io/taste
https://artsnob.io/about
https://artsnob.io/bloghub
https://artsnob.io/blog/Architecture%20behind%20scalable%2C%20dynamic%20art%20recommendations%20pt%201
https://artsnob.io/blog/Data%20Science%20isn't%20a%20job
https://artsnob.io/about
https://artsnob.io/search/woman%20in%20a%20hat%20on%20a%20bicycle
https://artsnob.io/search/abstract%20guitar%20photos
https://artsnob.io/search/tropical%20pools%20by%20the%20beach
https://artsnob.io/search/flower
https://artsnob.io/search/rustic
https://artsnob.io/search/geometric
https://artsnob.io/search/gold
https://artsnob.io/search/silver
https://artsnob.io/search/wood
https://artsnob.io/search/nursery
https://artsnob.io/search/glass
https://artsnob.io/search/kids
https://artsnob.io/search/butterfly
https://artsnob.io/search/modern
https://artsnob.io/search/buddha
https://artsnob.io/search/christian
https://artsnob.io/search/mandala
https://artsnob.io/search/tree
https://artsnob.io/search/black
https://artsnob.io/search/inspirational
https://artsnob.io/search/beach
https://artsnob.io/search/pink
https://artsnob.io/search/graffiti
https://artsnob.io/search/banksy
https://artsnob.io/search/henri%20matisse
https://artsnob.io/search/picasso
https://artsnob.io/search/andy%20warhol
https://artsnob.io/search/hokusai
https://artsnob.io/search/van%20gogh
https://artsnob.io/search/klimt
https://artsnob.io/search/monet
https://artsnob.io/search/frida%20kahlo
https://artsnob.io/search/salvador%20dali
https://artsnob.io/search/david%20hockney
https://artsnob.io/search/joan%20miro
https://artsnob.io/search/takashi%20murakami
https://artsnob.io/search/cow
https://artsnob.io/search/dog
https://artsnob.io/search/bird
https://artsnob.io/search/lion
https://artsnob.io/search/horse
https://artsnob.io/search/elephant
https://artsnob.io/search/giraffe
https://artsnob.io/search/cat
https://artsnob.io/search/rabbit
https://artsnob.io/search/tiger
https://artsnob.io/search/animal
https://artsnob.io/search/flower
https://artsnob.io/search/street%20art
https://artsnob.io/search/kids
https://artsnob.io/search/plant
https://artsnob.io/search/car
https://artsnob.io/search/vogue
https://artsnob.io/search/flower
https://artsnob.io/search/kids
https://artsnob.io/search/gold
https://artsnob.io/search/girls
https://artsnob.io/search/drawing
https://artsnob.io/search/light
https://artsnob.io/search/cow
https://artsnob.io/search/family
https://artsnob.io/search/boys
https://artsnob.io/search/sculpture
https://artsnob.io/search/farmhouse
https://artsnob.io/search/elephant
https://artsnob.io/search/horse
https://artsnob.io/search/house
13 changes: 9 additions & 4 deletions art_snob_frontend/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@ main {
}

.deco-header {
width: 150px;
cursor: pointer;
user-select: all;
pointer-events: all;
height: 43px;
overflow: hidden;
Expand All @@ -157,6 +155,7 @@ main {
font-weight: 900;
font-style: normal;
text-align: left;
margin-right: 10px;
padding-left: 10px;
}

Expand Down Expand Up @@ -1398,7 +1397,7 @@ main {
.tutorial-steps {
display: flex;
flex-direction: row;
height: 300px;
height: 250px;
max-width: 560px;
margin: auto;
}
Expand All @@ -1408,7 +1407,7 @@ main {
flex-direction: column;
justify-content: flex-start;
align-items: center;
height: 300px;
height: 250px;
width: 50%;
}

Expand Down Expand Up @@ -1476,4 +1475,10 @@ main {
display: flex;
flex-direction: column;
align-items: center;
}

.flex-header-menu {
display: flex;
flex-direction: column;
background-color: white;
}
Loading

0 comments on commit 9bc9c2d

Please sign in to comment.