Commit 8cee2fb7 by logesh.n

built pipelines integrating fastapi pending

parents
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredIdentifiers">
<list>
<option value="random.random.randint" />
</list>
</option>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (Python_task1_aggregation)" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Python_task1_aggregation.iml" filepath="$PROJECT_DIR$/.idea/Python_task1_aggregation.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
[server]
server_path=scripts.services.main:app
port_no=8000
[mongo]
uri=mongodb://localhost:27017
[file_path]
path=temp/company.json;
pipeline1 = [
{
'$match': {
'result': 'violation issued'
}
}, {
'$group': {
'_id': {
'id': '$id'
},
'business_name': {
'$sum': 1
}
}
}, {
'$sort': {
'business_name': -1
}
}, {
'$limit': 1
}
]
pipeline2 = [
{
'$match': {
'result': 'no violation issued'
}
}, {
'$group': {
'_id': {
'business_name': '$business_name'
}
}
}
]
pymongo~=4.3.3
\ No newline at end of file
import configparser
try:
config = configparser.ConfigParser()
config.read("conf/application.conf")
server_path = config.get("server", "server_path")
port_no = config.get("server", "port_no")
uri = config.get("mongo", "uri")
file_path = config.get("file_path", "path")
except configparser.NoOptionError:
print("could not find conf file")
\ No newline at end of file
from pymongo import MongoClient
from scripts.config.config import uri
def db_connect():
try:
connection = MongoClient(uri)
database = connection["Company_DB"]
db_list = connection.list_database_names()
if database in db_list:
print("\nDatabase with same name already exist")
print("database created successfully")
return database
except Exception as e:
print(str(e))
[
{
"id": "50-392-2212",
"certificate_number": "0422200840",
"business_name": "Lazzy Corp.",
"date": "9/25/2022",
"result": "violation issued",
"sector": "Public Utilities"
},
{
"id": "50-392-2212",
"certificate_number": "2340935792",
"business_name": "Lazzy Corp.",
"date": "3/31/2022",
"result": "violation issued",
"sector": "Public Utilities"
},
{
"id": "29-950-5125",
"certificate_number": "7998463112",
"business_name": "Zoombox Pvt Ltd",
"date": "12/17/2022",
"result": "no violation issued",
"sector": "Health Care"
},
{
"id": "29-950-5125",
"certificate_number": "8502836099",
"business_name": "Zoombox Pvt Ltd",
"date": "4/10/2022",
"result": "violation issued",
"sector": "Health Care"
},
{
"id": "50-392-2212",
"certificate_number": "5681916650",
"business_name": "Lazzy Corp.",
"date": "3/14/2022",
"result": "violation issued",
"sector": "Public Utilities"
},
{
"id": "48-916-1570",
"certificate_number": "4277950450",
"business_name": "Gabspot Pvt Ltd",
"date": "9/10/2022",
"result": "violation issued",
"sector": "Technology"
},
{
"id": "50-392-2212",
"certificate_number": "5376476316",
"business_name": "Lazzy Corp.",
"date": "5/2/2022",
"result": "violation issued",
"sector": "Public Utilities"
},
{
"id": "48-916-1570",
"certificate_number": "7514342753",
"business_name": "Gabspot Pvt Ltd",
"date": "3/3/2022",
"result": "no violation issued",
"sector": "Technology"
},
{
"id": "48-916-1570",
"certificate_number": "6116426395",
"business_name": "Gabspot Pvt Ltd",
"date": "1/10/2023",
"result": "violation issued",
"sector": "Technology"
},
{
"id": "50-392-2212",
"certificate_number": "0502149132",
"business_name": "Lazzy Corp.",
"date": "2/21/2022",
"result": "violation issued",
"sector": "Public Utilities"
}
]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment