Skip to content

Commit 06384d4

Browse files
committed
conference
1 parent 1fa894a commit 06384d4

File tree

6 files changed

+227
-5
lines changed

6 files changed

+227
-5
lines changed

api_logic_server_cli/api_logic_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
Called from api_logic_server_cli.py, by instantiating the ProjectRun object.
1313
'''
1414

15-
__version__ = "10.02.02"
15+
__version__ = "10.02.03"
1616
recent_changes = \
1717
f'\n\nRecent Changes:\n' +\
18-
"\t02/11/2024 - 10.02.02: kafka_producer.send_kafka_message, sample md fixes \n"\
18+
"\t02/12/2024 - 10.02.03: kafka_producer.send_kafka_message, sample md fixes, docker ENV \n"\
1919
"\t02/07/2024 - 10.02.00: BugFix[38]: foreign-key/getter collision \n"\
2020
"\t01/31/2024 - 10.01.28: LogicBank fix, sample-ai, better rules example \n"\
2121
"\t01/15/2024 - 10.01.18: Cleanup, logic reminder, nw tutorial fixes \n"\

api_logic_server_cli/prototypes/base/devops/docker-image/run_image.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22

33
# edit this file to change apilogicserver to your repository name
4+
# edit env.list for config settings
45
# then run to start container
56
# see https://stackoverflow.com/questions/30494050/how-do-i-pass-environment-variables-to-docker-containers
67

docker/api_logic_server.Dockerfile

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,22 @@
88
# Internal - verify what is done with build_and_test
99
# docker build -f docker/api_logic_server.Dockerfile -t apilogicserver/api_logic_server_local --rm .
1010
# docker tag apilogicserver/api_logic_server_local apilogicserver/api_logic_server_local:latest
11-
# repeat with latest
11+
# -- now run locally:
12+
# docker run -it apilogicserver/api_logic_server_local # minimal (no ports, no mounts, no network, files protected)
13+
# cd ~/dev/ApiLogicServer/ApiLogicServer-dev/build_and_test/ApiLogicServer/dockers
14+
# docker run -it --name api_logic_server --rm --net dev-network -p 5656:5656 -p 5002:5002 -v ${PWD}:/localhost apilogicserver/api_logic_server_local
15+
# -- but not this (fails complaining about $PATH, tho echo $PATH has /home/api_logic_server/bin
16+
# docker run -it apilogicserver/api_logic_server_local ApiLogicServer create-and-run --project_name=api_logic_project --db_url=
17+
# Thos scenario (cd first)...
18+
# docker run -it --name api_logic_server --rm -v ${PWD}:/localhost apilogicserver/api_logic_server_local ApiLogicServer create --project_name=/localhost/nw --db_url=
19+
# docker run -it --name api_logic_server --rm -p 5656:5656 -p 5002:5002 -v ${PWD}:/localhost apilogicserver/api_logic_server_local ApiLogicServer run --project_name=/localhost/nw
20+
1221

13-
# docker run -it --name api_logic_server_local --rm --net dev-network -p 5656:5656 -p 5002:5002 -v .:/localhost apilogicserver/api_logic_server_arm
14-
# docker run -it --name api_logic_server_local --rm --net dev-network -p 5656:5656 -p 5002:5002 -v {str(dest)}:/localhost apilogicserver/api_logic_server_arm sh -c "export PATH=$PATH:/home/api_logic_server/bin && /bin/sh /localhost/docker-commands.sh"
22+
# docker run -it --name api_logic_server_local --rm --net dev-network -p 5656:5656 -p 5002:5002 -v .:/localhost apilogicserver/api_logic_server_local
23+
# docker run -it --name api_logic_server_local --rm --net dev-network -p 5656:5656 -p 5002:5002 -v {str(dest)}:/localhost apilogicserver/api_logic_server_local sh -c "export PATH=$PATH:/home/api_logic_server/bin && /bin/sh /localhost/docker-commands.sh"
1524

25+
# dev containers: https://apilogicserver.github.io/Docs/DevOps-Docker/
26+
# run containers: https://apilogicserver.github.io/Docs/DevOps-Containers-Build/
1627

1728
# cd ~/dev/ApiLogicServer/ApiLogicServer-dev/build_and_test/ApiLogicServer/dockers
1829
# docker run -it --name api_logic_server --rm --net dev-network -p 5656:5656 -p 5002:5002 -v ${PWD}:/localhost apilogicserver/api_logic_server
@@ -67,9 +78,14 @@ USER root
6778
RUN chmod +x bin/ApiLogicServer \
6879
&& chmod a+rwx -R api_logic_server_cli/api_logic_server_info.yaml \
6980
&& chmod +x bin/py
81+
RUN mkdir -p /home/api_logic_project \
82+
&& chown -R api_logic_server /home/api_logic_project
7083
USER api_logic_server
7184

7285
ENV APILOGICSERVER_RUNNING=DOCKER
7386
ENV APILOGICSERVER_FROM=python:3.11.4-slim-bullseye
87+
ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/api_logic_server/bin
88+
# EXPOSE 5656
89+
# EXPOSE 5002
7490

7591
CMD ["bash"]
356 KB
Loading
Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
DROP DATABASE IF EXISTS conference;
2+
CREATE DATABASE conference;
3+
\c conference;
4+
5+
6+
drop table conference_venue;
7+
drop table session_person;
8+
drop table talk_person;
9+
drop table talk;
10+
drop table session;
11+
drop table location;
12+
drop table venue;
13+
drop table conference_person;
14+
drop table person;
15+
drop table conference;
16+
17+
-- Person Table
18+
CREATE TABLE Person (
19+
PersonID SERIAL PRIMARY KEY,
20+
FirstName VARCHAR(255),
21+
LastName VARCHAR(255),
22+
Photo VARCHAR(255),
23+
Pronouns VARCHAR(50),
24+
Role VARCHAR(255),
25+
Organization VARCHAR(255),
26+
City VARCHAR(255),
27+
Country VARCHAR(255),
28+
AskMeAbout TEXT,
29+
Passion TEXT,
30+
GoodAt TEXT,
31+
Bio TEXT,
32+
Email VARCHAR(255),
33+
Phone VARCHAR(50),
34+
LinkedInHandle VARCHAR(255),
35+
TwitterHandle VARCHAR(255),
36+
InstagramHandle VARCHAR(255),
37+
URL VARCHAR(255)
38+
);
39+
40+
-- Conference Table
41+
CREATE TABLE Conference (
42+
ConferenceID SERIAL PRIMARY KEY,
43+
Name VARCHAR(255),
44+
StartDate DATE,
45+
EndDate DATE
46+
);
47+
48+
-- Venue Table
49+
CREATE TABLE Venue (
50+
VenueID SERIAL PRIMARY KEY,
51+
Name VARCHAR(255),
52+
Address VARCHAR(255)
53+
);
54+
55+
-- Conference_Venue Junction Table
56+
CREATE TABLE Conference_Venue (
57+
ConferenceID INT,
58+
VenueID INT,
59+
FOREIGN KEY (ConferenceID) REFERENCES Conference(ConferenceID),
60+
FOREIGN KEY (VenueID) REFERENCES Venue(VenueID)
61+
);
62+
63+
-- Location Table
64+
CREATE TABLE Location (
65+
LocationID SERIAL PRIMARY KEY,
66+
Name VARCHAR(255),
67+
Description TEXT,
68+
VenueID INT,
69+
FOREIGN KEY (VenueID) REFERENCES Venue(VenueID)
70+
);
71+
72+
-- Session Table
73+
CREATE TABLE Session (
74+
SessionID SERIAL PRIMARY KEY,
75+
ConferenceID INT,
76+
Name VARCHAR(255),
77+
StartDateTime TIMESTAMP,
78+
EndDateTime TIMESTAMP,
79+
LocationID INT,
80+
FOREIGN KEY (ConferenceID) REFERENCES Conference(ConferenceID),
81+
FOREIGN KEY (LocationID) REFERENCES Location(LocationID)
82+
);
83+
84+
-- Talk Table
85+
CREATE TABLE Talk (
86+
TalkID SERIAL PRIMARY KEY,
87+
Name VARCHAR(255),
88+
SessionID INT,
89+
FOREIGN KEY (SessionID) REFERENCES Session(SessionID)
90+
);
91+
92+
-- Session_Person Junction Table for facilitators and panelists
93+
CREATE TABLE Session_Participant (
94+
SessionID INT,
95+
PersonID INT,
96+
Role VARCHAR(50),
97+
FOREIGN KEY (SessionID) REFERENCES Session(SessionID),
98+
FOREIGN KEY (PersonID) REFERENCES Person(PersonID),
99+
PRIMARY KEY (SessionID, PersonID, Role)
100+
);
101+
102+
-- Talk_Person Junction Table for speakers and participants
103+
CREATE TABLE Talk_Participant (
104+
TalkID INT,
105+
PersonID INT,
106+
Role VARCHAR(50),
107+
FOREIGN KEY (TalkID) REFERENCES Talk(TalkID),
108+
FOREIGN KEY (PersonID) REFERENCES Person(PersonID),
109+
PRIMARY KEY (TalkID, PersonID, Role)
110+
);
111+
112+
-- Conference_Person Junction Table
113+
CREATE TABLE Attendee (
114+
ConferenceID INT,
115+
PersonID INT,
116+
FOREIGN KEY (ConferenceID) REFERENCES Conference(ConferenceID),
117+
FOREIGN KEY (PersonID) REFERENCES Person(PersonID),
118+
PRIMARY KEY (ConferenceID, PersonID)
119+
);
120+
121+
122+
123+
-- Insert a Conference
124+
INSERT INTO Conference (Name, StartDate, EndDate) VALUES ('Test Summit 2024', '2024-10-01', '2024-10-04');
125+
126+
-- Insert a Venue
127+
INSERT INTO Venue (Name, Address) VALUES ('Convention Center', '123 Tech Road, San Francisco');
128+
129+
-- Link the Conference and Venue
130+
INSERT INTO Conference_Venue (ConferenceID, VenueID) VALUES (1, 1);
131+
132+
-- Insert Locations within the Venue
133+
INSERT INTO Location (Name, Description, VenueID) VALUES
134+
('Main Hall', 'The largest hall for keynotes and plenaries', 1),
135+
('Room 101', 'A medium-sized room for workshops', 1),
136+
('Room 102', 'A medium-sized room for workshops', 1),
137+
('Room 103', 'A medium-sized room for workshops', 1),
138+
('Outdoor Arena', 'Open area for social gatherings', 1);
139+
140+
-- Insert Sessions
141+
INSERT INTO Session (ConferenceID, Name, StartDateTime, EndDateTime, LocationID) VALUES
142+
-- Complete Session Insertion
143+
(1, 'Tech Trends 2024', '2024-10-01 11:00:00', '2024-10-01 12:30:00', 1),
144+
(1, 'Future of Work', '2024-10-01 14:00:00', '2024-10-01 15:30:00', 3),
145+
(1, 'Sustainable Tech Innovations', '2024-10-01 16:00:00', '2024-10-01 17:30:00', 4),
146+
(1, 'Company Culture in the New Era', '2024-10-02 09:00:00', '2024-10-02 10:30:00', 2),
147+
(1, 'Profit & Ethics', '2024-10-02 11:00:00', '2024-10-02 12:30:00', 3),
148+
(1, 'Business Beyond Profit', '2024-10-02 14:00:00', '2024-10-02 15:30:00', 4),
149+
(1, 'The Economy of Diversity', '2024-10-02 16:00:00', '2024-10-02 17:30:00', 5),
150+
(1, 'Advancements in Profit Sharing', '2024-10-03 09:00:00', '2024-10-03 10:30:00', 2),
151+
(1, 'Globalization: The Next Frontier', '2024-10-03 11:00:00', '2024-10-03 12:30:00', 3),
152+
(1, 'Panel Discussion: The Future of Economy', '2024-10-03 14:00:00', '2024-10-03 15:30:00', 1);
153+
154+
-- Insert Attendees
155+
INSERT INTO Person (FirstName, LastName, Pronouns, Role, Organization, City, Country, Email) VALUES
156+
('Don', 'Zack', 'they/them', 'Host', 'One Palm', 'Walnut Creek', 'USA', '[email protected]'),
157+
('Sam', 'Lee', 'she/her', 'Product Manager', 'TechSolutions', 'New York', 'USA', '[email protected]'),
158+
('Jordan', 'Diaz', 'he/him', 'CEO', 'StartupGen', 'Austin', 'USA', '[email protected]'),
159+
('Casey', 'Wong', 'they/them', 'Designer', 'CreativeMinds', 'Toronto', 'Canada', '[email protected]');
160+
161+
-- Link Attendees to the Conference
162+
INSERT INTO Attendee (ConferenceID, PersonID) VALUES
163+
(1, 1),
164+
(1, 2),
165+
(1, 3),
166+
(1, 4);
167+
168+
-- Assuming Sessions are already inserted, insert Talks
169+
INSERT INTO Talk (Name, SessionID) VALUES
170+
('Innovating the Future', 2),
171+
('The Role of Ethics in Modern Economy', 3);
172+
173+
-- Assign Speakers and Participants to Talks
174+
-- Assuming Alex Johnson and Sam Lee are speakers, and Jordan Diaz and Casey Wong are participants
175+
INSERT INTO Talk_Participant (TalkID, PersonID, Role) VALUES
176+
(1, 1, 'Speaker'),
177+
(2, 2, 'Speaker'),
178+
(1, 3, 'Participant'),
179+
(2, 4, 'Participant');
180+
181+
-- Assign Facilitators and Panelists to Sessions
182+
-- Assuming Alex and Sam are facilitators for the first two sessions, Jordan and Casey are panelists
183+
INSERT INTO Session_Participant (SessionID, PersonID, Role) VALUES
184+
(1, 1, 'Host'),
185+
(2, 2, 'Facilitator'),
186+
(1, 3, 'Panelist'),
187+
(2, 4, 'Panelist');
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from logic_bank.logic_bank import Rule
2+
from logic_bank.exec_row_logic.logic_row import LogicRow
3+
from your_application.model import SessionParticipant, Question # Assuming you have this model
4+
5+
def validate_participant_of_session(row: LogicRow):
6+
# This function would be a placeholder for your validation logic.
7+
# You would check if the participant who is trying to post a question
8+
# is registered for the session linked to the question.
9+
question = row.new_row # The question being posted
10+
participant_id = question.participant_id
11+
session_id = question.session_id
12+
# Query your database to check if the participant is associated with the session
13+
participant_session = SessionParticipant.query.filter_by(participant_id=participant_id, session_id=session_id).first()
14+
if not participant_session:
15+
raise ValueError("Participant must be registered for the session to post questions.")
16+
17+
# Define the rule
18+
Rule.commit_row_event(on_class=Question, calling=validate_participant_of_session, row_event="before_insert")

0 commit comments

Comments
 (0)