Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
wookie1380 committed Oct 15, 2023
2 parents 6daa53a + 2b94bac commit db061c8
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 122 deletions.
22 changes: 11 additions & 11 deletions workstream1/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ def index():
)

metrics_data = [
(1, form_data["txtUnder30"], form_data["projectName"]),
(2, form_data["txtUnder50"], form_data["projectName"]),
(3, form_data["txtUnder60"], form_data["projectName"]),
(4, form_data["txtUnder80"], form_data["projectName"]),
(5, form_data["txtUnder120"], form_data["projectName"]),
(6, form_data["txtAbove120"], form_data["projectName"]),
(7, form_data["txtNoCmfClf"], form_data["projectName"]),
(8, form_data["txtPrivCash"], form_data["projectName"]),
(9, form_data["txtGovCash"], form_data["projectName"]),
(10, form_data["txtCMFLoan"], form_data["projectName"]),
(1, form_data["txtUnder30"], form_data["txtPPN"]),
(2, form_data["txtUnder50"], form_data["txtPPN"]),
(3, form_data["txtUnder60"], form_data["txtPPN"]),
(4, form_data["txtUnder80"], form_data["txtPPN"]),
(5, form_data["txtUnder120"], form_data["txtPPN"]),
(6, form_data["txtAbove120"], form_data["txtPPN"]),
(7, form_data["txtNoCmfClf"], form_data["txtPPN"]),
(8, form_data["txtPrivCash"], form_data["txtPPN"]),
(9, form_data["txtGovCash"], form_data["txtPPN"]),
(10, form_data["txtCMFLoan"], form_data["txtPPN"]),
]

# Connect to MariaDB
Expand All @@ -64,7 +64,7 @@ def index():

# Insert the new project
cur.execute(
"INSERT INTO Projects(PortfolioID, txtPPN, txtAddr1, txtAddr2, txtCity, txtState, txtZIP) VALUES (%s, %s, %s, %s, %s, %s, %s)",
"INSERT INTO Projects(PortfolioID, txtPPN, txtStreet, txtCity, txtState, txtZIP) VALUES (%s, %s, %s, %s, %s, %s)",
project_data,
)

Expand Down
20 changes: 11 additions & 9 deletions workstream1/cmfportfolio.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ DROP TABLE IF EXISTS `Metrics`;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `Metrics` (
`MetricID` int NOT NULL AUTO_INCREMENT,
`MetricName` varchar(255) NOT NULL,
`MetricName` varchar(50) DEFAULT NULL,
PRIMARY KEY (`MetricID`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
Expand All @@ -35,7 +35,7 @@ CREATE TABLE `Metrics` (

LOCK TABLES `Metrics` WRITE;
/*!40000 ALTER TABLE `Metrics` DISABLE KEYS */;
INSERT INTO `Metrics` VALUES (1,'txtUnder30'),(2,'txtUnder50'),(3,'txtUnder60'),(4,'txtUnder80'),(5,'txtUnder120'),(6,'txtAbove120'),(7,'txtUnitCount'),(8,'txtPrivCash'),(9,'txtGovCash'),(10,'txtCMFLoan'),(11,'txtNoCmfClf');
INSERT INTO `Metrics` VALUES (1,'txtUnder30'),(2,'txtUnder50'),(3,'txtUnder60'),(4,'txtUnder80'),(5,'txtUnder120'),(6,'txtAbove120'),(7,'txtNoCmfClf'),(8,'txtPrivCash'),(9,'txtGovCash'),(10,'txtCMFLoan');
/*!40000 ALTER TABLE `Metrics` ENABLE KEYS */;
UNLOCK TABLES;

Expand All @@ -60,6 +60,7 @@ CREATE TABLE `Portfolios` (

LOCK TABLES `Portfolios` WRITE;
/*!40000 ALTER TABLE `Portfolios` DISABLE KEYS */;
INSERT INTO `Portfolios` VALUES (1,'CMF',2023);
/*!40000 ALTER TABLE `Portfolios` ENABLE KEYS */;
UNLOCK TABLES;

Expand All @@ -71,11 +72,11 @@ DROP TABLE IF EXISTS `ProjectMetrics`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ProjectMetrics` (
`MetricType` int DEFAULT NULL,
`MetricID` int DEFAULT NULL,
`MetricValue` decimal(20,2) NOT NULL,
`ProjectName` varchar(255) DEFAULT NULL,
KEY `MetricID` (`MetricType`),
CONSTRAINT `ProjectMetrics_ibfk_2` FOREIGN KEY (`MetricType`) REFERENCES `Metrics` (`MetricID`)
`txtPPN` varchar(255) DEFAULT NULL,
KEY `MetricID` (`MetricID`),
CONSTRAINT `ProjectMetrics_ibfk_2` FOREIGN KEY (`MetricID`) REFERENCES `Metrics` (`MetricID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

Expand All @@ -85,6 +86,7 @@ CREATE TABLE `ProjectMetrics` (

LOCK TABLES `ProjectMetrics` WRITE;
/*!40000 ALTER TABLE `ProjectMetrics` DISABLE KEYS */;
INSERT INTO `ProjectMetrics` VALUES (1,5.00,'ABC'),(2,5.00,'ABC'),(3,5.00,'ABC'),(4,5.00,'ABC'),(5,5.00,'ABC'),(6,5.00,'ABC'),(7,5.00,'ABC'),(8,5.00,'ABC'),(9,5.00,'ABC'),(10,5.00,'ABC');
/*!40000 ALTER TABLE `ProjectMetrics` ENABLE KEYS */;
UNLOCK TABLES;

Expand All @@ -98,8 +100,7 @@ DROP TABLE IF EXISTS `Projects`;
CREATE TABLE `Projects` (
`PortfolioID` int DEFAULT NULL,
`txtPPN` varchar(255) NOT NULL,
`txtAddr1` varchar(255) NOT NULL,
`txtAddr2` varchar(255) DEFAULT '',
`txtStreet` varchar(255) DEFAULT NULL,
`txtCity` varchar(255) NOT NULL,
`txtState` char(2) NOT NULL,
`txtZIP` int(5) unsigned zerofill NOT NULL,
Expand All @@ -114,6 +115,7 @@ CREATE TABLE `Projects` (

LOCK TABLES `Projects` WRITE;
/*!40000 ALTER TABLE `Projects` DISABLE KEYS */;
INSERT INTO `Projects` VALUES (1,'ABC','123 Street','Orlando','FL',32751);
/*!40000 ALTER TABLE `Projects` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
Expand All @@ -126,4 +128,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2023-10-15 14:58:06
-- Dump completed on 2023-10-15 16:30:20
3 changes: 2 additions & 1 deletion workstream1/documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,14 @@ across all projects in the portfolio
must be more than 45 percent of the sum of ```txtUnitCount```
across all projects in the portfolio.

1. The sum of the total project cost
1. The sum of the *total project cost*
aggregated across all projects in the portfolio
must be ten times the sum of the CMF awards across the portfolio.
For example, an award of one million dollars in CMF funding
would be the maximum funding permissible
for a portfolio for which the sum of the
total project cost adds to ten million dollars.
*Note that the constraint on this multiplier is based on total project cost, which includes funds from state or local governments, even though the CMF tool calculates a multiplier that is the ratio of private funding to CMF funding, which is also a useful metric.*

1. Sixty percent of rental affordable housing units
must be located in either Areas of Economic Distress or High-Opportunity Areas for Eligible-Income Families.
Expand Down
204 changes: 104 additions & 100 deletions workstream1/templates/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,64 +10,64 @@
<link href="https://fonts.googleapis.com/css2?family=Lato&display=swap" rel="stylesheet">

<style>
body {
font-family: 'Lato', sans-serif;
background-color: #f5f5f5;
color: #333;
margin: 0;
padding: 0;
}
body {
font-family: 'Lato', sans-serif;
background-color: #f5f5f5;
color: #333;
margin: 0;
padding: 0;
}

h1 {
text-align: center;
color: #40a944;
font-size: 36px;
text-align: center;
color: #40a944;
font-size: 36px;
}

.section {
background-color: #fff;
border: 1px solid #ccc;
border-radius: 5px;
padding: 20px;
margin: 10px;
background-color: #fff;
border: 1px solid #ccc;
border-radius: 5px;
padding: 20px;
margin: 10px;
}

label {
font-weight: bold;
font-weight: bold;
}

.form-group {
margin: 10px 0;
margin: 10px 0;
}

input[type="text"],
input[type="number"],
input[type="checkbox"] {
width: 100%;
padding: 10px;
margin: 5px 0;
border: 1px solid #ccc;
border-radius: 3px;
width: 100%;
padding: 10px;
margin: 5px 0;
border: 1px solid #ccc;
border-radius: 3px;
}

.center {
display: flex;
justify-content: center;
display: flex;
justify-content: center;
}

.button {
border: 2px solid #40a944;
padding: 10px 20px;
background-color: #40a944;
color: #fff;
text-transform: uppercase;
font-weight: bold;
border-radius: 5px;
cursor: pointer;
border: 2px solid #40a944;
padding: 10px 20px;
background-color: #40a944;
color: #fff;
text-transform: uppercase;
font-weight: bold;
border-radius: 5px;
cursor: pointer;
}

.button:hover {
background-color: #318934;
background-color: #318934;
}
</style>

Expand All @@ -80,99 +80,103 @@ <h1>Enter Project Details</h1>
<div class="section" id="portfolioDetails">
<h2>Portfolio Details:</h2>
<div class="form-group">
<label for="portfolioID">Portfolio ID:</label>
<input type="number" id="portfolioID" name="portfolioID" required><br>
<label for="PortfolioID">Portfolio ID:</label>
<input type="number" id="PortfolioID" name="PortfolioID" value="1" required><br>
</div>

<div class="form-group">
<label for="portfolioName">Portfolio Name:</label>
<input type="text" id="portfolioName" name="portfolioName" required><br>
<label for="PortfolioName">Portfolio Name:</label>
<input type="text" id="PortfolioName" name="PortfolioName" value="CMF" required><br>
</div>

<div class="form-group">
<label for="portfolioYear">Portfolio Year:</label>
<input type="number" id="portfolioYear" name="portfolioYear" required><br>
<label for="PortfolioYear">Portfolio Year:</label>
<input type="number" id="PortfolioYear" name="PortfolioYear" value="2023" required><br>
</div>
</div>
<div class="section" id="projectDetails">
<h2>Project Details:</h2>
<div class="form-group">
<label for="projectName">Project Name:</label>
<input type="text" id="projectName" name="projectName" required><br>
<label for="txtPPN">Project Name:</label>
<input type="text" id="txtPPN" name="txtPPN" value="ABC" required><br>
</div>

<div class="form-group">
<label for="txtStreet">Street Address:</label>
<input type="text" id="txtStreet" name="txtStreet" placeholder="123 Street"><br>
</div>

<div class="form-group">
<label for="txtState">State:</label>
<input type="text" id="txtState" name="txtState" placeholder="FL"><br>
</div>

<div class="form-group">
<label for="txtZIP">ZIP Code:</label>
<input type="number" id="txtZIP" name="txtZIP" placeholder="32751"><br>
</div>
</div>

<div class="section" id="metrics">
<h2>Metrics:</h2>
<div class="form-group">
<label for="txtUnder30">Units Below 30% AMI:</label>
<input type="number" id="txtUnder30" name="txtUnder30" step="1" required><br>
</div>
<div class="form-group">
<label for="txtUnder50">Units Below 50% AMI:</label>
<input type="number" id="txtUnder50" name="unitsBelow50AMI" step="1" required><br>
</div>

<div class="form-group">
<label for="txtUnder60">Units Below 60% AMI:</label>
<input type="number" id="txtUnder60" name="unitsBelow60AMI" step="1" required><br>
</div>

<div class="form-group">
<label for="txtUnder80">Units Below 80% AMI:</label>
<input type="number" id="txtUnder80" name="unitsBelow80AMI" step="1" required><br>
</div>

<div class="form-group">
<label for="txtUnder120">Units Below 120% AMI:</label>
<input type="number" id="txtUnder120" name="unitsBelow120AMI" step="1" required><br>
</div>

<div class="form-group">
<label for="txtAbove120">Units Above 120% AMI:</label>
<input type="number" id="txtAbove120" name="unitsAbove120AMI" step="1" required><br>
</div>

<div class="form-group">
<label for="txtGovCash">Total Public Sources:</label>
<input type="number" id="txtGovCash" name="totalPublicSources" step="1" required><br>
<input type="text" id="txtStreet" name="txtStreet" placeholder="123 Street" value="123 Street"><br>
</div>

<div class="form-group">
<label for="txtNoCmfClf">FCLF Cash:</label>
<input type="number" id="txtNoCmfClf" name="totalPrivateSources" step="1" required><br>
<label for="txtState">City:</label>
<input type="text" id="txtCity" name="txtCity" placeholder="Orlando" value="Orlando"><br>
</div>

<div class="form-group">
<label for="txtPrivCash">Other Private Sources:</label>
<input type="number" id="txtPrivCash" name="totalPrivateSources" step="1" required><br>
<label for="txtState">State:</label>
<input type="text" id="txtState" name="txtState" placeholder="FL" value="FL"><br>
</div>

<div class="form-group">
<label for="txtCMFLoan">CMF Loan Amount:</label>
<input type="number" id="txtCMFLoan" name="txtCMFLoan" step="1" required><br>
<label for="txtZIP">ZIP Code:</label>
<input type="number" id="txtZIP" name="txtZIP" placeholder="32751" value="32751"><br>
</div>

<div class="section" id="metrics">
<h2>Metrics:</h2>
<div class="form-group">
<label for="txtUnder30">Units Below 30% AMI:</label>
<input type="number" id="txtUnder30" name="txtUnder30" value="5" step="1" required><br>
</div>
<div class="form-group">
<label for="txtUnder50">Units Below 50% AMI:</label>
<input type="number" id="txtUnder50" name="txtUnder50" value="5" step="1" required><br>
</div>

<div class="form-group">
<label for="txtUnder60">Units Below 60% AMI:</label>
<input type="number" id="txtUnder60" name="txtUnder60" value="5" step="1" required><br>
</div>

<div class="form-group">
<label for="txtUnder80">Units Below 80% AMI:</label>
<input type="number" id="txtUnder80" name="txtUnder80" value="5" step="1" required><br>
</div>

<div class="form-group">
<label for="txtUnder120">Units Below 120% AMI:</label>
<input type="number" id="txtUnder120" name="txtUnder120" value="5" step="1" required><br>
</div>

<div class="form-group">
<label for="txtAbove120">Units Above 120% AMI:</label>
<input type="number" id="txtAbove120" name="txtAbove120" value="5" step="1" required><br>
</div>

<div class="form-group">
<label for="txtGovCash">Total Public Sources:</label>
<input type="number" id="txtGovCash" name="txtGovCash" value="5" step="1" required><br>
</div>

<div class="form-group">
<label for="txtNoCmfClf">FCLF Cash:</label>
<input type="number" id="txtNoCmfClf" name="txtNoCmfClf" value="5" step="1" required><br>
</div>

<div class="form-group">
<label for="txtPrivCash">Other Private Sources:</label>
<input type="number" id="txtPrivCash" name="txtPrivCash" value="5" step="1" required><br>
</div>

<div class="form-group">
<label for="txtCMFLoan">CMF Loan Amount:</label>
<input type="number" id="txtCMFLoan" name="txtCMFLoan" value="5" step="1" required><br>
</div>

</div>
<div class="submit-btn center">
<input type="submit" id="submit" class="button" value="Submit">
</div>

</div>
<div class="submit-btn center">
<input type="submit" id="submit" class="button" value="Submit">
</div>

</form>

</body>
Expand Down
Loading

0 comments on commit db061c8

Please sign in to comment.